/* ═══════════════════════════════════════════════════════════════════════════
   KODA GRID PRODUCTION — LOGIN & SIGN UP PAGE (Frosted Ambient Theme)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --login-card-bg: rgba(255, 255, 255, 0.85);
    --login-card-border: rgba(14, 165, 233, 0.24);
    --login-card-shadow: 0 30px 70px -15px rgba(14, 165, 233, 0.16), 0 0 0 1px rgba(255, 255, 255, 0.85);
    --login-title-color: #090a0f;
    --login-sub-color: #64748b;
    --auth-switcher-bg: #e2e8f0;
    --auth-switcher-border: rgba(14, 165, 233, 0.2);
    --auth-slider-bg: #ffffff;
    --auth-tab-active-color: #0284c7;
    --auth-tab-color: #64748b;
    --auth-tab-shadow: 0 4px 14px rgba(14, 165, 233, 0.18);
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --input-color: #0f172a;
    --input-focus-border: #0284c7;
    --captcha-bg: #f1f5f9;
    --captcha-border: #cbd5e1;
}

[data-theme="dark"] {
    --login-card-bg: rgba(11, 18, 33, 0.90);
    --login-card-border: rgba(14, 165, 233, 0.26);
    --login-card-shadow: 0 30px 75px -15px rgba(0, 0, 0, 0.75), 0 0 35px rgba(14, 165, 233, 0.1);
    --login-title-color: #f8fafc;
    --login-sub-color: #94a3b8;
    --auth-switcher-bg: rgba(15, 23, 42, 0.9);
    --auth-switcher-border: rgba(14, 165, 233, 0.25);
    --auth-slider-bg: #0284c7;
    --auth-tab-active-color: #ffffff;
    --auth-tab-color: #94a3b8;
    --auth-tab-shadow: 0 4px 16px rgba(2, 132, 199, 0.45);
    --input-bg: rgba(15, 23, 42, 0.88);
    --input-border: rgba(14, 165, 233, 0.25);
    --input-color: #f8fafc;
    --input-focus-border: #38bdf8;
    --captcha-bg: rgba(15, 23, 42, 0.95);
    --captcha-border: rgba(14, 165, 233, 0.25);
}

/* Heavily Blurred Background Layer */
#grid-canvas.grid-canvas-blurred {
    filter: blur(22px);
    -webkit-filter: blur(22px);
    transform: scale(1.08);
    pointer-events: none;
    opacity: 0.85;
}

[data-theme="dark"] #grid-canvas.grid-canvas-blurred {
    opacity: 0.6;
}

.login-backdrop-blur {
    position: fixed;
    inset: 0;
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.75) 100%);
    z-index: 1;
    pointer-events: none;
}

[data-theme="dark"] .login-backdrop-blur {
    background: radial-gradient(circle at 50% 40%, rgba(7, 11, 20, 0.45) 0%, rgba(7, 11, 20, 0.82) 100%);
}

/* Page Viewport */
.login-viewport {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    z-index: 2;
    padding-top: 96px;
    padding-bottom: 24px;
    box-sizing: border-box;
}

.login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 24px;
    position: relative;
}

/* Ambient Cyan Glow Aura Behind Card */
.login-glow-aura {
    position: absolute;
    width: 680px;
    height: 680px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.22) 0%, rgba(2, 132, 199, 0.1) 45%, transparent 70%);
    filter: blur(65px);
    pointer-events: none;
    z-index: 2;
    animation: loginAuraFloat 7s ease-in-out infinite alternate;
}

@keyframes loginAuraFloat {
    0% { transform: scale(0.92) translate(-10px, -10px); }
    100% { transform: scale(1.08) translate(12px, 12px); }
}

/* Main Card */
.login-card {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 450px;
    background: var(--login-card-bg);
    backdrop-filter: blur(30px) saturate(170%);
    -webkit-backdrop-filter: blur(30px) saturate(170%);
    border: 1px solid var(--login-card-border);
    border-radius: 28px;
    padding: clamp(28px, 4vw, 36px) clamp(22px, 4vw, 32px);
    box-shadow: var(--login-card-shadow);
    text-align: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-card:hover {
    border-color: rgba(14, 165, 233, 0.42);
    box-shadow: 0 32px 80px -15px rgba(14, 165, 233, 0.24);
}

/* Brand Badge */
.login-brand-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    margin: 0 auto 12px;
}

