/* ============================================================================
 * auth.css — shared styles for the chrome-less authentication pages
 * (login, register, two-factor, mfa-setup, change/reset password, accept-invite,
 *  email verification). Loaded by layouts/layout_auth.html.
 *
 * Consolidation note (template-consolidation pilot, 2026-06-08):
 * Every auth page used to inline ~250 lines of near-identical CSS. That block is
 * now centralized here. The animated background gradient is unified to the
 * violet/blue scheme used by 9 of the 10 auth pages (login was the lone red
 * variant). The red accent (var(--color-danger)) is preserved on buttons,
 * focus rings and the logo across all pages.
 *
 * Token-first: values use var(--token, #fallback). The fallback keeps parity
 * even when tokens.css is absent. Genuinely page-unique CSS (OTP cells, plan
 * cards, QR blocks, step indicators, password-strength meters) stays in each
 * page's {% block extra_css %}.
 * ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: 'Google Sans', 'Roboto', sans-serif;
    overflow: hidden;
}

/* ── Animated / video background scaffold ─────────────────────────────────── */
#animated-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.32), transparent 36%),
        radial-gradient(circle at 76% 12%, rgba(168, 85, 247, 0.22), transparent 38%),
        radial-gradient(circle at 72% 80%, rgba(59, 130, 246, 0.25), transparent 42%),
        linear-gradient(130deg, #0f172a 0%, #1e293b 44%, #334155 100%);
    background-size: 140% 140%;
    animation: auth-bg-drift 20s ease-in-out infinite alternate;
}

@keyframes auth-bg-drift {
    0%   { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

#video-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: -2;
}

#video-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* When animation mode is active, hide the video + scrim; otherwise hide the
   animated gradient (the body class is set by layout_auth.html). */
body.bg-animation #video-bg,
body.bg-animation #video-overlay { display: none; }
body:not(.bg-animation) #animated-bg { display: none; }

/* ── Page shell (owned by layout_auth.html) ──────────────────────────────── */
.auth-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 2fr;
    height: 100vh;
}

.auth-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem;
    overflow-y: auto;
}

.auth-brand-logo {
    width: 100%;
    max-width: 320px;
    height: auto;
}

/* Glass card */
.auth-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.15),
                0 8px 32px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.7),
                inset 0 -1px 0 rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    color: var(--color-text-primary, #111827);
}

.auth-card--wide   { max-width: 420px; }
.auth-card--center { text-align: center; }

