/* AuditDraw auth theme. Plain CSS, no frameworks. Brand palette via custom properties. */
:root {
    --primary: #1F3B69;
    --primary-alt: #88A7D0;
    --primary-deep: #16294a;
    --title: #1C355F;
    --accent: #E6D094;
    --text: #30353E;
    --muted: #6b7280;
    --border: #e7ebf1;
    --danger: #b3372c;
    --danger-bg: #fdf0ee;
    --success: #2e6b3f;
    --success-bg: #eef7f0;
    --info-bg: #eff3f9;
    --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body.auth-body {
    font-family: 'Public Sans', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    color: var(--text);
    background: radial-gradient(120% 90% at 50% 0%, #2a4d85 0%, var(--primary) 45%, var(--primary-deep) 100%);
    -webkit-font-smoothing: antialiased;
}

.auth-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    gap: 1.75rem;
}

.auth-brand { text-align: center; }
.auth-wordmark { width: min(300px, 78vw); height: auto; display: block; }

/* The card */
.auth-card {
    background: #fff;
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius);
    box-shadow: 0 18px 45px rgba(10, 20, 40, 0.35);
    padding: 2rem 1.75rem;
    position: relative;
    overflow: hidden;
}

/* Panels */
.auth-panel { animation: auth-panel-in 220ms ease-out; }
@keyframes auth-panel-in {
    from { opacity: 0; transform: translateX(14px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .auth-panel { animation: none; }
}

.auth-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--title);
    margin-bottom: 0.35rem;
}
.auth-sub { font-size: 0.92rem; color: var(--muted); margin-bottom: 1.15rem; line-height: 1.45; }
.auth-sub strong { color: var(--text); font-weight: 600; word-break: break-all; }

/* Alert / live region */
.auth-alert {
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    background: var(--info-bg);
    color: var(--text);
}
.auth-alert.is-error { background: var(--danger-bg); border-color: #efccc8; color: var(--danger); }
.auth-alert.is-success { background: var(--success-bg); border-color: #cfe6d5; color: var(--success); }

/* Form fields */
.auth-field { margin-bottom: 1rem; }
.auth-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--title);
    margin-bottom: 0.35rem;
}
.auth-input {
    width: 100%;
    font: inherit;
    font-size: 0.98rem;
    color: var(--text);
    padding: 0.62rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.auth-input:focus {
    outline: none;
    border-color: var(--primary-alt);
    box-shadow: 0 0 0 3px rgba(136, 167, 208, 0.35);
}

.auth-input-group { position: relative; }
.auth-input-group .auth-input { padding-right: 2.7rem; }
.auth-eye {
    position: absolute;
    top: 0; right: 0;
    height: 100%;
    width: 2.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    border-radius: 0 8px 8px 0;
}
.auth-eye:hover, .auth-eye:focus-visible { color: var(--primary); }
.auth-eye svg { width: 20px; height: 20px; }

/* Buttons */
.auth-btn {
    width: 100%;
    font: inherit;
    font-size: 0.98rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    padding: 0.68rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none; /* also used on <a> (static terminal pages) */
    transition: background 120ms ease;
}
.auth-btn:hover { background: #274a82; }
.auth-btn:focus-visible { outline: 3px solid rgba(136, 167, 208, 0.6); outline-offset: 2px; }
.auth-btn[disabled] { opacity: 0.65; cursor: default; }
.auth-btn .auth-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin 700ms linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .auth-btn .auth-spinner { animation-duration: 1.6s; }
}

/* Secondary links under forms */
.auth-links {
    margin-top: 1.05rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}
.auth-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 0.88rem;
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.auth-link:hover { color: var(--primary-deep); }
.auth-link:focus-visible { outline: 2px solid var(--primary-alt); outline-offset: 2px; }
.auth-muted { font-size: 0.85rem; color: var(--muted); }

/* Code boxes */
.auth-code-row {
    display: flex;
    gap: 0.55rem;
    justify-content: center;
    margin-bottom: 1.1rem;
}
.auth-code-box {
    width: 3rem;
    height: 3.4rem;
    font: inherit;
    font-size: 1.35rem;
    font-weight: 600;
    text-align: center;
    color: var(--title);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.auth-code-box:focus {
    outline: none;
    border-color: var(--primary-alt);
    box-shadow: 0 0 0 3px rgba(136, 167, 208, 0.35);
}

/* Terminal state panel */
.auth-state-icon { display: flex; justify-content: center; margin-bottom: 0.9rem; color: var(--primary); }
.auth-state-icon svg { width: 44px; height: 44px; }
.auth-panel[data-panel="state"] { text-align: center; }
.auth-panel[data-panel="state"] .auth-btn { margin-top: 0.5rem; }

/* Footer */
.auth-footer {
    text-align: center;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.6;
    max-width: 520px;
}
.auth-footer a { color: rgba(255, 255, 255, 0.9); text-decoration: underline; text-underline-offset: 2px; }
.auth-footer a:hover { color: #fff; }
.auth-footer nav { display: flex; gap: 1.25rem; justify-content: center; margin-top: 0.2rem; }

/* No-JS notice */
.auth-noscript {
    display: block;
    background: var(--accent);
    color: var(--title);
    text-align: center;
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    line-height: 1.5;
}
html.no-js .auth-main { display: none; }

/* Small screens */
@media (max-width: 480px) {
    .auth-main { padding: 1.25rem 0.85rem; gap: 1.25rem; justify-content: flex-start; padding-top: 3rem; }
    .auth-card { padding: 1.5rem 1.15rem; }
    .auth-code-box { width: 2.6rem; height: 3rem; font-size: 1.2rem; }
}
