/* =============================================================================
   Auth screens: log in, sign up, forgot password.

   These pages render without the app shell (no top bar / tab bar), so they own
   their own centred layout.
   ========================================================================== */

.auth-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Fit the viewport exactly — an auth screen is a destination, not a
       document, so the PAGE never scrolls. On a viewport too short for the
       card (a landscape phone), the CARD scrolls inside itself instead, so
       there is never a second page-level scrollbar and the chrome stays put. */
    height: 100vh;
    height: var(--app-vvh, 100dvh);     /* keyboard shrinks the frame, no page scroll */
    max-height: var(--app-vvh, 100dvh);
    overflow: hidden;
    /* Clear notches/home-indicator; the spacing floor holds on flat screens. */
    padding:
        max(var(--app-space-6), env(safe-area-inset-top))
        max(var(--app-space-4), env(safe-area-inset-right))
        max(var(--app-space-6), env(safe-area-inset-bottom))
        max(var(--app-space-4), env(safe-area-inset-left));
    background-color: var(--app-bg-subtle);
}

.auth-card {
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: var(--app-space-8);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    background-color: var(--app-surface);
    box-shadow: var(--app-shadow-lg);
}

.auth-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--app-space-2);
    margin-bottom: var(--app-space-6);
    text-align: center;
}

.auth-logo {
    height: 38px;
    width: auto;
    margin-bottom: var(--app-space-2);
}

.auth-title {
    margin: 0;
    font-size: var(--app-text-xl);
    font-weight: var(--app-weight-bold);
    letter-spacing: -0.02em;
}

.auth-subtitle {
    margin: 0;
    font-size: var(--app-text-sm);
    color: var(--app-text-muted);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--app-space-4);
}

/* Step indicator for the sign-up wizard */
.auth-steps {
    display: flex;
    justify-content: center;
    gap: var(--app-space-2);
    margin: 0 0 var(--app-space-6);
    padding: 0;
    list-style: none;
}

.auth-step-dot {
    width: 28px;
    height: 4px;
    border-radius: var(--app-radius-pill);
    background-color: var(--app-border);
    transition: background-color var(--app-duration) var(--app-ease);
}

.auth-step-dot.is-active {
    background-color: var(--app-accent);
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: var(--app-space-3);
    margin-top: var(--app-space-2);
}

.auth-footer {
    margin-top: var(--app-space-5);
    padding-top: var(--app-space-5);
    border-top: 1px solid var(--app-border);
    text-align: center;
    font-size: var(--app-text-sm);
    color: var(--app-text-muted);
}

.auth-footer a {
    font-weight: var(--app-weight-semibold);
}

/* Password field with a reveal toggle */
.auth-password {
    position: relative;
}

.auth-password .form-control {
    padding-right: var(--app-space-10);
}

.auth-toggle-password {
    position: absolute;
    top: 50%;
    right: var(--app-space-2);
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: var(--app-radius-pill);
    background: transparent;
    color: var(--app-text-muted);
    cursor: pointer;
    transition: color var(--app-duration) var(--app-ease),
                background-color var(--app-duration) var(--app-ease);
}

.auth-toggle-password:hover {
    background-color: var(--app-surface-hover);
    color: var(--app-text);
}

/* Server-side validation output from showError() */
.auth-error,
.error {
    display: block;
    margin-top: var(--app-space-2);
    font-size: var(--app-text-xs);
    color: var(--app-danger);
}

.auth-alert {
    padding: var(--app-space-3) var(--app-space-4);
    border-radius: var(--app-radius-sm);
    background-color: var(--app-danger-soft);
    color: var(--app-danger);
    font-size: var(--app-text-sm);
}

@media (max-width: 480px) {
    .auth-shell {
        padding: 0;
        background-color: var(--app-surface);
    }

    .auth-card {
        max-width: none;
        padding: var(--app-space-6) var(--app-space-5);
        border: 0;
        box-shadow: none;
        background-color: transparent;
    }
}

/* ============================================================================
   Onboarding language picker (signup step 3) — native-name pills.
   A responsive grid of selectable chips; the checked one carries the brand.
   Radio inputs are visually hidden but remain the accessible control.
   ========================================================================== */
.su-langgrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--app-space-2, 0.5rem);
}
@media (max-width: 22em) {
    .su-langgrid { grid-template-columns: repeat(2, 1fr); }
}
.su-lang {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.5rem 0.5rem;
    border: 1px solid var(--at-line, rgba(0,0,0,.14));
    border-radius: var(--at-r-md, 12px);
    background: var(--at-surface-raised, #fff);
    cursor: pointer;
    text-align: center;
    transition: border-color .15s ease, background-color .15s ease, transform .06s ease;
    -webkit-user-select: none;
    user-select: none;
}
.su-lang:active { transform: scale(.98); }
.su-lang input {
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
    pointer-events: none;
}
.su-lang__name {
    font-size: var(--at-text-sm, 0.9rem);
    font-weight: 600;
    color: var(--at-ink, #14110C);
    line-height: 1.15;
}
.su-lang:has(input:checked) {
    border-color: var(--at-accent, #F07629);
    background: color-mix(in srgb, var(--at-accent, #F07629) 12%, var(--at-surface-raised, #fff));
    box-shadow: inset 0 0 0 1px var(--at-accent, #F07629);
}
.su-lang:has(input:focus-visible) {
    outline: 2px solid var(--at-accent, #F07629);
    outline-offset: 2px;
}
