/* ============================================
   AI CMO — Login Page v3.0
   Centered layout, professional, fast
   ============================================ */

:root {
    --bg-base: #050507;
    --bg-elevated: #0A0A0F;
    --bg-surface: rgba(255, 255, 255, 0.025);

    --accent: #FF8A65;
    --accent-hover: #FFAB91;
    --accent-glow: rgba(255, 138, 101, 0.22);
    --accent-deep: rgba(255, 138, 101, 0.08);

    --teal: #4DD0E1;
    --teal-glow: rgba(77, 208, 225, 0.12);

    --white: #FAFAFA;
    --gray-100: #E8E8EC;
    --gray-200: #C4C4CC;
    --gray-300: #A0A0AB;
    --gray-400: #71717A;
    --gray-500: #52525B;
    --gray-600: #3F3F46;
    --gray-700: #27272A;
    --gray-800: #18181B;

    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(255, 138, 101, 0.3);

    --green: #22C55E;
    --red: #EF4444;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --duration: 0.35s;
}

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--white);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ============================================
   BACKGROUND LAYERS (unchanged)
   ============================================ */
.bg-video {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover; z-index: 0;
    opacity: 0.22;
    filter: brightness(0.45) saturate(1.2) contrast(1.1);
    pointer-events: none;
    will-change: opacity;
    transform: translateZ(0);
}

@media (max-width: 768px) {
    .bg-video { display: none; }
    body {
        background-image: url('/static/img/login-bg-poster.jpg');
        background-size: cover; background-position: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bg-video { display: none; }
    body {
        background-image: url('/static/img/login-bg-poster.jpg');
        background-size: cover; background-position: center;
    }
}

.bg-ambient {
    position: fixed; inset: 0;
    pointer-events: none; z-index: 0; overflow: hidden;
}

.bg-ambient::before {
    content: '';
    position: absolute; width: 900px; height: 900px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,138,101,0.10) 0%, rgba(255,107,53,0.04) 40%, transparent 70%);
    top: -300px; right: -200px;
    animation: ambientDrift1 25s ease-in-out infinite;
    filter: blur(80px);
    will-change: transform; transform: translateZ(0);
}

.bg-ambient::after {
    content: '';
    position: absolute; width: 700px; height: 700px; border-radius: 50%;
    background: radial-gradient(circle, rgba(77,208,225,0.07) 0%, rgba(56,178,201,0.03) 40%, transparent 70%);
    bottom: -200px; left: -200px;
    animation: ambientDrift2 22s ease-in-out infinite;
    filter: blur(90px);
    will-change: transform; transform: translateZ(0);
}

.bg-orb-3 {
    position: fixed; width: 500px; height: 500px; border-radius: 50%;
    background: radial-gradient(circle, rgba(168,85,247,0.06) 0%, transparent 70%);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) translateZ(0);
    animation: ambientDrift3 28s ease-in-out infinite;
    filter: blur(100px);
    pointer-events: none; z-index: 0;
    will-change: transform;
}

@keyframes ambientDrift1 {
    0%, 100% { transform: translate(0,0) scale(1); }
    33% { transform: translate(-60px,40px) scale(1.15); }
    66% { transform: translate(30px,80px) scale(1.05); }
}
@keyframes ambientDrift2 {
    0%, 100% { transform: translate(0,0) scale(1); }
    33% { transform: translate(60px,-50px) scale(1.2); }
    66% { transform: translate(-30px,-20px) scale(1.08); }
}
@keyframes ambientDrift3 {
    0%, 100% { transform: translate(-50%,-50%) scale(1); }
    50% { transform: translate(-45%,-55%) scale(1.3); }
}

.bg-grid {
    position: fixed; inset: 0;
    pointer-events: none; z-index: 0; opacity: 0.03;
    background-image:
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black, transparent);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black, transparent);
}

.bg-noise {
    position: fixed; inset: 0;
    pointer-events: none; z-index: 1; opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='5' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    mix-blend-mode: overlay;
}

