/* Standalone auth screens (login / email-link landings). Token-based so they match
   every theme. Shared by SharedUI/Pages/{Login,MagicVerify,ConfirmEmail,ResetPassword}.razor —
   served from any host as _content/LearnWordsAI.SharedUI/css/auth.css. */

.auth-page {
    max-width: var(--w-narrow);
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 32px 20px 48px;
}

/* Interface-language chip above the brand mark. Right-aligned so it reads as chrome
   rather than as part of the sign-in form; it renders only where the host registered
   an IInterfaceLanguageSwitcher (main web app), so this row can collapse to nothing. */
.auth-lang {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.auth-lang:empty {
    display: none;
}

.auth-brand {
    text-align: center;
    font-size: var(--type-display-size);
    font-weight: 800;
    letter-spacing: -0.02em;
    /* Gap to the card; this 6px previously sat above the tagline, now removed (#502). */
    margin-bottom: 26px;
    color: var(--text);
}
.auth-brand .auth-brand-accent { color: var(--accent); }

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 24px 22px;
    box-shadow: var(--shadow);
}

/* The card heading is the one piece of type on this screen that carries the brand, so it takes the
   editorial serif like every other title in the product — a bold sans heading here was the reason
   the sign-in screen read as a different app than the one behind it. */
.auth-title {
    font-family: var(--font-display);
    font-size: var(--type-title-l-size);
    line-height: var(--type-title-l-line);
    font-weight: var(--type-title-l-weight);
    letter-spacing: var(--type-title-l-track);
    margin: 0 0 18px;
    color: var(--text);
}
/* Guest door only: the subtitle explains the title, so it sits close to it. Every other mode goes
   straight to a field and keeps the roomier 18px. */
.auth-title:has(+ .auth-guest-sub) { margin-bottom: 8px; }

/* --- guest door (Mode.Guest): no fields, so the card is title → subtitle → button → consent --- */

/* NOT .auth-tagline — that one is hidden above 960px in the branded layout (#1496). */
.auth-guest-sub {
    margin: 0 0 22px;
    font-size: var(--type-body-size);
    line-height: var(--type-body-line);
    color: var(--text-secondary);
    text-wrap: pretty;
}

/* Click-through consent. Quieter than .auth-social-consent: on this door the consent line sits
   directly under the only button, where accent-bold links competed with it for the click. */
.auth-guest-consent {
    margin: 14px 0 0;
    font-size: var(--type-body-s-size);
    line-height: 1.45;
    color: var(--hint);
    text-align: center;
    text-wrap: pretty;
}
.auth-guest-consent a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0.85;
}
.auth-guest-consent a:hover { opacity: 1; }

.auth-guest-split { margin: 22px 0 16px; border: none; border-top: 1px solid var(--card-border); }
.auth-guest-alt { margin: 0; text-align: center; font-size: var(--type-body-size); color: var(--text-secondary); }
/* Both classes in the selector so this wins regardless of source order — .auth-link sets its own
   (smaller) size further down the file and would otherwise override the inherit. */
.auth-link.auth-link-strong { font-size: inherit; font-weight: 600; }

.auth-field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.auth-field label { font-size: var(--type-body-s-size); color: var(--text-secondary); font-weight: 600; }
/* Every control on this card inherits the UI face: an unstyled input or button falls back to the
   UA font (Arial), which next to the serif card heading read as a third typeface on one screen. */
.auth-field input {
    padding: 12px 14px;
    font-family: inherit;
    font-size: var(--type-body-l-size);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    transition: border-color var(--transition);
}
.auth-field input:focus { outline: none; border-color: var(--accent); }
/* The password rule under the field (register only). Not an error state — it is on screen before
   anything goes wrong, which is the whole point of it existing. */
.auth-rule { margin: 0; font-size: var(--type-body-s-size); line-height: 1.35; color: var(--hint); }

