/**
 * IO Passport — Auth & Onboarding Stylesheet
 * Login, Signup, Forgot Password, Reset, Activate
 *
 * Premium dark design matching the IO Passport brand.
 */

/* ═══════════════════════════════════════════════════════
   TOKENS (must mirror iop-style.css)
   ═══════════════════════════════════════════════════════ */
:root {
    --bg:         #07090e;
    --surface:    #09091a;
    --panel:      #0c0e1e;
    --card:       #0f1222;
    --border:     #181e35;
    --border-bright: #222b48;

    --accent:     #5b8def;
    --accent-dim: rgba(91, 141, 239, 0.12);
    --accent-glow: rgba(91, 141, 239, 0.28);
    --accent2:    #00c9a7;
    --accent3:    #a78bfa;
    --danger:     #f87171;
    --warn:       #fbbf24;
    --success:    #34d399;

    --text:       #dce8f8;
    --text-muted: #5d7a9e;
    --text-dim:   #26344f;

    --font:       -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    --radius:     10px;
    --radius-sm:  6px;
    --radius-lg:  20px;
    --transition: 0.15s ease;
}

/* ═══════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { min-height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }

/* ═══════════════════════════════════════════════════════
   BACKGROUND — ambient orbs + grid
   ═══════════════════════════════════════════════════════ */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(91, 141, 239, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(91, 141, 239, 0.03) 1px, transparent 1px);
    background-size: 52px 52px;
    pointer-events: none;
    z-index: 0;
}

.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.12;
    pointer-events: none;
    z-index: 0;
}

.orb-1 {
    width: 600px;
    height: 600px;
    top: -200px;
    left: -200px;
    background: #1a4fff;
}

.orb-2 {
    width: 500px;
    height: 500px;
    bottom: -150px;
    right: -150px;
    background: #7c3aed;
}

/* ═══════════════════════════════════════════════════════
   PAGE LAYOUT — centered card
   ═══════════════════════════════════════════════════════ */
body.page-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
}

/* ═══════════════════════════════════════════════════════
   AUTH CARD
   ═══════════════════════════════════════════════════════ */
.card {
    position: relative;
    z-index: 1;
    background: var(--card);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-lg);
    padding: 42px 38px;
    width: 100%;
    max-width: 460px;
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: cardAppear 0.25s ease;
}

@keyframes cardAppear {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* Top gradient line on card */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--accent) 30%,
        var(--accent3) 70%,
        transparent 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    opacity: 0.7;
}

.card.card-narrow { max-width: 400px; }
.card.card-center { text-align: center; }

/* ═══════════════════════════════════════════════════════
   LOGO / BRANDING
   ═══════════════════════════════════════════════════════ */
.logo-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.logo-mark {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent3) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    color: #fff;
    letter-spacing: -0.5px;
    flex-shrink: 0;
    box-shadow: 0 0 20px var(--accent-glow), 0 4px 8px rgba(0,0,0,.4);
}

.logo-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

/* Gradient text logo variant */
.logo-gradient {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.06em;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent3) 60%, var(--accent2) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
    display: block;
}

/* ═══════════════════════════════════════════════════════
   CARD TYPOGRAPHY
   ═══════════════════════════════════════════════════════ */
.card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.4px;
    margin-bottom: 6px;
    line-height: 1.2;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 28px;
}

/* ═══════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }

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

label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"] {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: var(--font);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

input::placeholder { color: var(--text-dim); }

/* Input wrapper with icon */
.input-wrap {
    position: relative;
}

.input-wrap input {
    padding-left: 38px;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════ */
.btn-primary {
    display: block;
    width: 100%;
    padding: 11px;
    border-radius: var(--radius-sm);
    border: none;
    background: linear-gradient(135deg, var(--accent) 0%, #3d6fd4 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    text-decoration: none;
    letter-spacing: -0.1px;
    box-shadow: 0 4px 16px var(--accent-glow);
    font-family: var(--font);
    margin-top: 6px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px var(--accent-glow);
    opacity: 0.92;
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
    opacity: 0.7;
    transform: none;
    cursor: not-allowed;
}

/* ── Button spinner ────────────────────────────────── */
.btn-primary.loading,
.btn-save.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-primary.loading::after,
.btn-save.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin 0.65s linear infinite;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* Inline / small variant */
.btn-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
    font-family: var(--font);
    border: none;
}

.btn-inline:hover { opacity: 0.88; transform: translateY(-1px); }

/* ═══════════════════════════════════════════════════════
   STATUS MESSAGES
   ═══════════════════════════════════════════════════════ */
.msg {
    font-size: 13px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    display: none;
    line-height: 1.5;
}

.msg-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.25);
    color: var(--danger);
}

.msg-success {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.25);
    color: var(--success);
}

.msg-warning {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: var(--warn);
}

/* ═══════════════════════════════════════════════════════
   BACK LINK
   ═══════════════════════════════════════════════════════ */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 24px;
    transition: color var(--transition);
}

.back-link:hover { color: var(--accent); }

/* ═══════════════════════════════════════════════════════
   CARD FOOTER (sign in / sign up links)
   ═══════════════════════════════════════════════════════ */
.card-footer {
    text-align: center;
    margin-top: 22px;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 18px;
}

.card-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.card-footer a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════
   ICON (for states like activate-email)
   ═══════════════════════════════════════════════════════ */
.icon-large {
    font-size: 52px;
    display: block;
    margin-bottom: 16px;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════
   DIVIDER
   ═══════════════════════════════════════════════════════ */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

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

/* ═══════════════════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════════════════ */
.hidden  { display: none !important; }
.mt-sm   { margin-top: 8px; }
.mt-md   { margin-top: 16px; }
.text-center { text-align: center; }

.link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    transition: color var(--transition);
}

.link:hover { color: var(--text); }

/* ═══════════════════════════════════════════════════════
   CLASS ALIASES (for HTML pages using semantic class names)
   ═══════════════════════════════════════════════════════ */

/* Page layout */
body.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
    min-height: 100vh;
}

/* Card */
.auth-card {
    position: relative;
    z-index: 1;
    background: var(--card);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-lg);
    padding: 42px 38px;
    width: 100%;
    max-width: 460px;
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: cardAppear 0.25s ease;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--accent) 30%, var(--accent3) 70%, transparent 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    opacity: 0.7;
}

/* Typography */
.auth-title    { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.4px; margin-bottom: 6px; }
.auth-subtitle { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 24px; }

/* Footer / back link */
.auth-footer {
    text-align: center;
    margin-top: 22px;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 18px;
}
.auth-footer a { color: var(--accent); text-decoration: none; font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

.auth-back {
    display: inline-block;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 20px;
    transition: color var(--transition);
}
.auth-back:hover { color: var(--accent); }

/* State containers (activate-email states) */
.auth-state { }

.auth-state-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
    text-align: center;
}

.auth-state-icon.spin { animation: spin 1.2s linear infinite; }

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.auth-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    display: inline-block;
    margin-top: 8px;
}
.auth-link:hover { text-decoration: underline; }

/* Form helpers (with class selectors for when used alongside iop-style.css inputs) */
.form-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.form-input {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: var(--font);
    display: block;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

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

.form-optional {
    color: var(--text-dim);
    font-weight: 400;
    font-size: 10px;
    text-transform: none;
    letter-spacing: 0;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .card, .auth-card { padding: 28px 20px; }
    .form-row { grid-template-columns: 1fr; }
}