.bg-particles {
    position: fixed; inset: 0; z-index: 0;
    pointer-events: none; overflow: hidden;
}

.particle {
    position: absolute; width: 2px; height: 2px;
    background: rgba(255,138,101,0.4); border-radius: 50%;
    animation: float-particle linear infinite;
    will-change: transform, opacity; transform: translateZ(0);
}
.particle:nth-child(odd) { background: rgba(77,208,225,0.3); }
.particle:nth-child(1) { left: 15%; animation-duration: 18s; width: 3px; height: 3px; }
.particle:nth-child(2) { left: 35%; animation-duration: 22s; animation-delay: -4s; }
.particle:nth-child(3) { left: 50%; animation-duration: 19s; animation-delay: -8s; }
.particle:nth-child(4) { left: 65%; animation-duration: 24s; animation-delay: -2s; }
.particle:nth-child(5) { left: 80%; animation-duration: 20s; animation-delay: -6s; width: 3px; height: 3px; }

@keyframes float-particle {
    0% { transform: translateY(110vh) scale(0); opacity: 0; }
    10% { opacity: 1; transform: translateY(90vh) scale(1); }
    90% { opacity: 0.6; }
    100% { transform: translateY(-10vh) scale(0.5); opacity: 0; }
}

/* ============================================
   NAVBAR
   ============================================ */
.nav-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 40px;
    background: rgba(6,6,8,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transform: translateZ(0);
}

.nav-brand {
    display: flex; align-items: center; gap: 12px; text-decoration: none;
}

.nav-logo {
    width: 32px; height: 32px; border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #FF6E40);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 16px var(--accent-glow);
}
.nav-logo svg { width: 16px; height: 16px; fill: var(--bg-base); }

.nav-name {
    font-size: 17px; font-weight: 700;
    letter-spacing: -0.02em; color: var(--white);
}

.nav-links { display: flex; align-items: center; gap: 32px; }
.nav-links a {
    font-size: 13px; font-weight: 500; color: var(--gray-300);
    text-decoration: none; transition: color var(--duration) var(--ease);
}
.nav-links a:hover { color: var(--white); }

.nav-right { display: flex; align-items: center; gap: 12px; }

.lang-pills {
    display: flex; gap: 2px; padding: 3px;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}
.lang-pill {
    padding: 5px 12px; border-radius: var(--radius-full);
    font-size: 11px; font-weight: 600; color: var(--gray-400);
    cursor: pointer; transition: all 0.2s ease;
    border: none; background: transparent;
    font-family: var(--font); letter-spacing: 0.05em;
}
.lang-pill:hover { color: var(--gray-200); }
.lang-pill.active { color: var(--bg-base); background: var(--accent); }

/* ============================================
   CENTERED LAYOUT
   ============================================ */
.login-main {
    position: relative; z-index: 2;
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 80px 24px 40px;
    gap: 0;
}

/* ---- Hero intro ---- */
.hero-intro {
    text-align: center;
    margin-bottom: 32px;
    animation: fadeSlideUp 600ms var(--ease) both;
}

.hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 16px;
    background: rgba(255,138,101,0.10);
    border: 1px solid rgba(255,138,101,0.20);
    border-radius: var(--radius-full);
    font-size: 11px; font-weight: 600; color: var(--accent);
    margin-bottom: 20px;
    letter-spacing: 0.06em; text-transform: uppercase;
}

.hero-badge .badge-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent);
    animation: pulse 2s ease-in-out infinite;
}

.hero-title {
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 200;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 12px;
    color: var(--white);
    text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.hero-title strong {
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--teal));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 15px; line-height: 1.6;
    color: var(--gray-300);
    max-width: 400px; margin: 0 auto;
    text-shadow: 0 1px 12px rgba(0,0,0,0.6);
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

