/* ==========================================================================
   auth.css — شاشات الدخول / طلب الوصول / رمز التحقق / استلام الطلب
   أُعيد تصميمها (الجولة الثالثة، 2026-09-06) على نظام المقيّم (assessor):
   عمود تعريفي كحلي بلغة الشريط الجانبي (توهّجان + شعار أبيض + مزايا كأقراص)
   على يمين الصفحة، وصفحة فاتحة ببطاقة بيضاء تحمل النموذج.
   لا يُحمَّل assessor.css هنا (preflight العناصر + افتراضات .as-shell) — القيم
   العشرون المطلوبة منقولة كتوكنات --auth-*. الخط: Greta Arabic — لم يُغيَّر.
   ========================================================================== */

:root {
    /* الصفحة والعمود التعريفي */
    --auth-bg: #f6f7ff;
    --auth-side: #0d0035;
    --auth-glow-teal: #00c7be;
    --auth-glow-purple: #8800ff;
    --auth-intro-w: 460px;

    /* ألوان البطاقة */
    --auth-shell: #f6f7ff;
    --auth-surface: #ffffff;
    --auth-ink: #0d0f52;
    --auth-text: #191919;
    --auth-body: #515151;
    --auth-muted: #6f6f6f;
    --auth-line: #eaeaea;
    --auth-line-2: #dde0e0;
    --auth-check-line: #c3ccd3;

    /* الحالات */
    --auth-danger: #b42318;
    --auth-danger-bg: rgba(221, 4, 23, 0.1);
    --auth-required: #dd0417;
    --auth-success: #027a48;
    --auth-success-bg: rgba(26, 159, 88, 0.1);
    --auth-warn: #a96908;
    --auth-warn-bg: rgba(242, 150, 12, 0.1);

    /* اللون الأساسي */
    --auth-accent: #3333ff;
    --auth-accent-deep: #2d0e8b;
    --auth-accent-600: #5a30ff;
    --auth-accent-200: #d8daff;
    /* حدّ الحقل النشط (brand-400) */
    --auth-accent-soft: #8a8df8;
    --auth-grad: linear-gradient(270deg, #3333ff 0%, #2d0e8b 100%);

    /* الظلال والانحناءات */
    --auth-radius: 16px;
    --auth-radius-lg: 24px;
    --auth-shadow-card: 0 1px 6px rgba(0, 0, 0, 0.06);
    --auth-shadow-btn: 0 10px 17.5px rgba(67, 97, 238, 0.38);
    --auth-shadow-banner: 0 0 24px rgba(0, 0, 0, 0.05);
}

/* --------------------------------------------------------------- الأساس -- */

/* الصفحة مستقلة (بلا reset) — الأبعاد أبعاد خارجية، فبدون border-box
   تُضاف الحشوات فوق العرض وتنكمش الأعمدة. */
.auth-body,
.auth-body *,
.auth-body *::before,
.auth-body *::after {
    box-sizing: border-box;
}

.auth-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--auth-bg);
    color: var(--auth-text);
    font-family: 'Greta Arabic', sans-serif;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ------------------------------------------------------- الشبكة الرئيسية -- */

/* row (لا row-reverse): الصفحة RTL فيقع العمود التعريفي — الابن الأول —
   على يمين الشاشة تمامًا كـ aside.as-sidebar في شاشات المقيّم */
