/* ═══════════════════════════════════════════════════════════════════════
   ACCOUNT PAGES — page-scoped rules only (register/login/verify/forgot/
   reset/landing). Loaded LAST (see each Account page's Styles section,
   after layout.css) — every rule below composes tokens.css/theme.css/
   components.css (.card/.field/.input/.btn/.badge/.alert), never
   redeclares a colour, radius, spacing or shadow (Q9/Q24).
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Shared auth shell (register / login / verify / forgot / reset) ────── */

.auth-shell {
    padding-block: var(--space-12) var(--space-20);
    display: flex;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: var(--space-8) var(--space-6);
    box-shadow: var(--shadow-card);
}

.auth-card--wide { max-width: 480px; }

.auth-card__header { margin-block-end: var(--space-6); text-align: center; }
.auth-card__eyebrow {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--brand);
    margin-block-end: var(--space-2);
}
.auth-card__title { font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--ink); margin: 0 0 var(--space-2); }
.auth-card__subtitle { font-size: var(--text-base); color: var(--ink-soft); margin: 0; }

.auth-form { display: flex; flex-direction: column; gap: var(--space-5); }

.auth-card__submit { width: 100%; margin-block-start: var(--space-2); }

.auth-card__footer {
    margin-block-start: var(--space-6);
    padding-block-start: var(--space-5);
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: var(--text-base);
    color: var(--ink-soft);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.auth-card__footer a { color: var(--brand); font-weight: var(--weight-semibold); }
.auth-card__footer a:hover { color: var(--brand-deep); }

.auth-form-alert { margin-block-end: var(--space-1); }

/* ── Password requirements checklist (shown BEFORE submit, never after) ── */

.password-requirements {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}
.password-requirements__item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--ink-soft);
}
.password-requirements__item .icon { width: 16px; height: 16px; flex: 0 0 auto; color: var(--ink-faint); }
.password-requirements__item.is-met { color: var(--success-base); }
.password-requirements__item.is-met .icon { color: var(--success-base); }

/* ── OTP challenge (verify + reset) ──────────────────────────────────────── */

.otp-target {
    background: var(--paper-muted);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    color: var(--ink);
    text-align: center;
}
.otp-target strong { color: var(--brand); }

.otp-input {
    text-align: center;
    letter-spacing: .6em;
    font-size: var(--text-2xl);
    font-variant-numeric: tabular-nums;
    padding-inline-start: calc(var(--space-3) + .6em); /* re-centers the letter-spaced glyphs */
}

.otp-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--ink-soft);
}
.otp-countdown { font-variant-numeric: tabular-nums; font-weight: var(--weight-semibold); color: var(--ink); }
.otp-countdown.is-expiring { color: var(--danger-base); }
.otp-resend {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: var(--weight-semibold);
    color: var(--brand);
    cursor: pointer;
}
.otp-resend:hover:not(:disabled) { color: var(--brand-deep); text-decoration: underline; }
.otp-resend:disabled { color: var(--ink-faint); cursor: not-allowed; }

.otp-step { display: flex; flex-direction: column; gap: var(--space-5); }
.otp-step[hidden] { display: none; }

/* ── Account landing (/account) ──────────────────────────────────────────── */

.account-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    padding-block: var(--space-8) var(--space-6);
    border-bottom: 1px solid var(--line);
    margin-block-end: var(--space-8);
}
.account-hero__name { font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--ink); margin: 0 0 var(--space-1); }
.account-hero__email { font-size: var(--text-base); color: var(--ink-soft); margin: 0; }

.account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-5);
    padding-block-end: var(--space-20);
}

.account-tile { display: flex; flex-direction: column; gap: var(--space-3); }
.account-tile__title { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--ink); margin: 0; }
.account-tile__desc { font-size: var(--text-sm); color: var(--ink-soft); margin: 0; flex: 1 1 auto; }