/* ---- Auth Card ---- */
.auth-card {
    width: 100%; max-width: 420px;
    padding: 40px;
    background: rgba(8,8,12,0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    position: relative;
    animation: cardSlideIn 600ms var(--ease) 100ms both;
    box-shadow:
        0 24px 80px rgba(0,0,0,0.5),
        0 0 40px rgba(255,138,101,0.03),
        inset 0 1px 0 rgba(255,255,255,0.06);
    transform: translateZ(0);
}

/* Subtle aurora border — static */
.auth-card::before {
    content: '';
    position: absolute; inset: 0;
    border-radius: var(--radius-lg);
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,138,101,0.20), transparent 30%, transparent 70%, rgba(77,208,225,0.15));
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    pointer-events: none;
}

@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Status pill */
.status-pill {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 14px;
    background: rgba(34,197,94,0.06);
    border: 1px solid rgba(34,197,94,0.12);
    border-radius: var(--radius-full);
    font-size: 11px; font-weight: 600; color: var(--green);
    width: fit-content; margin: 0 auto 24px;
}

.live-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--green);
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(34,197,94,0.4);
}

/* Auth header */
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-header h2 {
    font-size: 22px; font-weight: 700;
    letter-spacing: -0.02em; margin-bottom: 6px;
}
.auth-header p { font-size: 13px; color: var(--gray-400); }

/* Fields */
.field { margin-bottom: 18px; }
.field label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--gray-300); margin-bottom: 7px;
    letter-spacing: 0.03em; text-transform: uppercase;
}

.field-input-wrap { position: relative; }

.field-icon {
    position: absolute; left: 14px; top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px; color: var(--gray-500);
    transition: color 0.2s ease; pointer-events: none;
}

.field input {
    width: 100%; padding: 13px 16px 13px 42px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--white); font-size: 14px;
    font-family: var(--font); outline: none;
    transition: all 0.25s var(--ease);
}
.field input::placeholder { color: var(--gray-600); }
.field input:hover { border-color: var(--border-hover); }
.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.field-input-wrap:focus-within .field-icon { color: var(--accent); }

.field input:valid:not(:placeholder-shown) {
    border-color: rgba(34,197,94,0.25);
}
.field-input-wrap:has(input:valid:not(:placeholder-shown)):not(:focus-within) .field-icon {
    color: var(--green);
}

/* Eye toggle */
.eye-toggle {
    position: absolute; right: 14px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    color: var(--gray-500); cursor: pointer; padding: 4px;
    transition: color 0.2s ease;
}
.eye-toggle:hover { color: var(--gray-300); }
.eye-toggle svg { width: 16px; height: 16px; }

/* Remember + Forgot row */
.field-row {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 6px; margin-top: -6px;
}

.remember-check {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; font-size: 12px; color: var(--gray-400);
    user-select: none; transition: color 0.2s ease;
}
.remember-check:hover { color: var(--gray-200); }
.remember-check input[type="checkbox"] { display: none; }

.check-box {
    width: 16px; height: 16px; border-radius: 4px;
    border: 1px solid var(--border-hover);
    background: rgba(255,255,255,0.03);
    position: relative; transition: all 0.2s var(--ease);
    flex-shrink: 0;
}
.remember-check input:checked + .check-box {
    background: var(--accent); border-color: var(--accent);
}
.remember-check input:checked + .check-box::after {
    content: ''; position: absolute;
    left: 4.5px; top: 1.5px;
    width: 5px; height: 9px;
    border: solid var(--bg-base);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.forgot-link {
    font-size: 12px; color: var(--gray-500);
    text-decoration: none; transition: color 0.2s ease;
}
.forgot-link:hover { color: var(--accent); }

/* Submit button */
.submit-btn {
    width: 100%; padding: 15px;
    border: none; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), #FF6E40);
    color: var(--bg-base);
    font-size: 14px; font-weight: 800;
    font-family: var(--font);
    cursor: pointer; margin-top: 10px;
    position: relative; overflow: hidden;
    transition: all 0.3s var(--ease);
    letter-spacing: 0.03em; text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(255,138,101,0.25),
                inset 0 1px 0 rgba(255,255,255,0.2);
}
.submit-btn::before {
    content: ''; position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.6s ease;
}
.submit-btn:hover::before { left: 100%; }
.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255,138,101,0.35),
                inset 0 1px 0 rgba(255,255,255,0.25);
}
.submit-btn:active { transform: translateY(0) scale(0.98); transition-duration: 0.1s; }
.submit-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

