/*
  NomiDar authentication pages — split "story + form" card.
  RTL/LTR safe (logical properties), light/dark aware (.mud-dark), responsive.
*/

/* ═══════════════════════════════════════════════════════════════════════════
   Teal accent for the auth cards

   The app-wide MudBlazor theme is blue, which read as a mismatch against the
   teal story panel on these two pages. Rather than restyle each button, the
   primary palette variables are re-pointed to the same teals the panel uses —
   scoped to the two cards only, so the rest of the app is untouched and this
   holds whichever theme option the tenant has selected.

   Retinting the variables (rather than .mud-button-*-primary rules) also keeps
   MudBlazor's own hover, ripple and focus states correct, and carries the
   accent to the checkbox, links and text-field focus rings that sit alongside
   the buttons — those looking blue next to a teal button would read as a bug.

   لون الاعتماد الأساسي في بطاقتي الدخول والتسجيل — يُعاد توجيهه إلى الأخضر
   المزرقّ ليتناغم مع اللوحة، دون المساس ببقية التطبيق
   ═══════════════════════════════════════════════════════════════════════════ */

.mw-auth-page,
.mw-onboard-page {
    /* #0b6e6b on white text = 5.7:1 — passes WCAG AA */
    --mud-palette-primary: #0b6e6b;
    --mud-palette-primary-text: #ffffff;
    --mud-palette-primary-darken: #085250;
    --mud-palette-primary-lighten: #0f8a86;
    --mud-palette-primary-rgb: 11, 110, 107;
    --mud-palette-primary-hover: rgba(11, 110, 107, .09);
}

.mud-dark .mw-auth-page,
.mud-dark .mw-onboard-page {
    /* Dark surfaces need the bright teal carrying dark text instead — the same
       inversion the app theme already applies to its own primary. 6.4:1. */
    --mud-palette-primary: #14b8a6;
    --mud-palette-primary-text: #04231f;
    --mud-palette-primary-darken: #0f8a86;
    --mud-palette-primary-lighten: #2ad4c0;
    --mud-palette-primary-rgb: 20, 184, 166;
    --mud-palette-primary-hover: rgba(20, 184, 166, .12);
}

/* Blazor moves focus to the story heading after navigation (it carries
   tabindex="-1"), so the browser painted its default focus ring around the
   headline on every load. The heading is out of the tab order and can only ever
   receive focus programmatically — the ring communicates nothing to a keyboard
   user and cannot be reached by Tab — so it is suppressed outright. Focus
   itself is left in place because screen readers rely on it.

   إخفاء إطار التركيز حول العنوان: العنوان خارج ترتيب التنقل ولا يصله المستخدم
   بلوحة المفاتيح، ويبقى التركيز نفسه من أجل قارئات الشاشة */
.mw-auth-title:focus,
.mw-auth-title:focus-visible,
.mw-onboard-story h1:focus,
.mw-onboard-story h1:focus-visible {
    outline: none;
}

/* The passkey alternative on sign-in is deliberately Color.Secondary so it
   stays visually subordinate to the primary submit; it is neutralised here
   rather than left on the app's blue. */
.mw-auth-page .mud-button-outlined-secondary {
    color: var(--mud-palette-text-primary);
    border-color: var(--mud-palette-lines-inputs);
}

.mw-auth-page .mud-button-outlined-secondary:hover {
    border-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary);
    background-color: var(--mud-palette-primary-hover);
}

.mw-auth-page {
    --mw-auth-teal-1: #0b6e6b;
    --mw-auth-teal-2: #0f8a86;
    --mw-auth-teal-3: #14b8a6;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    min-height: 560px;
    border-radius: 24px;
    overflow: hidden;
    background: var(--mud-palette-surface);
    box-shadow: 0 24px 60px rgba(8, 47, 46, 0.18), 0 2px 8px rgba(8, 47, 46, 0.08);
}

.mud-dark .mw-auth-page {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

/* ── Story panel ─────────────────────────────────────────── */
.mw-auth-story {
    flex: 1 1 46%;
    position: relative;
    display: flex;
    align-items: center;
    padding: 48px 44px;
    color: #fff;
    background: linear-gradient(150deg, var(--mw-auth-teal-1) 0%, var(--mw-auth-teal-2) 55%, var(--mw-auth-teal-3) 100%);
    overflow: hidden;
}

.mw-auth-story::after {
    content: "";
    position: absolute;
    inset-block-start: -80px;
    inset-inline-end: -80px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.10);
}

.mw-auth-story::before {
    content: "";
    position: absolute;
    inset-block-end: -110px;
    inset-inline-start: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
}

