/* =============================================================================
   fmioff v1 — Auth pages styles
   Dark/glass theme consistent with landing purple accent.
   All auth pages share this stylesheet (login, register, forgot, reset, verify, otp).
   ============================================================================= */

/* ---- Utility ---- */
.hidden { display: none !important; }

/* ---- Custom properties ---- */
:root {
    --auth-bg-from:    #0b0d1a;
    --auth-bg-to:      #12102a;
    --auth-surface:    rgba(255,255,255,0.04);
    --auth-border:     rgba(255,255,255,0.09);
    --auth-border-focus: rgba(139,92,246,0.7);
    --auth-text:       #e5e7eb;
    --auth-text-muted: #9ca3af;
    --auth-text-dim:   #6b7280;
    --auth-purple:     #7c3aed;
    --auth-purple-mid: #8b5cf6;
    --auth-purple-lt:  #a78bfa;
    --auth-error:      #ef4444;
    --auth-error-bg:   rgba(239,68,68,0.12);
    --auth-success:    #10b981;
    --auth-success-bg: rgba(16,185,129,0.12);
    --auth-warn:       #f59e0b;
    --auth-warn-bg:    rgba(245,158,11,0.12);
    --auth-radius:     14px;
    --auth-radius-sm:  8px;
    --auth-shadow:     0 24px 64px rgba(0,0,0,0.55);
    --mono:            ui-monospace, 'SF Mono', Menlo, Monaco, monospace;
}

/* ---- Base reset for auth pages ---- */
.auth-page *,
.auth-page *::before,
.auth-page *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---- Background ---- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: linear-gradient(135deg, var(--auth-bg-from) 0%, var(--auth-bg-to) 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--auth-text);
    position: relative;
    overflow: hidden;
}

/* Subtle ambient glow */
.auth-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 900px 500px at 10% 20%, rgba(124,58,237,0.12) 0%, transparent 70%),
        radial-gradient(ellipse 600px 400px at 90% 80%, rgba(139,92,246,0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ---- Card ---- */
.auth-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    padding: 40px 36px;
    box-shadow: var(--auth-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.auth-card--centered {
    text-align: center;
}

/* ---- Logo ---- */
.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
}

.auth-logo a {
    display: inline-flex;
    text-decoration: none;
    opacity: 0.92;
    transition: opacity 0.2s;
}

.auth-logo a:hover {
    opacity: 1;
}

.auth-logo img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}

/* Fallback text shown when logo.png fails to load */
.auth-logo .brand-fallback {
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.3px;
}

/* ---- Heading ---- */
.auth-title {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.3px;
    text-align: center;
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--auth-text-muted);
    text-align: center;
    margin-bottom: 24px;
}

/* ---- Flash messages ---- */
.flash {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border-radius: var(--auth-radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.4;
}

.flash::before {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 1px;
}

.flash--error {
    background: var(--auth-error-bg);
    border: 1px solid rgba(239,68,68,0.25);
    color: #fca5a5;
}

.flash--success {
    background: var(--auth-success-bg);
    border: 1px solid rgba(16,185,129,0.25);
    color: #6ee7b7;
}

.flash--warn {
    background: var(--auth-warn-bg);
    border: 1px solid rgba(245,158,11,0.25);
    color: #fcd34d;
}

.flash--info {
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.2);
    color: #a5b4fc;
}

/* Close button (×) injected by auth/app.js — always visible on the right. */
.flash .flash-close {
    margin-left: auto;
    align-self: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity .15s, background .15s;
}
.flash .flash-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.08); }

/* ---- Form groups ---- */
.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
    color: var(--auth-text-muted);
    margin-bottom: 6px;
}

.form-control {
    display: block;
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    color: var(--auth-text);
    font-family: inherit;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    -webkit-appearance: none;
}

.form-control::placeholder {
    color: var(--auth-text-dim);
}

.form-control:focus {
    border-color: var(--auth-border-focus);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.18);
    background: rgba(255,255,255,0.07);
}

.form-control.is-invalid {
    border-color: rgba(239,68,68,0.6);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
}

.form-control--password-wrap {
    position: relative;
}

.form-control--password-wrap .form-control {
    padding-right: 42px;
}

.btn-show-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    display: flex;
    color: var(--auth-text-dim);
    transition: color 0.18s;
}

