
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ─────────────────────────────────────────────────────────────
   1. DESIGN TOKENS  (mirror INDEX.css for visual consistency)
   ───────────────────────────────────────────────────────────── */
:root {
    --bg-dark:        #05070a;
    --panel-bg:       rgba(17, 25, 39, 0.78);
    --panel-border:   rgba(0, 212, 255, 0.18);

    --accent-cyan:    #00d4ff;
    --accent-blue:    #2449ff;
    --neon-purple:    #9d00ff;

    --danger:         #ff4d4d;
    --success:        #00e676;

    --text-primary:   #f0f6fc;
    --text-secondary: #8b949e;
    --border-line:    rgba(255, 255, 255, 0.08);

    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --shadow-card:  0 30px 80px rgba(0, 0, 0, 0.55),
                    0 0 40px rgba(0, 212, 255, 0.08);
    --shadow-glow:  0 0 24px rgba(0, 212, 255, 0.25);
}

/* ─────────────────────────────────────────────────────────────
   2. RESET
   ───────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body { height: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

/* ─────────────────────────────────────────────────────────────
   3. PAGE LAYOUT — foolproof centering for every viewport
   ───────────────────────────────────────────────────────────── */
body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;        
    min-height: 100svh;        
    display: grid;
    place-items: center;
    padding: clamp(16px, 4vw, 48px);
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ─────────────────────────────────────────────────────────────
   4. ANIMATED CYBER-GRID BACKGROUND  (matches admin .ai-bg)
   ───────────────────────────────────────────────────────────── */
.bg-animation {
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(circle at 50% 0%, #162a45 0%, #05070a 70%),
        radial-gradient(circle at 80% 100%, rgba(157, 0, 255, 0.18) 0%, transparent 55%),
        radial-gradient(circle at 20% 90%, rgba(0, 212, 255, 0.12) 0%, transparent 55%);
    pointer-events: none;
}

body::before {
    content: "";
    position: fixed;
    inset: -50%;
    width: 200%;
    height: 200%;
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.07) 1px, transparent 1px);
    background-size: 70px 70px;
    transform: perspective(700px) rotateX(60deg);
    transform-origin: center top;
    animation: gridMove 22s linear infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes gridMove {
    0%   { background-position: 0 0; }
    100% { background-position: 0 70px; }
}

/* ─────────────────────────────────────────────────────────────
   5. LOGIN CARD
   ───────────────────────────────────────────────────────────── */
.login-container {
    position: relative;
    width: 100%;
    max-width: min(460px, 100%);
    padding: clamp(28px, 5vw, 56px) clamp(22px, 5vw, 52px);
    background: var(--panel-bg);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    text-align: center;
    animation: cardIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

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

/* Cyan / purple L-shaped corner accents — scale with the card */
.login-container::before,
.login-container::after {
    content: "";
    position: absolute;
    width: clamp(28px, 8%, 44px);
    height: clamp(28px, 8%, 44px);
    pointer-events: none;
}
.login-container::before {
    top: -1px; left: -1px;
    border-top:  2px solid var(--accent-cyan);
    border-left: 2px solid var(--accent-cyan);
    border-top-left-radius: var(--radius-lg);
    filter: drop-shadow(0 0 6px rgba(0, 212, 255, 0.5));
}
.login-container::after {
    bottom: -1px; right: -1px;
    border-bottom: 2px solid var(--neon-purple);
    border-right:  2px solid var(--neon-purple);
    border-bottom-right-radius: var(--radius-lg);
    filter: drop-shadow(0 0 6px rgba(157, 0, 255, 0.5));
}

#panel-login,
#panel-reset { width: 100%; }

#panel-reset[hidden] { display: none; }

/* ─────────────────────────────────────────────────────────────
   6. HEADER  (logo · title · tagline)
   ───────────────────────────────────────────────────────────── */
.login-header { margin-bottom: clamp(24px, 4vw, 36px); }

.ai-icon {
    display: inline-block;
    font-size: clamp(2.2rem, 6vw, 3rem);
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 14px rgba(0, 212, 255, 0.6));
    margin-bottom: 14px;
}

.login-header h2 {
    font-size: clamp(1.4rem, 4.5vw, 1.9rem);
    font-weight: 800;
    letter-spacing: 1.5px;
    line-height: 1.2;
    margin-bottom: 8px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--neon-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.login-header p {
    color: var(--text-secondary);
    font-size: clamp(0.78rem, 2.4vw, 0.88rem);
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

/* ─────────────────────────────────────────────────────────────
   7. FORM
   ───────────────────────────────────────────────────────────── */
form { width: 100%; }

.input-group {
    margin-bottom: clamp(16px, 3vw, 22px);
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 1.4px;
}

.input-group input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(13, 17, 23, 0.85);
    border: 1px solid var(--border-line);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    letter-spacing: 0.4px;
    transition: border-color 0.25s ease,
                background 0.25s ease,
                box-shadow 0.25s ease;
    min-height: 48px;            /* touch-friendly */
}

.input-group input::placeholder {
    color: var(--text-secondary);
    opacity: 0.65;
}

.input-group input:hover {
    border-color: rgba(0, 212, 255, 0.35);
}

.input-group input:focus,
.input-group input:focus-visible {
    outline: none;
    border-color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.05);
    box-shadow: var(--shadow-glow);
}