.mw-auth-story-inner {
    position: relative;
    z-index: 1;
    width: 100%;
}

.mw-auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-family: "Zain", "Tajawal", sans-serif;
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 22px;
}

.mw-auth-kicker {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 700;
    opacity: 0.85;
    margin-bottom: 12px;
}

.mw-auth-title {
    font-size: 1.85rem;
    line-height: 1.25;
    font-weight: 700;
    margin: 0 0 14px;
}

.mw-auth-desc {
    font-size: 0.98rem;
    line-height: 1.65;
    opacity: 0.92;
    margin: 0 0 26px;
}

.mw-auth-points {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mw-auth-points li {
    position: relative;
    padding-inline-start: 32px;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.96;
}

.mw-auth-points li::before {
    content: "✓";
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: -1px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.20);
    font-size: 0.78rem;
    font-weight: 700;
}

/* ── Form panel ──────────────────────────────────────────── */
.mw-auth-form-wrap {
    flex: 1 1 54%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 44px 40px;
}

.mw-auth-card {
    width: 100%;
    max-width: 420px;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.mw-provider-row {
    gap: 10px;
}

.mw-provider-btn {
    flex: 1 1 auto;
    min-width: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-transform: none;
}

.mw-provider-btn small {
    font-size: 0.65rem;
    opacity: 0.7;
    margin-top: 2px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 860px) {
    .mw-auth-page {
        flex-direction: column;
        min-height: 0;
        border-radius: 20px;
    }

    .mw-auth-story {
        padding: 34px 30px;
    }

    .mw-auth-title {
        font-size: 1.5rem;
    }

    .mw-auth-form-wrap {
        padding: 32px 26px;
    }
}

@media (max-width: 520px) {
    .mw-auth-points {
        display: none;
    }

    .mw-auth-story {
        padding: 28px 26px;
    }

    .mw-auth-desc {
        margin-bottom: 4px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Company registration wizard (/register-company)

   Same split "story + form" shell as the sign-in page above, but the story
   panel carries a vertical stepper instead of a bullet list, and the form
   panel carries a progress bar. Logical properties throughout so the split
   mirrors correctly in Arabic.

   معالج تسجيل الشركة — يشترك مع صفحة الدخول في القالب نفسه
   ═══════════════════════════════════════════════════════════════════════════ */

.mw-onboard-page {
    --mw-auth-teal-1: #0b6e6b;
    --mw-auth-teal-2: #0f8a86;
    --mw-auth-teal-3: #14b8a6;
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    align-items: stretch;
    min-height: 620px;
    border-radius: 24px;
    overflow: hidden;
    background: var(--mud-palette-surface);
    box-shadow: 0 24px 60px rgba(8, 47, 46, 0.18), 0 2px 8px rgba(8, 47, 46, 0.08);
}

.mud-dark .mw-onboard-page {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

/* ── Story panel ─────────────────────────────────────────── */
.mw-onboard-story {
    flex: 0 0 40%;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 48px 44px;
    color: #fff;
    background: linear-gradient(150deg, var(--mw-auth-teal-1) 0%, var(--mw-auth-teal-2) 55%, var(--mw-auth-teal-3) 100%);
    overflow: hidden;
}

.mw-onboard-story::after {
    content: "";
    position: absolute;
    inset-block-start: -90px;
    inset-inline-end: -90px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.10);
}

.mw-onboard-story::before {
    content: "";
    position: absolute;
    inset-block-end: -120px;
    inset-inline-start: -70px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
}

.mw-onboard-story > * {
    position: relative;
    z-index: 1;
}

.mw-onboard-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-family: "Zain", "Tajawal", sans-serif;
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 22px;
}

.mw-onboard-kicker {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 700;
    opacity: 0.85;
    margin-bottom: 12px;
}

html[lang="ar"] .mw-onboard-kicker {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.86rem;
}

.mw-onboard-story h1 {
    font-size: 1.8rem;
    line-height: 1.28;
    font-weight: 700;
    margin: 0 0 14px;
}

.mw-onboard-story p {
    font-size: 0.96rem;
    line-height: 1.65;
    opacity: 0.9;
    margin: 0 0 26px;
}

/* Plan confirmation sits on the teal panel, so the default outlined-success
   palette is replaced with a translucent white treatment. */
.mw-onboard-story .mud-alert {
    background: rgba(255, 255, 255, 0.14) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: #fff !important;
    border-radius: 14px;
}

.mw-onboard-story .mud-alert .mud-alert-icon,
.mw-onboard-story .mud-alert .mud-typography {
    color: #fff !important;
}

/* ── Vertical stepper ────────────────────────────────────── */
.mw-onboard-steps {
    margin-block-start: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mw-onboard-steps > div {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    font-size: 0.94rem;
    font-weight: 500;
    opacity: 0.62;
    transition: opacity 0.2s ease;
}

/* Connector line between the number badges */
.mw-onboard-steps > div:not(:last-child)::before {
    content: "";
    position: absolute;
    inset-inline-start: 15px;
    inset-block-start: 42px;
    width: 2px;
    height: calc(100% - 32px);
    background: rgba(255, 255, 255, 0.22);
}

.mw-onboard-steps b {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    font-weight: 700;
}

.mw-onboard-steps > div.active {
    opacity: 1;
    font-weight: 700;
}

.mw-onboard-steps > div.active b {
    background: #fff;
    color: var(--mw-auth-teal-1);
    border-color: #fff;
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.18);
}

.mw-onboard-steps > div.done {
    opacity: 0.92;
}

.mw-onboard-steps > div.done b {
    background: rgba(255, 255, 255, 0.9);
    color: var(--mw-auth-teal-1);
    border-color: rgba(255, 255, 255, 0.9);
    font-size: 0;
}

.mw-onboard-steps > div.done b::after {
    content: "✓";
    font-size: 0.9rem;
    font-weight: 700;
}

/* ── Form panel ──────────────────────────────────────────── */
.mw-onboard-card {
    flex: 1 1 60%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 44px 46px;
    min-width: 0;
}

.mw-onboard-card > form {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
}

.mw-step-progress {
    height: 4px;
    border-radius: 99px;
    background: var(--mud-palette-divider);
    overflow: hidden;
    margin-bottom: 26px;
}

.mw-step-progress i {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--mw-auth-teal-1), var(--mw-auth-teal-3));
    transition: width 0.3s ease;
}