.account-tile--soon { opacity: .75; }
.account-tile--soon .account-tile__title { display: flex; align-items: center; gap: var(--space-2); }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Account shell — shared side nav + content, /account + /account/orders ──
   Founder comp: a dark side rail that lists every account destination, real
   routes as links, not-yet-built ones disabled with a "قريبا" tag rather
   than a dead link (Q46). Markup is duplicated verbatim on both pages (no
   partial view in this wave's file scope) — only the active item differs.
   In the RTL document the nav sits first in source order, so a plain flex
   row already places it on the visual RIGHT with zero direction hacks.

   §79 — sidebar 260px + 24px gap + content inside a 1280px container
   (--container-max, tokens.css:177 — confirmed 1280 live, not the 1400
   the neighbouring comment describes wanting). The container itself still
   carries its own 24px gutter each side (--container-padding, tokens.css:
   181), so the row's real inner width at the reference 1280 viewport is
   1232px, not 1280 — a fixed 996px content column would overflow by 48px.
   max-width (not width) keeps 996 as a ceiling the column never exceeds
   on very wide screens, while still shrinking honestly on anything
   narrower — no horizontal scroll either way. ── */

.account-shell {
    display: flex;
    align-items: flex-start;
    gap: var(--space-6); /* 24px, §79 */
    padding-block: var(--space-8) var(--space-20);
}

.account-nav {
    flex: 0 0 260px; /* §79 */
    width: 260px;
    background: var(--brand-900);
    border-radius: var(--card-radius, var(--radius-md));
    padding: var(--space-4);
    position: sticky; /* §79 — sticky on desktop */
    top: var(--space-6);
}

.account-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.account-nav__link {
    display: flex;
    align-items: center;
    width: 100%;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    border-inline-start: 3px solid transparent;
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-standard),
                color var(--duration-fast) var(--ease-standard);
}
.account-nav__link .icon { flex: 0 0 auto; }
a.account-nav__link:hover,
button.account-nav__link:hover { background: rgba(255, 255, 255, .08); color: var(--brand-text); }

/* بند 12 (تسجيل الخروج، §39) عنصر <button> حقيقي لا <a> — يحمل نفس صنف
   .account-nav__link فيرث كل مقاييسه، ويحتاج فقط استرجاع افتراضيات المتصفح
   لعنصر button (خلفية/حد/خط/محاذاة نص) حتى يتطابق بصريا مع باقي الروابط. */
button.account-nav__link {
    background: none;
    border: none;
    border-inline-start: 3px solid transparent;
    font: inherit;
    text-align: start;
}

.account-nav__link--active {
    background: rgba(255, 255, 255, .06);
    border-inline-start-color: var(--gold);
    color: var(--brand-text);
}

.account-nav__link--soon {
    opacity: .65;
    cursor: default;
}

.account-nav__soon-badge { margin-inline-start: auto; }

/* فاصل بصري قبل "تسجيل الخروج" (بند 12) — فعل خروج من الحساب مختلف طبيعة
   عن التنقل بين وجهاته، فيفصل بخط رفيع في القائمة العمودية (سطح المكتب). */
.account-nav__signout {
    margin-block-start: var(--space-2);
    padding-block-start: var(--space-2);
    border-block-start: 1px solid rgba(255, 255, 255, .12);
}

.account-content {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 996px; /* §79 ceiling — see rationale on .account-shell above */
}

/* §67 — three founder-specified breakpoints (1280 / 1024 / 768), literal
   pixel values distinct from the site's own --bp-lg:900 token (tokens.css:
   173) which governs unrelated layouts (product filter rail). Ordered
   widest-first so the narrower blocks correctly override the wider one at
   the same specificity (source-order cascade). */

/* 1024–1279 — still side by side, sidebar narrows within the founder's
   220–240px range (used: 232px, mid-range). */
@media (max-width: 1279px) and (min-width: 1024px) {
    .account-nav {
        flex-basis: 232px;
        width: 232px;
    }
}

/* ≤1023 — the rail becomes a horizontal scrollable tab strip above the
   content (768–1023 per §67); the same strip continues below 768 too. */