/* Browser autofill — keep theme colors instead of bright yellow */
.input-group input:-webkit-autofill,
.input-group input:-webkit-autofill:hover,
.input-group input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary);
    -webkit-box-shadow: 0 0 0 1000px rgba(13, 17, 23, 0.95) inset;
    caret-color: var(--text-primary);
    transition: background-color 9999s ease-out 0s;
}

/* ─────────────────────────────────────────────────────────────
   8. AUTHENTICATE BUTTON
   ───────────────────────────────────────────────────────────── */
.login-btn {
    width: 100%;
    min-height: 52px;
    padding: 14px 18px;
    margin-top: 8px;
    background: linear-gradient(135deg, var(--neon-purple), var(--accent-cyan));
    background-size: 200% 200%;
    background-position: 0% 50%;
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 28px rgba(157, 0, 255, 0.25),
                0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    transition: transform 0.25s ease,
                box-shadow 0.25s ease,
                background-position 0.6s ease,
                filter 0.25s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    background-position: 100% 50%;
    box-shadow: 0 18px 38px rgba(0, 212, 255, 0.35),
                0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    filter: brightness(1.05);
}

.login-btn:active { transform: translateY(0); filter: brightness(0.95); }

.login-btn:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 3px;
}

/* ─────────────────────────────────────────────────────────────
   8b. 3-FACTOR RESET PANEL
        (.factor-badge · .input-group.compact · .verify-btn)
   ───────────────────────────────────────────────────────────── */

/* Pill badge displayed at the top of the reset panel */
.factor-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    margin-bottom: clamp(16px, 3vw, 22px);
    background: rgba(0, 212, 255, 0.07);
    border: 1px solid rgba(0, 212, 255, 0.28);
    border-radius: 999px;
    color: var(--accent-cyan);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.factor-badge i { font-size: 0.85rem; }


.verify-btn {
    background: linear-gradient(135deg, var(--accent-cyan), var(--neon-purple));
    background-size: 200% 200%;
    background-position: 0% 50%;
    box-shadow: 0 12px 28px rgba(0, 212, 255, 0.25),
                0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    margin-top: clamp(8px, 2vw, 14px);
}

.verify-btn:hover {
    background-position: 100% 50%;
    box-shadow: 0 18px 38px rgba(157, 0, 255, 0.35),
                0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

/* The reset panel inherits the card animation but starts a beat later
   so its first paint feels like a transition from the login panel. */
#panel-reset .login-header { margin-bottom: clamp(18px, 3vw, 26px); }

/* ─────────────────────────────────────────────────────────────
   9. reCAPTCHA — keep the widget centered and never overflow
   ───────────────────────────────────────────────────────────── */
.g-recaptcha {
    margin: 22px 0 8px;
    display: flex;
    justify-content: center;
    transform-origin: center center;
}

/* The widget is a fixed 304 px. Scale it down on narrow screens. */
@media (max-width: 380px) {
    .g-recaptcha { transform: scale(0.86); }
}
@media (max-width: 340px) {
    .g-recaptcha { transform: scale(0.78); }
}

/* ─────────────────────────────────────────────────────────────
   10. FORGOT-PASSWORD / BACK LINK
   ───────────────────────────────────────────────────────────── */
.forgot-link {
    margin-top: clamp(18px, 3vw, 24px);
    text-align: center;
    font-size: 0.85rem;
}

.forgot-link a {
    color: var(--text-secondary);
    text-decoration: none;
    letter-spacing: 0.4px;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.forgot-link a:hover,
.forgot-link a:focus-visible {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
    outline: none;
}

/* ─────────────────────────────────────────────────────────────
   11. ERROR / SUCCESS MESSAGES
   ───────────────────────────────────────────────────────────── */
.error-message,
.success-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 18px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    text-align: left;
    line-height: 1.4;
    animation: msgIn 0.35s ease both;
}

.error-message {
    background: rgba(255, 77, 77, 0.08);
    border: 1px solid rgba(255, 77, 77, 0.35);
    color: var(--danger);
}

.success-message {
    background: rgba(0, 230, 118, 0.08);
    border: 1px solid rgba(0, 230, 118, 0.35);
    color: var(--success);
}

.error-message i,
.success-message i { font-size: 1rem; flex-shrink: 0; }

@keyframes msgIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

/* ─────────────────────────────────────────────────────────────
   12. RESPONSIVE BREAKPOINTS
   ───────────────────────────────────────────────────────────── */

/* Tablets and below — tighten the card */
@media (max-width: 600px) {
    .login-container {
        border-radius: var(--radius-md);
        max-width: 100%;
    }
    .login-container::before,
    .login-container::after {
        border-top-left-radius: var(--radius-md);
        border-bottom-right-radius: var(--radius-md);
    }
}

/* Phones */
@media (max-width: 420px) {
    body { padding: 12px; }
    .input-group input { font-size: 0.9rem; padding: 12px 14px; }
    .login-btn { letter-spacing: 1.5px; font-size: 0.85rem; }
}

/* Very short viewports (landscape phones, small laptops) — let the page scroll
   naturally instead of clipping the card. */
@media (max-height: 720px) {
    body {
        place-items: start center;
        padding-top: clamp(16px, 4vh, 32px);
        padding-bottom: clamp(16px, 4vh, 32px);
    }
    .login-container { animation: none; }
}

/* Ultra-wide / large monitors — keep the card readable, not stretched */
@media (min-width: 1600px) {
    .login-container { max-width: 500px; }
}

/* ─────────────────────────────────────────────────────────────
   13. ACCESSIBILITY — respect reduced-motion preference
   ───────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    body::before { animation: none; }
}
