/* ─────────────────────────────────────────────────────────────────────
 * Auth pages — login, forgot-password, reset-password
 * Uses tokens, reset, base, forms, buttons, alerts, icons.
 * Two-column shell on desktop (visual + panel), stacks on mobile.
 * ───────────────────────────────────────────────────────────────────── */

html, body {
    height: 100%;
}

body.auth-page {
    margin: 0;
    min-height: 100vh;
    background: var(--surface-base);
    color: var(--text-primary);
    font-family: var(--font-sans, 'Inter', system-ui, -apple-system, sans-serif);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Shell layout ───────────────────────────────────────────────────── */
.auth-shell {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    min-height: 100vh;
}

@media (max-width: 880px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }
}

/* ── Visual side ────────────────────────────────────────────────────── */
.auth-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(150, 108, 63, 0.22) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 90%, rgba(150, 108, 63, 0.14) 0%, transparent 60%),
        var(--surface-sunken);
    overflow: hidden;
}

[data-theme="dark"] .auth-visual {
    background:
        radial-gradient(ellipse at 30% 20%, rgba(150, 108, 63, 0.30) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 90%, rgba(150, 108, 63, 0.18) 0%, transparent 60%),
        var(--surface-sunken);
}

.auth-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border-subtle) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
    background-size: 48px 48px;
    opacity: 0.18;
    pointer-events: none;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

.auth-visual-content {
    position: relative;
    max-width: 480px;
    text-align: center;
}

.auth-visual-logo {
    display: block;
    margin: 0 auto 24px;
    max-width: 180px;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
}

.auth-visual-tagline {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

@media (max-width: 880px) {
    .auth-visual {
        padding: 32px 24px;
        min-height: 240px;
    }
    .auth-visual-logo {
        max-width: 120px;
        margin-bottom: 12px;
    }
}

@media (max-width: 600px) {
    .auth-visual {
        min-height: 160px;
        padding: 24px;
    }
    .auth-visual-logo {
        max-width: 88px;
    }
    .auth-visual-tagline {
        display: none;
    }
}

/* ── Panel side ─────────────────────────────────────────────────────── */
.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    background: var(--surface-base);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-header {
    text-align: left;
}

.auth-title {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.auth-subtitle {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* ── Form ───────────────────────────────────────────────────────────── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-form .field-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ── Password input wrapper with toggle ─────────────────────────────── */
.auth-password {
    position: relative;
    display: flex;
}

.auth-password .form-input {
    flex: 1;
    padding-right: 40px;
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm, 4px);
    cursor: pointer;
    transition: color 100ms ease, background-color 100ms ease;
}

.auth-password-toggle:hover {
    color: var(--text-primary);
    background: var(--surface-sunken);
}

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

.auth-password-toggle .icon {
    width: 16px;
    height: 16px;
}

.auth-password-toggle .icon.hidden {
    display: none;
}

/* ── Submit + helper links ──────────────────────────────────────────── */
.auth-submit {
    width: 100%;
    height: 40px;
    margin-top: 4px;
    font-size: 14px;
}

.auth-helper {
    margin-top: 4px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-helper a {
    color: var(--text-link, var(--brand));
    text-decoration: none;
    font-weight: 500;
}

.auth-helper a:hover {
    text-decoration: underline;
}

/* ── Footer / env badge ─────────────────────────────────────────────── */
.auth-footer {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

.auth-env-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--status-warning-fg);
    background: var(--status-warning-bg);
    border: 1px solid var(--status-warning-border, var(--status-warning-fg));
    border-radius: var(--radius-sm, 4px);
}

.auth-env-badge .icon {
    width: 12px;
    height: 12px;
}

/* ── Theme toggle (top-right) ───────────────────────────────────────── */
.auth-theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--text-secondary);
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md, 6px);
    cursor: pointer;
    transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.auth-theme-toggle:hover {
    color: var(--text-primary);
    background: var(--surface-sunken);
    border-color: var(--border-default);
}

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

.auth-theme-toggle .icon {
    width: 18px;
    height: 18px;
}

.auth-theme-toggle .icon.hidden {
    display: none;
}