@media (max-width: 1023px) {
    .account-shell {
        flex-direction: column;
        gap: var(--space-5);
    }

    .account-nav {
        position: static;
        width: 100%;
        flex: 1 1 auto;
        padding: var(--space-2);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .account-nav__list {
        flex-direction: row;
        gap: var(--space-1);
    }

    .account-nav__link {
        flex: 0 0 auto;
        width: auto;
        white-space: nowrap;
        border-inline-start: 0;
        border-block-end: 3px solid transparent;
    }

    .account-nav__link--active {
        border-block-end-color: var(--gold);
    }

    /* the divider above was a top border for the vertical list; in the
       horizontal strip it becomes a leading side border instead. */
    .account-nav__signout {
        margin-block-start: 0;
        padding-block-start: 0;
        padding-inline-start: var(--space-2);
        border-block-start: 0;
        border-inline-start: 1px solid rgba(255, 255, 255, .12);
    }

    .account-content {
        max-width: none;
    }
}

/* ── Profile card (/account) ─────────────────────────────────────────────
   Header + fields are REAL data (StoreUser.Email/Phone, StoreUserProfile.
   DisplayName). The save button stays disabled with a "قريبا" tag: no
   API endpoint exists yet to persist an edit, and a button that claims to
   save without saving is a phantom success (Q42/Q46) — same treatment the
   nav gives an unbuilt destination. ── */

/* §41 — form card 700-800px wide (used: 760px, mid-range). */
.account-profile { display: flex; flex-direction: column; gap: var(--space-6); margin-block-end: var(--space-6); max-width: 760px; }

.account-profile__header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.account-profile__avatar {
    flex: 0 0 auto;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: var(--radius-full);
    background: var(--brand-900);
    color: var(--brand-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
}

.account-profile__name { margin: 0 0 var(--space-1); font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--ink); }
.account-profile__meta { margin: 0; font-size: var(--text-sm); color: var(--ink-soft); }

.account-profile__actions {
    display: flex;
    flex-direction: column;
    /* stretch لا flex-start — كان يقصر حاوية الأزرار على عرض محتواها (قِيس 172px)،
       فلم يجد width:100% على الزر ما يملؤه. مرفق المؤسس يعرض «حفظ التغييرات»
       شريطا ذهبيا يملأ البطاقة. */
    align-items: stretch;
    gap: var(--space-2);
}

/* §41 — حفظ التغييرات + إلغاء جنبا إلى جنب. */
/* مطابقة مرفق المؤسس + §69/§70:
   ① الحقل 48px — قِيس 44 وهو ارتفاع .input الافتراضي في components.css، والمواصفة
      تنص على 48 لحقول سطح المكتب.
   ② «حفظ التغييرات» بعرض كامل — قِيس 172px، ومرفقك يعرضه شريطا ذهبيا يملأ البطاقة.
      «إلغاء» يبقى ثانويا بعرضه الطبيعي أسفله.
   ③ الصورة الرمزية 56 → 72px لتقرأ كهوية لا كأيقونة صغيرة. */
.account-profile .input,
.account-profile input[type="text"],
.account-profile input[type="email"],
.account-profile input[type="tel"] { min-height: 48px; }

.account-profile__avatar { width: 72px; height: 72px; font-size: var(--text-2xl); }

.account-profile__buttons {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
}
.account-profile__buttons > .btn:first-child { width: 100%; height: 52px; }

.account-profile__note { margin: 0; font-size: var(--text-sm); color: var(--ink-soft); }

/* ── Overview sections (/account) — "أحدث الطلبات" + "عناويني المحفوظة", §40.
   Both render the honest-empty branch unconditionally: IndexModel does not
   fetch orders or addresses (Index.cshtml.cs is outside this wave's file
   scope) — see the Razor comment at the call site. Reuses the shared
   .empty-state block (components.css) rather than inventing a new card
   shape (Q9). ── */
.account-section { margin-block-end: var(--space-6); }
.account-section__title { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--ink); margin: 0 0 var(--space-3); }

/* Gold primary — the founder's comp calls this ONE button out from the
   regular .btn--primary (brand navy): background var(--gold), ink text
   (white-on-gold measured 2.80:1, fails AA — see tokens.css §--gold-base
   and components.css .badge-discount for the same measured constraint). */
.btn--gold { background: var(--gold); color: var(--neutral-900); }
.btn--gold:hover:not(:disabled) { background: color-mix(in srgb, var(--gold) 85%, black); }