.login-logo-aura {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.5) 0%, rgba(99, 102, 241, 0.2) 60%, transparent 75%);
    filter: blur(12px);
    animation: navAuraPulse 2s infinite ease-in-out alternate;
}

.login-logo-img {
    position: relative;
    z-index: 2;
    width: 52px;
    height: 52px;
    object-fit: contain;
    filter: drop-shadow(0 0 16px rgba(14, 165, 233, 0.5));
}

/* Security Pill */
.login-security-tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.28);
    border-radius: 999px;
    color: #0284c7;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
}

[data-theme="dark"] .login-security-tag {
    color: #38bdf8;
    background: rgba(14, 165, 233, 0.16);
    border-color: rgba(56, 189, 248, 0.3);
}

/* Mode Switcher Tabs with Sliding Indicator Animation */
.auth-mode-switcher {
    position: relative;
    display: flex;
    padding: 4px;
    background: var(--auth-switcher-bg);
    border: 1px solid var(--auth-switcher-border);
    border-radius: 16px;
    margin-bottom: 20px;
}

.auth-switcher-slider {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    background: var(--auth-slider-bg);
    border-radius: 12px;
    box-shadow: var(--auth-tab-shadow);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
    pointer-events: none;
}

.auth-mode-switcher.signup-active .auth-switcher-slider {
    transform: translateX(100%);
}

.auth-mode-tab {
    position: relative;
    z-index: 2;
    flex: 1;
    padding: 9px 16px;
    border: none;
    background: transparent;
    font-family: var(--font-head);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--auth-tab-color);
    cursor: pointer;
    transition: color 0.24s ease;
}

.auth-mode-tab.active {
    color: var(--auth-tab-active-color);
}

/* Heading Typography */
.login-title {
    font-family: var(--font-head);
    font-size: 24px;
    font-weight: 800;
    color: var(--login-title-color);
    letter-spacing: -0.025em;
    margin: 0 0 6px;
    line-height: 1.25;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.login-subtitle {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--login-sub-color);
    margin: 0 0 20px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Single Google Button */
.btn-google-auth {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 14px;
    color: #3c4043;
    font-family: 'Google Sans', Roboto, var(--font-body);
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    box-sizing: border-box;
    margin-bottom: 16px;
}

.btn-google-auth:hover {
    background: #f8fafd;
    border-color: #c6c9ce;
    box-shadow: 0 5px 16px rgba(66, 133, 244, 0.2);
    transform: translateY(-2px);
    color: #202124;
}

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

[data-theme="dark"] .btn-google-auth {
    background: #131b2e;
    border-color: rgba(14, 165, 233, 0.35);
    color: #f1f5f9;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .btn-google-auth:hover {
    background: #1a253c;
    border-color: #38bdf8;
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.3);
    color: #ffffff;
}

.btn-google-auth svg {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
}

/* Divider */
.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 0 16px;
    color: var(--login-sub-color);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(14, 165, 233, 0.2);
}

/* ── FORM CONTAINERS & SMOOTH TAB ANIMATION ── */
.auth-forms-viewport {
    position: relative;
    overflow: hidden;
    min-height: 280px;
    text-align: left;
}

.manual-auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.manual-auth-form.form-hidden {
    display: none;
    opacity: 0;
    transform: translateX(25px);
    pointer-events: none;
}