.mw-form-head {
    margin-bottom: 24px;
}

.mw-form-head span {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--mw-auth-teal-2);
    margin-bottom: 8px;
}

html[lang="ar"] .mw-form-head span {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.85rem;
}

.mud-dark .mw-form-head span {
    color: var(--mw-auth-teal-3);
}

.mw-form-head h2 {
    font-size: 1.42rem;
    line-height: 1.3;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--mud-palette-text-primary);
}

.mw-form-head p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
    color: var(--mud-palette-text-secondary);
}

.mw-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-block-start: 30px;
    padding-block-start: 22px;
    border-block-start: 1px solid var(--mud-palette-divider);
}

/* When only the primary action is present, keep it on the trailing edge. */
.mw-form-actions > :only-child {
    margin-inline-start: auto;
}

/* ── Success state ───────────────────────────────────────── */
.mw-success-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 0;
}

.mw-success-state > div:first-child {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    margin-bottom: 22px;
    font-size: 2.1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(150deg, var(--mw-auth-teal-1), var(--mw-auth-teal-3));
    box-shadow: 0 0 0 8px rgba(20, 184, 166, 0.14);
}

.mw-success-state h2 {
    font-size: 1.34rem;
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--mud-palette-text-primary);
}

.mw-success-state p {
    font-size: 0.94rem;
    line-height: 1.65;
    margin: 0 0 26px;
    max-width: 380px;
    color: var(--mud-palette-text-secondary);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 960px) {
    .mw-onboard-page {
        flex-direction: column;
        min-height: 0;
        border-radius: 20px;
    }

    .mw-onboard-story {
        flex: none;
        padding: 34px 30px;
    }

    .mw-onboard-story h1 {
        font-size: 1.5rem;
    }

    .mw-onboard-story p {
        margin-bottom: 20px;
    }

    /* Horizontal stepper once the panel is stacked on top */
    .mw-onboard-steps {
        flex-direction: row;
        gap: 10px;
        margin-block-start: 4px;
    }

    .mw-onboard-steps > div {
        flex: 1 1 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 0;
        font-size: 0.82rem;
    }

    .mw-onboard-steps > div:not(:last-child)::before {
        inset-inline-start: 40px;
        inset-block-start: 15px;
        width: calc(100% - 46px);
        height: 2px;
    }

    .mw-onboard-card {
        padding: 34px 28px;
    }
}

@media (max-width: 560px) {
    .mw-onboard-story {
        padding: 28px 24px;
    }

    .mw-onboard-card {
        padding: 28px 22px;
    }

    .mw-onboard-steps > div span {
        display: none;
    }

    .mw-onboard-steps {
        flex-direction: row;
        align-items: center;
    }

    .mw-form-actions {
        flex-wrap: wrap;
    }
}
