/* ══════════════════════════════════════════════════════════
   ثيم أثر — ستايل مستقل بالكامل
   لا Tailwind ولا أي سكربت خارجي: الصفحة تُعرض فورًا على أي شبكة.
   ══════════════════════════════════════════════════════════ */

:root {
    --primary: #00d2ff;
    --secondary: #9d50bb;
    --bg-dark: #030712;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-500: #64748b;
    --text: #e2e8f0;
}

*, *::before, *::after { box-sizing: border-box; }

/* قصّ التمرير الأفقي على html وbody معًا —
   وضعه على body وحده لا يكفي: يبقى html قابلاً للتمرير. */
html {
    overflow-x: hidden;
    max-width: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    /* خطوط النظام أولًا حتى يظهر النص فورًا قبل تحميل Tajawal */
    font-family: 'Tajawal', 'Segoe UI', Tahoma, system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text);
    overflow-x: hidden;
    max-width: 100%;
    line-height: 1.6;
}

.page {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.shell { width: 100%; max-width: 760px; margin: 0 auto; position: relative; z-index: 10; }
.shell-sm { max-width: 620px; }

/* ─────────── الخلفية المتحركة ─────────── */
/* الهالات الملوّنة مرسومة كتدرّجات داخل الخلفية نفسها، لا كعناصر مع
   filter: blur(80px). السبب: الضبابية على عناصر كبيرة من أثقل عمليات
   الرسم، وiOS قد يفشل في تركيبها فتظهر الصفحة سوداء بالكامل.
   التدرّج يعطي نفس المظهر بتكلفة شبه معدومة. */
.bg-animate {
    position: fixed;
    inset: 0;
    top: 0; left: 0; right: 0; bottom: 0;   /* بديل inset للمتصفحات الأقدم */
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(circle 340px at 12% 16%, rgba(0, 210, 255, .20), transparent 70%),
        radial-gradient(circle 340px at 88% 84%, rgba(157, 80, 187, .22), transparent 70%),
        radial-gradient(circle at 50% 50%, #1e1b4b 0%, #030712 100%);
}

/* ─────────── الترويسة ─────────── */
.hero { text-align: center; margin-bottom: 32px; }

.logo-wrap { position: relative; display: inline-block; }
.logo-glow {
    /* توهّج بـbox-shadow بدل filter: blur — لا ضبابية على الإطلاق،
       فلا عمل إضافي على معالج الرسم في الهواتف. */
    position: absolute;
    inset: 0; top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    box-shadow: 0 0 34px 10px rgba(34, 211, 238, .28),
                0 0 54px 22px rgba(147, 51, 234, .18);
}
.logo-img {
    position: relative;
    width: 112px; height: 112px;
    border-radius: 50%;
    border: 2px solid #1e293b;
    object-fit: cover;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .6);
    display: block;
}

.hero-title {
    margin: 24px 0 0;
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.3;
    background: linear-gradient(90deg, #22d3ee, #3b82f6, #9333ea);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
/* احتياط: لو لم يدعم المتصفح قصّ الخلفية على النص يبقى النص مقروءًا */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
    .hero-title { background: none; color: #67e8f9; }
}

.hero-sub { color: var(--slate-400); margin: 8px 0 0; font-size: .95rem; }

/* ─────────── البطاقة الزجاجية ─────────── */
.glass-container {
    /* خلفية شبه معتمة تكفي وحدها — الضبابية تحسين اختياري فقط،
       وتُطبَّق على الشاشات الكبيرة حيث لا يوجد ضغط على معالج الرسم. */
    background: rgba(15, 23, 42, .82);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .5);
    border-radius: 24px;
    padding: 24px 20px;
}

/* ─────────── الحقول ─────────── */
.stack > * + * { margin-top: 20px; }

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: .875rem;
    color: var(--slate-400);
}
.field-label-strong {
    display: block;
    margin-bottom: 12px;
    font-size: .875rem;
    font-weight: 700;
    color: var(--slate-300);
}
.field-hint { color: var(--slate-500); font-size: .78rem; margin: 8px 0 0; }

.input-style {
    background: rgba(255, 255, 255, .03);
    border: 1.5px solid rgba(255, 255, 255, .1);
    padding: 12px 16px;
    border-radius: 12px;
    width: 100%;
    max-width: 100%;
    outline: none;
    transition: border-color .25s ease, box-shadow .25s ease;
    color: #fff;
    font-family: inherit;
    /* 16px فما فوق يمنع سفاري من تكبير الصفحة تلقائيًا عند التركيز */
    font-size: 16px;
}
.input-style:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 210, 255, .15);
}
select.input-style { background-color: #0f172a; appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--slate-400) 50%),
                      linear-gradient(135deg, var(--slate-400) 50%, transparent 50%);
    background-position: 18px calc(50% - 2px), 23px calc(50% - 2px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-left: 40px;
}
select.input-style option { background: #0f172a; color: #fff; }
textarea.input-style { resize: vertical; min-height: 96px; }

.row2 { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* ─────────── بطاقات الأقسام ─────────── */
.dept-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.checkbox-card {
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .1);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: .25s;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;            /* هدف لمس مريح */
    font-size: .92rem;
}
.checkbox-card:hover { background: rgba(0, 210, 255, .05); border-color: var(--primary); }
.checkbox-card input { flex: none; width: 17px; height: 17px; accent-color: var(--primary); margin: 0; }
.checkbox-card input:checked + span { color: var(--primary); font-weight: 700; }

/* ─────────── الأزرار ─────────── */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    border: 0;
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform .25s ease, box-shadow .25s ease;
}
.btn-primary:hover { transform: scale(1.02); box-shadow: 0 10px 20px -5px rgba(0, 210, 255, .4); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.link-soft { color: var(--primary); text-decoration: underline; background: none; border: 0;
    font-family: inherit; font-size: 1rem; cursor: pointer; }

/* ─────────── شاشة النجاح ─────────── */
.ok-ring {
    width: 80px; height: 80px;
    background: rgba(34, 197, 94, .2);
    border: 1px solid rgba(34, 197, 94, .5);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 24px;
}
.ok-ring svg { width: 40px; height: 40px; stroke: #22c55e; }
.ok-title { font-size: 1.6rem; font-weight: 700; color: #fff; margin: 0 0 8px; }
.ok-text  { color: var(--slate-400); margin: 0; }

.foot { text-align: center; margin-top: 28px; color: var(--slate-500); font-size: .78rem; }
.foot a { color: rgba(0, 210, 255, .75); text-decoration: underline; }
.foot p { margin: 0 0 6px; }

/* ─────────── مساعدات ─────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.num-ltr { direction: ltr; text-align: right; }

/* حركة الدخول تحرّك الموضع فقط ولا تلمس الشفافية إطلاقًا.
   السبب: بعض المتصفحات (متصفح واتساب الداخلي، وضع توفير الطاقة،
   التبويب المخفي) تُجمّد الحركات عند أول إطار — ومع opacity:0
   كانت الصفحة تبقى سوداء فارغة للأبد. الآن المحتوى ظاهر دائمًا
   مهما حصل، والحركة مجرد تحسين إضافي. */
.fade-in { animation: riseIn .5s ease-out; }
@keyframes riseIn {
    from { transform: translateY(14px); }
    to   { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .fade-in { animation: none; }
    .btn-primary:hover { transform: none; }
}

/* مصيدة البوتات — إخفاء بصري لا يولّد أي تمرير أفقي.
   (left:-9999px كان يضيف آلاف البكسلات لعرض الصفحة في RTL) */
.trap {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* ─────────── الإشعار ─────────── */
#toast {
    position: fixed;
    inset-inline: 0;
    bottom: 20px;
    z-index: 60;
    display: flex;
    justify-content: center;
    padding: 0 16px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .25s ease, transform .25s ease;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast > div {
    max-width: min(92vw, 30rem);
    background: rgba(15, 23, 42, .97);
    border: 1px solid rgba(0, 210, 255, .35);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7);
    border-radius: 14px;
    padding: 14px 18px;
    font-size: .95rem;
    line-height: 1.6;
    color: var(--text);
}
#toast.err > div { border-color: rgba(248, 113, 113, .45); }

/* ─────────── الشاشات الأكبر ─────────── */
@media (min-width: 768px) {
    .glass-container {
        background: rgba(15, 23, 42, .6);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }
    .page { padding: 32px; }
    .hero { margin-bottom: 40px; }
    .glass-container { padding: 40px; border-radius: 32px; }
    .row2 { grid-template-columns: 1fr 1fr; }
    .dept-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .hero-sub { font-size: 1rem; }
    .ok-title { font-size: 1.85rem; }
}

/* ─────────── الهواتف الصغيرة ─────────── */
@media (max-width: 400px) {
    .hero-title { font-size: 1.8rem; }
    .logo-img { width: 92px; height: 92px; }
    .checkbox-card { font-size: .85rem; padding: 9px; }
    .glass-container { padding: 20px 15px; }
}