.btn-show-password:hover {
    color: var(--auth-text-muted);
}

.form-error {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #fca5a5;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--auth-text-dim);
}

/* ---- Checkbox ---- */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--auth-text-muted);
    margin-bottom: 0;
    justify-content: flex-start;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--auth-purple-mid);
    cursor: pointer;
    flex-shrink: 0;
}

/* ---- Forgot link ---- */
.forgot-link {
    font-size: 12px;
    font-weight: 400;
    color: var(--auth-purple-lt);
    text-decoration: none;
    transition: color 0.15s;
}

.forgot-link:hover {
    color: #ffffff;
}

/* ---- Divider ---- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--auth-text-dim);
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

/* ---- Submit button ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--auth-radius-sm);
    cursor: pointer;
    transition: opacity 0.18s, transform 0.12s, box-shadow 0.18s;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.btn:active {
    transform: scale(0.98);
}

.btn--primary {
    background: linear-gradient(135deg, var(--auth-purple) 0%, var(--auth-purple-mid) 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(124,58,237,0.4);
}

.btn--primary:hover {
    opacity: 0.9;
    box-shadow: 0 6px 22px rgba(124,58,237,0.55);
}

.btn--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn--ghost {
    background: transparent;
    color: var(--auth-text-muted);
    border: 1px solid var(--auth-border);
}

.btn--ghost:hover {
    background: rgba(255,255,255,0.05);
    color: var(--auth-text);
}

.btn--full {
    width: 100%;
    margin-top: 8px;
}

/* ---- Turnstile ---- */
.turnstile-wrap {
    margin: 16px 0;
    display: flex;
    justify-content: center;
}

/* Override CF Turnstile border-radius to match card */
.cf-turnstile iframe {
    border-radius: var(--auth-radius-sm) !important;
}

/* ---- Footer text ---- */
.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--auth-text-dim);
}

.auth-footer a {
    color: var(--auth-purple-lt);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.auth-footer a:hover {
    color: #ffffff;
}

/* ---- State page (verify email) ---- */
.auth-state-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.auth-state-icon svg {
    width: 56px;
    height: 56px;
}

.auth-state-icon--success circle {
    fill: rgba(16,185,129,0.15);
}

.auth-state-icon--error circle {
    fill: rgba(239,68,68,0.15);
}

.auth-state-title {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    margin-bottom: 8px;
}

.auth-state-body {
    font-size: 13px;
    color: var(--auth-text-muted);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* ---- OTP boxes ---- */
.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 24px 0 8px;
}

.otp-box {
    width: 48px;
    height: 58px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    caret-color: var(--auth-purple-lt);
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    color: #ffffff;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    -webkit-appearance: none;
}

.otp-box:focus {
    border-color: var(--auth-border-focus);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.2);
}

.otp-box.is-filled {
    border-color: rgba(139,92,246,0.5);
    background: rgba(139,92,246,0.08);
}

.otp-box.is-invalid {
    border-color: rgba(239,68,68,0.6);
    animation: otp-shake 0.3s ease;
}

@keyframes otp-shake {
    0%, 100% { transform: translateX(0); }
    25%       { transform: translateX(-4px); }
    75%       { transform: translateX(4px); }
}

/* Hidden aggregated input for form submit */
.otp-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* ---- OTP countdown ---- */
.otp-timer {
    text-align: center;
    font-size: 12px;
    color: var(--auth-text-dim);
    margin-bottom: 16px;
    min-height: 18px;
}

.otp-timer--warn {
    color: var(--auth-warn);
}

.otp-timer--expired {
    color: var(--auth-error);
    font-weight: 600;
}

/* ---- Password strength indicator ---- */
.password-strength {
    margin-top: 8px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.07);
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
    width: 0%;
}

.password-strength-bar[data-level="1"] { width: 25%; background: #ef4444; }
.password-strength-bar[data-level="2"] { width: 50%; background: #f59e0b; }
.password-strength-bar[data-level="3"] { width: 75%; background: #10b981; }
.password-strength-bar[data-level="4"] { width: 100%; background: #22c55e; }

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .auth-card {
        padding: 28px 20px;
        border-radius: 10px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .auth-title {
        font-size: 20px;
    }

    .otp-box {
        width: 42px;
        height: 52px;
        font-size: 20px;
    }

    .otp-inputs {
        gap: 7px;
    }
}