.auth-shell {
    flex: 1 0 auto;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

/* ------------------------------------------------- العمود التعريفي (يمين) -- */

.auth-intro {
    flex: 0 0 var(--auth-intro-w);
    width: var(--auth-intro-w);
    min-width: 0;
    position: sticky;
    top: 0;
    align-self: flex-start;
    /* min-height لا height (AUTH-11): على الشاشات القصيرة (1366×650 مع شريط
       المتصفح) ينمو العمود مع محتواه ويصل قرص «العودة» بالتمرير بدل أن يُقصّ —
       الـsticky يتراجع للتدفّق العادي حين يفوق ارتفاع العمود المنفذ. */
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
    padding: 48px 24px;
    background: var(--auth-side);
    color: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 48px;
}

/* التوهّجان الزخرفيان — منسوخان من .as-sidebar (فيجما: أزرق مخضرّ أسفل + بنفسجي أعلى) */
.auth-intro::before {
    content: '';
    position: absolute;
    inset-inline-start: -82px;
    bottom: -118px;
    width: 237px;
    height: 237px;
    border-radius: 50%;
    background: var(--auth-glow-teal);
    opacity: 0.46;
    filter: blur(105px);
    pointer-events: none;
}

.auth-intro::after {
    content: '';
    position: absolute;
    inset-inline-end: 21px;
    top: 107px;
    width: 267px;
    height: 294px;
    border-radius: 50%;
    background: var(--auth-glow-purple);
    opacity: 0.08;
    filter: blur(34px);
    pointer-events: none;
}

.auth-logo-box {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-logo {
    display: block;
    width: 222px;
    max-width: 100%;
    height: auto;
}

.auth-intro__body {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.auth-headline {
    margin: 0;
    font-size: 28px;
    font-weight: 500;
    line-height: 44px;
    color: #fff;
}

.auth-perks {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* صفوف المزايا — أقراص بلغة عناصر الشريط الجانبي (.as-nav-item) */
.auth-perk {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding-block: 8px;
    padding-inline-start: 8px;
    padding-inline-end: 16px;
    border-radius: var(--auth-radius-lg);
    background: rgba(255, 255, 255, 0.05);
    font-size: 14px;
    font-weight: 400;
    line-height: 22px;
    color: #fff;
}

/* شارة ✓ — قرص 32px بلون brand-600 يحمل check-bullet.svg مبيَّضًا */
.auth-perk__icon {
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--auth-accent-600);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-perk__icon img {
    display: block;
    width: 12px;
    height: 12px;
    filter: brightness(0) invert(1);
}

/* ذيل العمود: رابط العودة كقرص */
.auth-foot {
    position: relative;
    z-index: 1;
    margin-top: auto;
}

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding-inline: 16px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 20px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.auth-back:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* السهم المصدَّر يشير يمينًا (❯) — وهي جهة «العودة» في RTL، فلا يُقلب */
.auth-back img {
    display: block;
    width: auto;
    height: 12px;
    filter: brightness(0) invert(1);
}

/* شريط فلاش انتهاء الجلسة (419): ثابت أعلى الشاشة، خارج تدفق .auth-shell
   (لو دخل التدفق لصار عمودًا ثالثًا في الصف) */
.auth-flash {
    position: fixed;
    top: 18px;
    inset-inline: 0;
    margin: 0 auto;
    width: fit-content;
    max-width: min(92vw, 560px);
    z-index: 60;
    background: var(--auth-warn-bg);
    color: var(--auth-warn);
    border: 1px solid rgba(242, 150, 12, 0.35);
    border-radius: 999px;
    padding: 10px 22px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: var(--auth-shadow-banner);
    backdrop-filter: blur(6px);
}

/* ------------------------------------------------------ عمود البطاقة (يسار) */

.auth-panel {
    flex: 1 1 auto;
    min-width: 0;
    padding: 48px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.auth-panel > * {
    width: 100%;
    max-width: 612px;
}

.auth-panel__head {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-panel__title {
    margin: 0;
    color: var(--auth-ink);
    font-size: 20px;
    font-weight: 700;
    line-height: 37px;
}

.auth-panel__sub {
    margin: 0;
    color: var(--auth-body);
    font-size: 16px;
    font-weight: 400;
    line-height: 28px;
}

.auth-card {
    background: var(--auth-surface);
    border: 1px solid var(--auth-line);
    border-radius: var(--auth-radius-lg);
    box-shadow: var(--auth-shadow-card);
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* البطاقات الطويلة (طلب الوصول) تستخدم فراغًا أضيق */
.auth-card--tight {
    gap: 24px;
}

.auth-fields {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ------------------------------------------------------------- الحقول ---- */
/* مقاييس .as-field / .as-input: عنوان 14/500 بارتفاع 30، حقل 48 بزوايا 16 */

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.auth-field__label {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 30px;
    color: var(--auth-body);
    font-size: 14px;
    font-weight: 500;
    line-height: 30px;
}

.auth-field__req {
    color: var(--auth-required);
    font-size: 16px;
    line-height: 30px;
}

.auth-field__hint {
    color: var(--auth-muted);
    font-size: 14px;
    font-weight: 400;
    line-height: 30px;
}

.auth-control {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 8px 16px;
    background: var(--auth-surface);
    border: 1px solid var(--auth-line);
    border-radius: var(--auth-radius);
    transition: border-color 0.15s ease;
}

/* حلقة تركيز واحدة (AUTH-05) بمقاييس .as-input:focus — الحدّ يبقى #eaeaea
   ولا يتلوّن، وإلا ظهرت حلقتان متداخلتان */
.auth-control:focus-within {
    outline: 2px solid var(--auth-accent-soft);
    outline-offset: 1px;
}

.auth-control input,
.auth-control textarea {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 0;
    color: var(--auth-text);
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 26px;
}

.auth-control input::placeholder,
.auth-control textarea::placeholder {
    color: var(--auth-muted);
}

/* حقل بريد LTR داخل نموذج RTL (AUTH-06): بشكل .as-input.is-ltr-end — الاتجاه
   LTR لكن النص والـplaceholder معًا على الحافة اليمنى، فلا يقفز النص عند أول ضغطة */
.auth-control input[dir='ltr'] {
    text-align: right;
}

.auth-control--textarea {
    align-items: flex-start;
    min-height: 80px;
    border-color: var(--auth-line-2);
}

.auth-control--textarea textarea {
    min-height: 60px;
    line-height: 22px;
    resize: vertical;
}

/* زر إظهار/إخفاء كلمة المرور */
.auth-reveal {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: var(--auth-muted);
}

.auth-reveal svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* display:block أعلاه يغلب display:none المضمَّن لسمة hidden — بدون هذه القاعدة
   تظهر العينان معاً ولا يبدّل الزر شيئاً (عطل «إظهار كلمة المرور» 2026-08-11) */
.auth-reveal svg[hidden] {
    display: none;
}

/* حقل الجوال: علم + فاصل + رقم (الأرقام تُكتب من اليسار) */
.auth-control--phone {
    gap: 16px;
    direction: ltr;
}

.auth-control--phone input {
    text-align: left;
}

.auth-phone__cc {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.auth-phone__cc img {
    width: 24px;
    height: 24px;
    display: block;
}

.auth-phone__divider {
    flex: none;
    align-self: stretch;
    width: 1px;
    background: var(--auth-line);
    margin-block: -8px;
}

/* صف حقلين جنبًا إلى جنب */
.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* --------------------------------------------------------- حالة الخطأ ---- */

.auth-control.is-invalid {
    border-color: var(--auth-danger);
}

/* الحالة الخاطئة: الحدّ الأحمر من .is-invalid يبقى، وتتلوّن الحلقة الواحدة بالأحمر */
.auth-control.is-invalid:focus-within {
    outline-color: var(--auth-danger);
}

/* دور .as-form-error (AUTH-09): 13/700 */
.auth-error {
    margin: 0;
    color: var(--auth-danger);
    font-size: 13px;
    font-weight: 700;
    line-height: 20px;
}

/* تنبيه داخل البطاقة — بشكل .as-info-banner (زوايا 8، ظل خفيف، أيقونة/نص 14) */
.auth-alert {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 16px;
    border: 1px solid rgba(221, 4, 23, 0.2);
    background: var(--auth-danger-bg);
    border-radius: 8px;
    box-shadow: var(--auth-shadow-banner);
    color: var(--auth-danger);
    font-size: 14px;
    font-weight: 500;
    line-height: 22px;
    list-style: none;
}

.auth-alert--ok {
    border-color: rgba(26, 159, 88, 0.25);
    background: var(--auth-success-bg);
    color: var(--auth-success);
}

/* -------------------------------------------------- الصف تحت كلمة المرور -- */

.auth-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 20px;
}

.auth-remember {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--auth-body);
    font-size: 14px;
    line-height: 20px;
    cursor: pointer;
    user-select: none;
}

/* مربّع «تذكرني» ومربّع التعهّد — بشكل .as-az-check: 20×20، حدّ 1.5px #c3ccd3
   وزوايا 4px، وعند التحديد يمتلئ بالتدرّج مع علامة ✓ بيضاء مرسومة بـCSS */
.auth-remember input,
.auth-consent input {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 1.5px solid var(--auth-check-line);
    border-radius: 4px;
    background: var(--auth-surface);
    cursor: pointer;
}

.auth-remember input:checked,
.auth-consent input:checked {
    border-color: var(--auth-accent);
    background: var(--auth-grad);
}

.auth-remember input:checked::after,
.auth-consent input:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.auth-remember input:focus-visible,
.auth-consent input:focus-visible {
    outline: 2px solid var(--auth-accent-soft);
    outline-offset: 2px;
}

/* ------------------------------------------- تعهّد الاستخدام الشخصي --- */

/* النص يلتفّ على سطرين، فتُحاذى الكتلة من الأعلى لا من المنتصف */
.auth-consent {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--auth-body);
    font-size: 14px;
    font-weight: 400;
    line-height: 22px;
    cursor: pointer;
    user-select: none;
}

.auth-consent input {
    flex: 0 0 auto;
    margin-top: 1px; /* محاذاة المربّع مع أول سطر من النص */
}

.auth-consent.is-invalid input {
    border-color: var(--auth-danger);
}

.auth-link {
    color: var(--auth-accent);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
}

/* زر «إعادة إرسال الرمز» يرث مظهر الرابط بلا حلّة الزر الافتراضية (AUTH-04) */
button.auth-link {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    cursor: pointer;
}

button.auth-link:focus-visible {
    outline: 2px solid var(--auth-accent-soft);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ------------------------------------------------------------- الأزرار --- */
/* مقاييس .as-btn-primary: تدرّج 270°، زوايا 16، حشوة 12/32، خط 15/700، توهّج */

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 12px 32px;
    border: 0;
    border-radius: var(--auth-radius);
    background: var(--auth-grad);
    box-shadow: var(--auth-shadow-btn);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 22.5px;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.auth-btn:hover {
    filter: brightness(1.08);
}

.auth-btn:active {
    transform: translateY(1px);
}

.auth-btn:focus-visible {
    outline: 2px solid var(--auth-accent-soft);
    outline-offset: 2px;
}

.auth-btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* الزر المحيطي (.as-btn-outline): خلفية بيضاء، حدّ بلون العلامة، ونص متدرّج داخل <span> */
.auth-btn--outline {
    background: var(--auth-surface);
    border: 1px solid var(--auth-accent);
    box-shadow: none;
    padding: 11px 32px;
}

.auth-btn--outline > span {
    background: var(--auth-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.auth-btn--outline:hover {
    filter: none;
    box-shadow: var(--auth-shadow-btn);
}

.auth-switch {
    margin: 0;
    text-align: center;
    color: var(--auth-body);
    font-size: 14px;
    font-weight: 500;
    line-height: 26px;
}

.auth-switch a {
    color: var(--auth-accent);
    font-weight: 700;
    text-decoration: none;
    margin-inline-start: 4px;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* ------------------------------------------------------ رمز التحقق (OTP) -- */

.auth-otp {
    display: flex;
    justify-content: center;
    gap: 12px;
    direction: ltr;
}

.auth-otp input {
    flex: none;
    width: 64px;
    height: 64px;
    padding: 8px;
    border: 1px solid var(--auth-line);
    border-radius: var(--auth-radius);
    background: var(--auth-surface);
    color: var(--auth-ink);
    font: inherit;
    font-size: 24px;
    font-weight: 500;
    text-align: center;
    outline: 0;
    transition: border-color 0.15s ease;
}

/* حلقة واحدة كما في .auth-control:focus-within (AUTH-05) */
.auth-otp input:focus {
    outline: 2px solid var(--auth-accent-soft);
    outline-offset: 1px;
}

/* رمز خاطئ — حدّ أحمر على كل المربّعات */
.auth-otp.is-invalid input {
    border-color: var(--auth-danger);
}

.auth-otp.is-invalid input:focus {
    outline-color: var(--auth-danger);
}

.auth-countdown {
    margin: 0;
    color: var(--auth-body);
    font-size: 14px;
    line-height: 20px;
    text-align: center;
}

/* --------------------------------------------- صفحة «تم استلام طلبك» ---- */

.auth-card--center {
    align-items: center;
    text-align: center;
    gap: 24px;
}

.auth-done {
    display: block;
    width: 64px;
    height: 64px;
}

/* الخطوات الثلاث: صفوف بلون الصفحة وزوايا 16، بشارة رقم بشكل .as-num-badge */
.auth-steps {
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: start;
}

.auth-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--auth-radius);
    background: var(--auth-bg);
    color: var(--auth-text);
    font-size: 14px;
    line-height: 22px;
}

.auth-step__num {
    flex: none;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-surface);
    border: 1px solid var(--auth-accent-200);
    border-radius: 8px;
    color: var(--auth-ink);
    font-size: 14px;
    font-weight: 700;
}

/* الزرّان: الأساسي أولًا في الـDOM (أقصى اليمين) ثم المحيطي */
.auth-cta-row {
    width: 100%;
    display: flex;
    gap: 16px;
}

.auth-cta-row .auth-btn {
    flex: 1 1 0;
    width: auto;
}

/* --------------------------------------------------------------- تجاوب -- */

@media (max-width: 1180px) {
    :root {
        --auth-intro-w: 400px;
    }

    .auth-panel {
        padding: 40px 24px;
    }

    .auth-headline {
        font-size: 24px;
        line-height: 38px;
    }
}

@media (max-width: 1023px) {
    .auth-shell {
        flex-direction: column;
        min-height: 0;
    }

    /* العمود الكحلي يتحوّل إلى شريط رأسي فوق البطاقة.
       relative لا static (AUTH-01): يلغي الـsticky ويبقى حاوية للتوهّجين
       المطلقَين كي يقصّهما overflow:hidden داخل الشريط بدل أن يطفوا فوق الصفحة الفاتحة */
    .auth-intro {
        flex: none;
        width: 100%;
        position: relative;
        min-height: 0;
        height: auto;
        padding: 32px 24px;
        gap: 24px;
    }

    .auth-logo {
        width: 200px;
    }

    .auth-intro__body {
        gap: 16px;
    }

    .auth-headline {
        font-size: 22px;
        line-height: 34px;
    }

    /* رابط العودة يُذيَّل الشريط بعد المزايا */
    .auth-foot {
        order: 99;
        margin-top: 0;
    }

    .auth-panel {
        flex: none;
        justify-content: flex-start;
        padding: 32px 24px;
    }
}

@media (max-width: 640px) {
    .auth-intro {
        padding: 24px 16px;
    }

    .auth-logo {
        width: 180px;
    }

    .auth-headline {
        font-size: 20px;
        line-height: 32px;
    }

    /* المزايا تبقى للتابلت فقط، وتُخفى على الجوال */
    .auth-perks {
        display: none;
    }

    .auth-panel {
        padding: 24px 16px;
        gap: 20px;
    }

    .auth-panel__title {
        font-size: 18px;
        line-height: 32px;
    }

    .auth-panel__sub {
        font-size: 14px;
        line-height: 24px;
    }

    .auth-card {
        padding: 20px;
        gap: 24px;
        border-radius: 20px;
    }

    .auth-card--tight {
        gap: 20px;
    }

    .auth-fields,
    .auth-actions {
        gap: 16px;
    }

    .auth-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .auth-otp {
        gap: 8px;
    }

    .auth-otp input {
        width: 44px;
        height: 52px;
        font-size: 20px;
    }

    .auth-cta-row {
        flex-direction: column;
    }
}