/* ── Order filter tabs (/account/orders) — CSS-only, no JavaScript file is
   in this wave's edit scope. Hidden radios + labelled tabs + :has() drive
   REAL client-side filtering of .order-card by its data-status attribute;
   nothing here fakes a click that does nothing (Q42/Q46). Tabs for a
   status with zero orders are never rendered by the Razor page, so this
   stylesheet only needs to cover the six fixed possible buckets (§45:
   قيد التأكيد/قيد التجهيز/تم الشحن/تم التسليم/ملغي/مرتجع). ── */

.order-filters {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--space-2);
    overflow-x: auto;
    padding-block-end: var(--space-1);
    margin-block-end: var(--space-5);
    -webkit-overflow-scrolling: touch;
}

.order-filters__input {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.order-filters__tab {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    white-space: nowrap;
    height: 34px;
    padding-inline: var(--space-4);
    border-radius: var(--radius-full);
    background: var(--paper-muted);
    border: 1px solid var(--line);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--ink-soft);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-standard),
                border-color var(--duration-fast) var(--ease-standard),
                color var(--duration-fast) var(--ease-standard);
}
.order-filters__tab:hover { background: var(--brand-tint); color: var(--ink); }
.order-filters__input:checked + .order-filters__tab {
    background: var(--brand-tint);
    border-color: var(--brand);
    color: var(--brand-deep);
}
.order-filters__input:focus-visible + .order-filters__tab {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.orders-section .order-card { display: block; }
.orders-section:has(#orderFilterPendingConfirm:checked) .order-card:not([data-status="pendingconfirm"]) { display: none; }
.orders-section:has(#orderFilterProcessing:checked) .order-card:not([data-status="processing"]) { display: none; }
.orders-section:has(#orderFilterShipped:checked) .order-card:not([data-status="shipped"]) { display: none; }
.orders-section:has(#orderFilterDelivered:checked) .order-card:not([data-status="delivered"]) { display: none; }
.orders-section:has(#orderFilterCancelled:checked) .order-card:not([data-status="cancelled"]) { display: none; }
.orders-section:has(#orderFilterReturned:checked) .order-card:not([data-status="returned"]) { display: none; }

/* Status pill in the order-card head — orders.css owns the card's own
   rules (not edited here, see file header); this only positions the badge
   this page adds inside the (also page-added) .order-card__meta wrapper. */
.order-card__meta { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); }
.order-card__status-badge { margin-block-start: var(--space-1); }

/* §45 — عرض التفاصيل/تتبع الطلب/إعادة الطلب: ثلاثة أزرار معطلة بلا مسار/بيانات
   بعد (see Razor comment at the call site) + شارة "قريبا" مشتركة واحدة بدل
   تكرارها ثلاث مرات لكل طلب. */
.order-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-block-start: var(--space-3);
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--line);
}
.order-card__actions-badge { margin-inline-start: var(--space-1); }

/* <768px (§67) — order rows become stacked, labelled fields; no horizontal
   scroll at 360px. Selectors are scoped under .account-content so their
   specificity beats orders.css's plain .order-card__* rules regardless of
   stylesheet load order (orders.css loads AFTER this file). */
@media (max-width: 767px) { /* founder §67 — distinct from --bp-xs:480 */
    .account-content .order-card__head {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }

    .account-content .order-card__number::before {
        content: "رقم الطلب";
        display: block;
        font-size: var(--text-xs);
        font-weight: var(--weight-regular);
        color: var(--neutral-500);
        margin-block-end: var(--space-1);
    }

    .account-content .order-card__date::before {
        content: "التاريخ";
        display: inline;
        font-size: var(--text-xs);
        color: var(--neutral-500);
        margin-inline-end: var(--space-1);
    }

    .account-content .order-card__total {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: var(--space-1) var(--space-2);
    }

    .account-content .order-card__total::before {
        content: "الإجمالي";
        flex-basis: 100%;
        order: -1;
        font-size: var(--text-xs);
        font-weight: var(--weight-regular);
        color: var(--neutral-500);
    }
}