.auth-primary {
    width: 100%;
    margin-top: 8px;
    padding: 13px 16px;
    font-family: inherit;
    font-size: var(--type-title-s-size);
    font-weight: 700;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 1), rgba(var(--accent-rgb), 0.86));
    color: var(--button-text);
    cursor: pointer;
    box-shadow: 0 10px 22px -10px rgba(var(--accent-rgb), 0.8);
    transition: transform .15s, box-shadow .2s, opacity .2s;
}
.auth-primary:hover:not(:disabled) { transform: translateY(-1px); }
.auth-primary:disabled { opacity: 0.5; cursor: default; box-shadow: none; }

/* Register-only consent line: a checkbox + "I'm 16+ and accept the Terms / Privacy" with two
   inline <a> links (auth_consent_label). Previously auth.css had NO rules for it, so the row
   inherited browser defaults — the links rendered as bright-blue underlined text that clashed
   with the brand and read as "styles aren't connected" (#229). Token-based so it matches every
   theme like the rest of the auth screen. */
.auth-consent {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 2px 0 4px;
    font-size: var(--type-body-s-size);
    line-height: 1.45;
    color: var(--text-secondary);
    cursor: pointer;
}
.auth-consent input[type="checkbox"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 1px;
    accent-color: var(--accent);
    cursor: pointer;
}
.auth-consent a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.auth-consent a:hover { text-decoration-thickness: 2px; }