/* ── Card header (logo + title + subtitle) ───────────────────────────────── */
.login-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}
.login-logo .material-icons {
    font-size: 2.2rem;
    color: var(--color-danger, #ef4444);
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.2;
    color: var(--color-text-primary, #111827);
}

.login-subtitle {
    font-size: 0.85rem;
    color: rgba(0, 0, 0, 0.6);
    line-height: 1.5;
    margin-bottom: 1.75rem;
}

/* Result/status card text (verify-email, email-verification) */
.card-title   { font-size: 1.3rem; font-weight: 700; color: var(--color-text-primary, #111827); margin-bottom: 0.5rem; }
.card-message { font-size: 0.84rem; color: rgba(0, 0, 0, 0.55); line-height: 1.55; margin-bottom: 1.6rem; }
.card-message strong { color: var(--color-text-primary, #111827); }

/* ── Floating-label fields (login / register / password-reset) ───────────── */
.field-wrapper { position: relative; margin-bottom: 1.25rem; }

.field-wrapper input,
.field-wrapper select,
.field-wrapper textarea {
    width: 100%;
    padding: 14px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    color: var(--color-text-primary, #111827);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}
.field-wrapper textarea { resize: vertical; min-height: 72px; }

.field-wrapper input:focus,
.field-wrapper select:focus,
.field-wrapper textarea:focus {
    border-color: var(--color-danger, #ef4444);
    box-shadow: 0 0 0 2px rgba(201, 79, 64, 0.1);
}

.field-wrapper input::placeholder,
.field-wrapper textarea::placeholder { color: rgba(0, 0, 0, 0.4); }

.field-wrapper label {
    position: absolute;
    top: -0.55rem;
    left: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 0 4px;
    font-size: 0.72rem;
    color: rgba(0, 0, 0, 0.6);
    pointer-events: none;
    border-radius: 2px;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Icon-prefixed fields (change-password / reset-confirm / mfa / invite) ── */
.field-group { margin-bottom: 1.1rem; }

.field-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.65);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.field-wrap { position: relative; }

.field-wrap > .material-icons {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.field-wrap .toggle-pw {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    color: rgba(0, 0, 0, 0.35);
}

.field-input {
    width: 100%;
    padding: 11px 40px 11px 38px;
    border: 1.5px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--color-text-primary, #111827);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field-input:focus {
    border-color: var(--color-danger, #ef4444);
    box-shadow: 0 0 0 3px rgba(201, 79, 64, 0.1);
}

.field-hint {
    font-size: 0.78rem;
    color: rgba(0, 0, 0, 0.5);
    margin-top: 5px;
    line-height: 1.4;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-signin,
.btn-primary {
    width: 100%;
    padding: 13px;
    background: var(--color-danger, #ef4444);
    color: var(--color-on-accent, #fff);
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 0.5rem;
    text-decoration: none;
}

.btn-signin:hover,
.btn-primary:hover {
    background: var(--color-danger-text, #dc2626);
    box-shadow: 0 4px 16px rgba(201, 79, 64, 0.4);
}

.btn-signin:active,
.btn-primary:active { background: var(--color-danger-text, #dc2626); }

.btn-signin:disabled,
.btn-primary:disabled {
    background: rgba(201, 79, 64, 0.4);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:hover { background: rgba(0, 0, 0, 0.04); border-color: rgba(0, 0, 0, 0.25); }

.btn-ghost {
    width: 100%;
    padding: 11px;
    background: transparent;
    color: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.13);
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    margin-top: 0.6rem;
}
.btn-ghost:hover { background: rgba(0, 0, 0, 0.04); }

/* In-button spinners */
.btn-spinner,
.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Banners ──────────────────────────────────────────────────────────────── */
.login-error {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(201, 79, 64, 0.3);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    margin-bottom: 1.1rem;
    font-size: 0.85rem;
    color: var(--color-danger, #ef4444);
    background: rgba(201, 79, 64, 0.06);
}
.login-error .material-icons { font-size: 1rem; flex-shrink: 0; }

.login-success {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: 8px;
    padding: 0.85rem 0.9rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    color: var(--color-success-text, #16a34a);
    background: rgba(34, 197, 94, 0.08);
    line-height: 1.5;
}
.login-success .material-icons { font-size: 1.1rem; flex-shrink: 0; color: var(--color-success-text, #16a34a); margin-top: 1px; }

.login-warning {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(251, 188, 5, 0.4);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    margin-bottom: 1.1rem;
    font-size: 0.85rem;
    color: var(--color-warning, #f59e0b);
    background: rgba(251, 188, 5, 0.06);
}
.login-warning .material-icons { font-size: 1rem; flex-shrink: 0; }

.success-banner {
    display: flex; align-items: center; gap: 8px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.82rem;
    color: var(--color-success-text, #16a34a);
    margin-bottom: 1.2rem;
    text-align: left;
}
.success-banner .material-icons { font-size: 16px; flex-shrink: 0; }

.error-banner {
    display: flex; align-items: center; gap: 8px;
    background: rgba(201, 79, 64, 0.07);
    border: 1px solid rgba(201, 79, 64, 0.25);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.82rem;
    color: var(--color-danger, #ef4444);
    margin-bottom: 1.2rem;
    text-align: left;
}
.error-banner .material-icons { font-size: 16px; flex-shrink: 0; }

.warn-banner {
    display: flex; align-items: flex-start; gap: 8px;
    background: rgba(234, 179, 8, 0.07);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 1.4rem;
    font-size: 0.82rem;
    color: rgba(0, 0, 0, 0.65);
    line-height: 1.5;
}
.warn-banner .material-icons { font-size: 16px; color: var(--color-warning-text, #d97706); flex-shrink: 0; margin-top: 1px; }

.info-banner {
    display: flex; align-items: flex-start; gap: 8px;
    background: rgba(59, 130, 246, 0.07);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 1.2rem;
    font-size: 0.82rem;
    color: rgba(0, 0, 0, 0.6);
    line-height: 1.5;
}
.info-banner .material-icons { font-size: 16px; color: var(--color-info-text, #2563eb); flex-shrink: 0; margin-top: 1px; }

/* ── Result-state icon (verify-email / email-verification) ───────────────── */
.state-icon-wrap { display: flex; align-items: center; justify-content: center; margin-bottom: 1.4rem; }
.state-icon {
    width: 80px; height: 80px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.state-icon.pending  { background: var(--color-warning-bg, #fef3c7); box-shadow: 0 6px 24px rgba(245, 158, 11, 0.3); position: relative; }
.state-icon.verified { background: var(--color-success-bg, #dcfce7); box-shadow: 0 6px 24px rgba(34, 197, 94, 0.3); }
.state-icon.error    { background: var(--color-danger-bg, #fee2e2);  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.3); }
.state-icon .material-icons { font-size: 2.6rem; }
.state-icon.pending  .material-icons { color: var(--color-warning-text, #d97706); }
.state-icon.verified .material-icons { color: var(--color-success-text, #16a34a); }
.state-icon.error    .material-icons { color: var(--color-danger-text, #dc2626); }

.state-icon.pending::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(245, 158, 11, 0.3);
    animation: ripple 2s ease-out infinite;
}

@keyframes pop-in {
    0%   { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1);   opacity: 1; }
}
@keyframes ripple {
    0%   { transform: scale(0.9); opacity: 0.7; }
    100% { transform: scale(1.3); opacity: 0;   }
}

/* ── Chips & info pills ──────────────────────────────────────────────────── */
.email-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.82rem;
    color: var(--color-info-text, #2563eb);
    font-weight: 600;
    margin: 0 auto 1.2rem;
}
.email-chip .material-icons { font-size: 14px; }

.invite-chip {
    display: flex; align-items: center; gap: 8px;
    background: rgba(59, 130, 246, 0.07);
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 1.4rem;
    font-size: 0.82rem;
}
.invite-chip .material-icons { font-size: 1.1rem; color: var(--color-info-text, #2563eb); flex-shrink: 0; }
.invite-chip-text { color: rgba(0, 0, 0, 0.6); }
.invite-chip-text strong { color: var(--color-text-primary, #111827); }

.tips-list { list-style: none; text-align: left; margin: 1rem 0 1.4rem; padding: 0; }
.tips-list li {
    display: flex; align-items: flex-start; gap: 8px;
    font-size: 0.78rem; color: rgba(0, 0, 0, 0.5);
    margin-bottom: 6px;
}
.tips-list li .material-icons { font-size: 14px; color: var(--color-text-faint, #6b7280); margin-top: 1px; flex-shrink: 0; }

/* ── Links ────────────────────────────────────────────────────────────────── */
.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    margin-top: 1.5rem;
    font-size: 0.83rem;
    color: rgba(0, 0, 0, 0.5);
    text-decoration: none;
    transition: color 0.15s;
}
.back-link:hover { color: var(--color-danger, #ef4444); }
.back-link .material-icons { font-size: 0.95rem; }

.text-divider { font-size: 0.75rem; color: rgba(0, 0, 0, 0.35); margin-top: 1rem; }
.link { color: var(--color-danger, #ef4444); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
