/* ─────────────────────────────────────────────────────────────────────────
   auth.css — Authentication page styles
   Uses Tadash design system tokens. tokens.css must be imported via app.css.
   ───────────────────────────────────────────────────────────────────────── */


/* ─── Page layout ───────────────────────────────────────────────────────── */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    background-color: var(--bg-subtle);
    padding: var(--space-7);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-9) var(--space-8);
}


/* ─── Header ────────────────────────────────────────────────────────────── */

.auth-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

/*
 * text-align: center reliably centres the inline-flex .wordmark span inside the
 * <h1> block. Using display:flex on an <h1> has browser-specific sizing quirks
 * and percentage max-width on children inside inline-flex creates circular
 * dependencies. text-align on a block container with an inline-level child is
 * the simplest, spec-correct approach.
 */
.auth-wordmark {
    text-align: center;
    margin-bottom: var(--space-2);
}

/* Size by height so both SVG variants render at consistent visual size
   regardless of viewBox aspect ratio. No max-width % — see comment above. */
.auth-wordmark .brand-logo {
    height: clamp(28px, 5vw, 36px);
    width: auto;
}

.auth-tagline {
    font-size: var(--text-small-size);
    line-height: var(--text-small-line);
    color: var(--text-tertiary);
    max-width: none;
}


/* ─── Form ──────────────────────────────────────────────────────────────── */

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.auth-form h2 {
    font-size: var(--text-h3-size);
    font-weight: var(--weight-semibold);
    line-height: var(--text-h3-line);
    letter-spacing: var(--text-h3-track);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.auth-form .form-help {
    font-size: var(--text-small-size);
    line-height: var(--text-small-line);
    color: var(--text-tertiary);
    margin-bottom: var(--space-3);
    max-width: none;
}


/* ─── Validation summary ────────────────────────────────────────────────── */

.auth-validation-summary {
    padding: var(--space-4);
    background-color: var(--status-danger-subtle);
    border: 1px solid var(--status-danger-bg);
    border-radius: var(--radius-md);
    font-size: var(--text-caption-size);
    font-weight: var(--weight-medium);
    line-height: var(--text-caption-line);
    color: var(--status-danger-text);
}

.auth-validation-summary:empty,
.auth-validation-summary.validation-summary-valid {
    display: none;
}

.auth-validation-summary ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}


/* ─── Full-width button ─────────────────────────────────────────────────── */

.btn-block {
    width: 100%;
    margin-top: var(--space-3);
}


/* ─── Password field with show/hide toggle ──────────────────────────────── */

.password-field {
    position: relative;
}

/* Expand right padding so the input value never slides under the toggle */
.password-field .form-input {
    padding-right: 40px;
}

.password-toggle {
    position: absolute;
    right: var(--space-2);
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: color var(--duration-micro) var(--ease-out),
                background-color var(--duration-micro) var(--ease-out);
    flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
    .password-toggle:hover {
        color: var(--text-primary);
        background-color: var(--bg-muted);
    }
}

.password-toggle:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

/* Slash line: hidden by default (eye open = password hidden) */
.password-toggle .eye-slash {
    stroke-dasharray: 28.28;
    stroke-dashoffset: 28.28;
    transition: stroke-dashoffset var(--duration-standard) var(--ease-out);
}

/* Slash draws across when aria-pressed=true (password revealed) */
.password-toggle[aria-pressed="true"] .eye-slash {
    stroke-dashoffset: 0;
}

@media (prefers-reduced-motion: reduce) {
    .password-toggle,
    .password-toggle .eye-slash {
        transition: none;
    }
}


/* ─── MFA code input ────────────────────────────────────────────────────── */

.form-input-code {
    font-family: var(--font-mono);
    font-size: var(--text-h3-size);
    letter-spacing: 0.25em;
    text-align: center;
}


/* ─── Footer link ───────────────────────────────────────────────────────── */

.auth-footer {
    text-align: center;
    margin-top: var(--space-3);
}

.auth-footer a {
    font-size: var(--text-small-size);
    line-height: var(--text-small-line);
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color var(--duration-micro) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .auth-footer a:hover {
        color: var(--text-primary);
    }
}


/* ─── Confirmation / status messages ────────────────────────────────────── */

.auth-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-5);
}

.auth-message h2 {
    font-size: var(--text-h3-size);
    font-weight: var(--weight-semibold);
    line-height: var(--text-h3-line);
    letter-spacing: var(--text-h3-track);
    color: var(--text-primary);
}

.auth-message p {
    font-size: var(--text-small-size);
    line-height: var(--text-small-line);
    color: var(--text-secondary);
    max-width: none;
}


/* ─── MFA-specific components ────────────────────────────────────────────── */

.form-input-code {
    font-family: var(--font-mono);
    font-size: var(--text-h3-size);
    letter-spacing: 0.25em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.mfa-qr-container {
    display: flex;
    justify-content: center;
    padding: var(--space-4) 0;
}

.mfa-qr-container img {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: var(--space-2);
    background: var(--surface-primary);
}

.mfa-manual-entry {
    margin-bottom: var(--space-4);
}

.mfa-manual-entry summary {
    cursor: pointer;
    user-select: none;
    color: var(--text-tertiary);
}

.mfa-manual-key {
    margin-top: var(--space-3);
    padding: var(--space-3);
    background: var(--surface-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.mfa-key-code {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-small-size);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.1em;
    word-break: break-all;
    color: var(--text-primary);
    margin-top: var(--space-2);
}

.mfa-recovery-codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    padding: var(--space-4);
    background: var(--surface-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
}

.mfa-recovery-code {
    font-family: var(--font-mono);
    font-size: var(--text-small-size);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    padding: var(--space-1) var(--space-2);
}

.auth-notice {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    font-size: var(--text-small-size);
    line-height: var(--text-small-line);
    margin-bottom: var(--space-4);
}

.auth-notice--warning {
    background: var(--status-warning-subtle);
    border: 1px solid var(--status-warning-border);
    color: var(--text-primary);
}