.auth-secondary { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.auth-link { background: none; border: none; padding: 0; font-family: inherit; font-size: var(--type-body-s-size); color: var(--accent); cursor: pointer; }
.auth-link:hover:not(:disabled) { text-decoration: underline; }
.auth-link:disabled { opacity: 0.5; cursor: default; }

.auth-divider { margin: 22px 0 16px; text-align: center; border-top: 1px solid var(--card-border); }
.auth-divider span { position: relative; top: -10px; padding: 0 12px; font-size: var(--type-body-s-size); color: var(--hint); background: var(--bg-secondary); }

.auth-social { display: flex; flex-direction: column; gap: 10px; }
.auth-social-btn {
    width: 100%; padding: 12px 16px; font-family: inherit; font-size: var(--type-body-size); font-weight: 600;
    border: 1px solid var(--card-border); border-radius: var(--radius-sm);
    background: var(--bg); color: var(--text); cursor: pointer;
    transition: background var(--transition);
}
.auth-social-btn:hover { background: var(--card-hover); }
/* Google renders its own (iframe) button here; GIS controls its look per brand guidelines, so we
   only center it within the social column rather than restyling it. */
.auth-social-google { display: flex; justify-content: center; }

/* Click-through consent notice under the social buttons (auth_social_consent). Social sign-in
   provisions an account on first use, so the deliberate provider-button click — with this notice
   shown — stands in for the register-only checkbox. Quieter than .auth-consent: no checkbox,
   centered, smaller. Same accent links so it matches every theme. */
.auth-social-consent {
    margin: 2px 0 0;
    font-size: var(--type-body-s-size);
    line-height: 1.45;
    color: var(--text-secondary);
    text-align: center;
}
.auth-social-consent a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.auth-social-consent a:hover { text-decoration-thickness: 2px; }

.auth-info, .auth-error, .auth-ok {
    margin-bottom: 14px; padding: 11px 13px; border-radius: var(--radius-sm);
    font-size: var(--type-body-size); line-height: 1.45;
}
.auth-info { background: rgba(var(--accent-rgb), 0.12); color: var(--text); }
.auth-ok   { background: rgba(var(--success-rgb), 0.14); color: var(--text); }
.auth-error { background: rgba(var(--destructive-rgb), 0.14); color: var(--text); }

/* Email-link landing pages (verify / confirm). */
.auth-cb { max-width: var(--w-narrow); margin: 0 auto; padding: 64px 20px; text-align: center; }
.auth-cb-text { font-size: var(--type-body-size); color: var(--text-secondary); }
.auth-cb-spinner {
    width: 34px; height: 34px; margin: 0 auto 16px;
    border: 3px solid var(--card-border); border-top-color: var(--accent);
    border-radius: 50%; animation: auth-spin 0.8s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* Legal docs (Privacy Policy / Terms of Service). Renders the rendered-Markdown
   body inside an auth-card-wide layout, with prose typography tuned for long
   reading rather than form input. */
.legal-page { max-width: var(--w-readable); padding-top: 24px; padding-bottom: 48px; min-height: auto; }
.legal-card { padding: 32px 28px; }
.legal-body { color: var(--text); font-size: var(--type-body-size); line-height: 1.6; }
.legal-body h1 { font-size: var(--type-display-size); line-height: var(--type-display-line); margin: 0 0 16px; }
.legal-body h2 { font-size: var(--type-title-l-size); margin: 28px 0 12px; }
.legal-body h3 { font-size: var(--type-body-l-size); margin: 22px 0 10px; }
.legal-body p, .legal-body ul, .legal-body ol, .legal-body blockquote { margin: 0 0 14px; }
.legal-body ul, .legal-body ol { padding-left: 22px; }
.legal-body li { margin: 4px 0; }
.legal-body a { color: var(--accent); text-decoration: underline; }
.legal-body code { background: rgba(var(--on-surface-rgb), 0.08); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.legal-body blockquote {
    border-left: 3px solid rgba(var(--accent-rgb), 0.4);
    padding: 6px 14px;
    color: rgba(var(--on-surface-rgb), 0.78);
    background: rgba(var(--on-surface-rgb), 0.04);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.legal-body table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: var(--type-body-size); }
.legal-body th, .legal-body td { border: 1px solid rgba(var(--on-surface-rgb), 0.18); padding: 8px 10px; text-align: left; vertical-align: top; }
.legal-body th { background: rgba(var(--on-surface-rgb), 0.06); font-weight: 600; }
.legal-body hr { border: 0; border-top: 1px solid rgba(var(--on-surface-rgb), 0.15); margin: 28px 0; }
.legal-body em { color: rgba(var(--on-surface-rgb), 0.72); }

/* ============================================================================
   Branded split sign-in (main web app only — gated by the LoginBrandPanel DI
   marker in Login.razor). Left column is a FIXED night-sky orbit panel with the
   product pitch; right column is the existing .auth-card + a footer. The panel
   palette is deliberately theme-independent (always the dark night sky), so it
   carries its own literal colours instead of the app theme tokens. At ≤ 960px
   the panel is dropped and a tagline stands in. Ported from the design handoff;
   all motion is transform/opacity only — no per-frame JS. The plain centered
   .auth-page above stays the login for hosts that don't register the marker
   (Reader, MAUI). */

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    min-height: 100vh;
}

/* ---- Left: brand panel (fixed night sky, independent of app theme) ---- */
.brand-panel {
    --p-glow: rgba(232, 138, 95, 0.16);
    --p-sunglow: rgba(232, 138, 95, 0.34);
    --p-line: rgba(244, 241, 236, 0.07);
    --p-star: #dfe8f6;
    --p-ring: rgba(223, 232, 246, 0.09);
    --p-chip-bg: rgba(223, 232, 246, 0.07);
    --p-chip-bd: rgba(223, 232, 246, 0.14);
    --p-chip-ink: #cfe0f5;
    --p-chip-glow: rgba(106, 167, 255, 0.12);
    --p-head: #f2f5fb;
    --p-dim: #9aa7bd;
    --p-body: #c2cdde;
    --p-dot: rgba(232, 138, 95, 0.85);
    --p-link: #e9a075;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 48px;
    background:
        radial-gradient(120% 90% at 20% 110%, var(--p-glow), transparent 55%),
        linear-gradient(160deg, #0b0e15 0%, #05070d 70%);
    border-right: 1px solid var(--p-line);
}

.bp-inner {
    position: relative;
    z-index: 2;
    width: min(470px, 100%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.bp-sky { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.bp-star {
    position: absolute;
    border-radius: 50%;
    background: var(--p-star);
    /* Base opacity so a reduce-motion (animation-off) star still reads as a dim point. */
    opacity: var(--o2, 0.6);
    animation: bpTwinkle var(--tw, 3s) ease-in-out infinite;
}
@keyframes bpTwinkle { 0%, 100% { opacity: var(--o1, 0.2); } 50% { opacity: var(--o2, 0.75); } }

.bp-stage { position: relative; width: 320px; height: 320px; align-self: center; margin-bottom: 8px; }
.bp-rings { position: absolute; inset: 0; animation: bpSpin 150s linear infinite; }
.bp-ring { position: absolute; border-radius: 50%; border: 1px solid var(--p-ring); }
.bp-ring.dashed { border-style: dashed; }
.bp-chip {
    position: absolute;
    /* translate(-50%,-50%) is the BASE (not only inside the spin keyframe) so chips stay
       centred on their orbit point when reduce-motion turns the animation off. */
    transform: translate(-50%, -50%);
    padding: 4px 11px;
    border-radius: 999px;
    background: var(--p-chip-bg);
    border: 1px solid var(--p-chip-bd);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--p-chip-ink);
    white-space: nowrap;
    box-shadow: 0 0 14px var(--p-chip-glow);
    animation: bpSpinRev 150s linear infinite;
}
.bp-chip u { text-decoration: none; border-bottom: 2px solid var(--st, transparent); padding-bottom: 1px; }
@keyframes bpSpin { to { transform: rotate(360deg); } }
@keyframes bpSpinRev { from { transform: translate(-50%, -50%) rotate(0); } to { transform: translate(-50%, -50%) rotate(-360deg); } }

.bp-sun { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; z-index: 1; }
.bp-sun::before {
    content: "";
    position: absolute;
    inset: -34px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--p-sunglow), transparent 65%);
    animation: bpPulse 3.2s ease-in-out infinite;
}
.bp-sun svg { position: relative; width: 64px; height: 64px; filter: drop-shadow(0 0 12px rgba(232, 138, 95, 0.35)); }
@keyframes bpPulse { 0%, 100% { transform: scale(0.92); opacity: 0.75; } 50% { transform: scale(1.06); opacity: 1; } }

.bp-head { margin: 18px 0 0; font-size: 30px; line-height: 38px; font-weight: 700; letter-spacing: -0.02em; color: var(--p-head); }
.bp-sub { margin: 8px 0 0; font-size: 15.5px; line-height: 24px; color: var(--p-dim); }
.bp-points { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.bp-points li { position: relative; padding-left: 22px; font-size: 14px; line-height: 21px; color: var(--p-body); }
.bp-points li::before { content: ""; position: absolute; left: 1px; top: 6px; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--p-dot); }
.bp-more { margin-top: 30px; font-size: 13.5px; color: var(--p-dim); }
.bp-more a { color: var(--p-link); font-weight: 600; }
.bp-more a:hover { text-decoration: underline; }

/* Reduce motion: freeze the whole decorative scene. */
@media (prefers-reduced-motion: reduce) {
    .bp-rings, .bp-chip, .bp-sun::before, .bp-star { animation: none; }
}

/* ---- Right: form column (follows the app theme; card = the shared .auth-card) ---- */
.form-side { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px 24px 26px; }
.form-wrap { width: min(400px, 100%); }

/* Tagline — only rendered in the branded layout; hidden while the panel shows, shown on collapse. */
.auth-tagline {
    display: none;
    text-align: center;
    font-size: var(--type-body-size);
    line-height: var(--type-body-line);
    color: var(--text-secondary);
    margin: 0 0 24px;
}

.auth-footer {
    margin-top: 22px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: var(--type-body-s-size);
}
.auth-footer a { color: var(--hint); }
.auth-footer a.strong { color: var(--text-secondary); font-weight: 600; }
.auth-footer a:hover { color: var(--accent); text-decoration: none; }

/* ≤ 960px: drop the panel, stand up the tagline, form fills the screen. */
@media (max-width: 960px) {
    .login-shell { grid-template-columns: 1fr; }
    .brand-panel { display: none; }
    .login-shell .auth-tagline { display: block; }
    .login-shell .auth-brand { margin-bottom: 8px; }
    .form-side { min-height: 100vh; }
}