.manual-auth-form.form-visible {
    display: flex;
    opacity: 1;
    transform: translateX(0);
    animation: formSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-group label {
    font-family: var(--font-head);
    font-size: 12px;
    font-weight: 700;
    color: var(--login-title-color);
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    font-size: 14px;
    color: var(--login-sub-color);
    pointer-events: none;
    transition: color 0.2s ease;
}

.auth-input {
    width: 100%;
    padding: 10px 42px 10px 38px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    font-size: 13.5px;
    color: var(--input-color);
    font-family: var(--font-body);
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.auth-input:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.auth-input:focus + .input-icon,
.input-wrap:focus-within .input-icon {
    color: #0284c7;
}

[data-theme="dark"] .input-wrap:focus-within .input-icon {
    color: #38bdf8;
}

.btn-toggle-pwd {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--login-sub-color);
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.btn-toggle-pwd:hover {
    color: var(--login-title-color);
}

/* ── CAPTCHA CARD ── */
.captcha-card {
    background: var(--captcha-bg);
    border: 1px solid var(--captcha-border);
    border-radius: 14px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.captcha-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.captcha-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--login-sub-color);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.captcha-label i {
    color: #0284c7;
}

[data-theme="dark"] .captcha-label i {
    color: #38bdf8;
}

.btn-refresh-captcha {
    background: none;
    border: none;
    color: var(--login-sub-color);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.btn-refresh-captcha:hover {
    color: #0284c7;
    background: rgba(14, 165, 233, 0.1);
}

[data-theme="dark"] .btn-refresh-captcha:hover {
    color: #38bdf8;
}

.btn-refresh-captcha.spinning i {
    animation: captchaSpin 0.5s ease-in-out;
}

@keyframes captchaSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.captcha-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.captcha-canvas {
    border-radius: 8px;
    border: 1px solid rgba(14, 165, 233, 0.3);
    background: #f8fafc;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.captcha-canvas:hover {
    border-color: #0284c7;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2), inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .captcha-canvas {
    background: #0b1329;
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .captcha-canvas:hover {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25), inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

.captcha-input {
    flex: 1;
    height: 38px;
    padding: 0 12px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--input-color);
    font-family: monospace;
    box-sizing: border-box;
    outline: none;
    transition: all 0.2s ease;
}

.captcha-input:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.captcha-input.input-shake {
    animation: inputShake 0.4s ease;
    border-color: #ef4444 !important;
}

@keyframes inputShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* Submit Button */
.btn-submit-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(2, 132, 199, 0.35);
    transition: all 0.2s ease;
    margin-top: 4px;
}

.btn-submit-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(2, 132, 199, 0.5);
    background: linear-gradient(135deg, #0369a1, #0284c7);
}

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

/* User Profile State Card (Logged In View) */
.user-profile-view {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: fadeInSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-profile-view.active {
    display: flex;
}

.user-avatar-wrap {
    position: relative;
    width: 84px;
    height: 84px;
    margin: 4px auto 4px;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #38bdf8;
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.35);
}

.user-avatar-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
    border: 3px solid #38bdf8;
}

.user-online-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: #10b981;
    border: 3px solid var(--login-card-bg);
    border-radius: 50%;
}

.user-name {
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 700;
    color: var(--login-title-color);
    margin: 0;
}

.user-email-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.22);
    border-radius: 999px;
    font-size: 13px;
    color: var(--login-sub-color);
}

.user-verified-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #10b981;
}

.user-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
}

.btn-nav-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(2, 132, 199, 0.35);
    transition: all 0.2s ease;
}

.btn-nav-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(2, 132, 199, 0.5);
    color: #ffffff;
}

.btn-sign-out {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 12px;
    color: #ef4444;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sign-out:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: #ef4444;
    transform: translateY(-1px);
}

/* Card Footer Terms */
.login-footer-terms {
    margin-top: 22px;
    font-size: 12px;
    color: var(--login-sub-color);
    line-height: 1.5;
}

.login-footer-terms a {
    color: #0284c7;
    text-decoration: none;
    font-weight: 600;
}

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

[data-theme="dark"] .login-footer-terms a {
    color: #38bdf8;
}

/* Toast Notification */
.auth-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #0f172a;
    color: #ffffff;
    border: 1px solid rgba(14, 165, 233, 0.4);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
    border-radius: 999px;
    padding: 12px 24px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    z-index: 999999;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.auth-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.auth-toast i {
    color: #38bdf8;
}