/* Progress bar */
.submit-progress {
    width: 100%; height: 3px;
    background: rgba(255,255,255,0.06);
    border-radius: var(--radius-full);
    margin-top: 8px; overflow: hidden;
    opacity: 0; transition: opacity 0.3s var(--ease);
}
.submit-progress.active { opacity: 1; }
.submit-progress .bar {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--teal));
    border-radius: var(--radius-full);
    animation: progressPulse 1.5s ease-in-out infinite;
}
@keyframes progressPulse {
    0% { width: 0%; } 50% { width: 70%; } 100% { width: 100%; }
}

/* Error */
.auth-error {
    display: none; margin-top: 14px;
    padding: 11px 14px;
    background: rgba(239,83,80,0.08);
    border: 1px solid rgba(239,83,80,0.15);
    border-radius: var(--radius-sm);
    color: var(--red); font-size: 13px; text-align: center;
}
.auth-error.show {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    animation: shakeX 400ms var(--ease);
}
@keyframes shakeX {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Kbd hint */
.kbd-hint {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; margin-top: 18px;
    font-size: 11px; color: var(--gray-600);
}
.kbd {
    padding: 3px 8px; border-radius: 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    font-size: 10px; font-weight: 600;
    color: var(--gray-400); font-family: var(--font);
}

/* Spinner */
.spinner {
    display: inline-block; width: 18px; height: 18px;
    border: 2px solid rgba(0,0,0,0.15);
    border-top-color: var(--bg-base);
    border-radius: 50%;
    animation: spin 0.5s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   STATS ROW — below card
   ============================================ */
.stats-row {
    display: flex; align-items: center; gap: 24px;
    margin-top: 28px;
    animation: fadeSlideUp 600ms var(--ease) 300ms both;
}

.stat-item { text-align: center; }

.stat-value {
    display: block;
    font-size: 20px; font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 4px;
}
.stat-value.peach {
    background: linear-gradient(135deg, var(--accent), #FF6E40);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.stat-value.teal {
    background: linear-gradient(135deg, var(--teal), #26C6DA);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-size: 11px; color: var(--gray-500);
    font-weight: 500; letter-spacing: 0.02em;
}

.stat-divider {
    width: 1px; height: 32px;
    background: var(--border);
}

/* ============================================
   TRUST + FOOTER
   ============================================ */
.trust-section {
    margin-top: 24px; text-align: center;
    animation: fadeSlideUp 600ms var(--ease) 400ms both;
}

.trust-logos {
    display: flex; align-items: center; justify-content: center;
    gap: 24px; opacity: 0.35;
    transition: opacity 0.3s var(--ease);
}
.trust-logos:hover { opacity: 0.55; }

.trust-logo {
    font-size: 11px; font-weight: 700;
    color: var(--gray-400); letter-spacing: 0.06em;
    display: flex; align-items: center; gap: 6px;
}
.trust-logo .logo-dot {
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--accent);
}

.auth-footer {
    text-align: center; font-size: 11px;
    color: var(--gray-600); margin-top: 20px;
    animation: fadeSlideUp 600ms var(--ease) 500ms both;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-bar { padding: 12px 16px; }
    .login-main { padding: 72px 16px 32px; }
    .auth-card { padding: 28px 20px; }
    .hero-title { font-size: 28px; }

    .stats-row { gap: 16px; }
    .stat-value { font-size: 16px; }
    .stat-label { font-size: 10px; }
}

@media (max-width: 380px) {
    .field-row {
        flex-direction: column;
        align-items: flex-start; gap: 8px;
    }
    .stats-row { flex-direction: column; gap: 12px; }
    .stat-divider { width: 32px; height: 1px; }
}
