/* ========== AUTH MODAL - FUTURISTIC GLOW (Neo-Brutalist Deep Space) ========== */

/* Overlay - Totally Transparent (No darkening) */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    /* User requested FULL transparency */
    background: transparent;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    /* Allow clicks to pass through to the page behind */
    pointer-events: none;
}

.auth-modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* Modal - Floating, frameless feel */
/* Modal - Floating, frameless feel */
/* Modal - Floating, frameless feel */
.auth-modal {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: rgba(3, 7, 18, 0);
    border: 1px solid rgba(255, 255, 255, 0);
    border-radius: 0;
    padding: 48px;
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    box-shadow: none;

    /* Enable interaction on the modal itself */
    pointer-events: auto;

    /* EXIT TRANSITION (When closing) */
    /* Background/Border vanish slowly */
    transition:
        background 0.5s ease 0.6s,
        border-color 0.5s ease 0.6s,
        box-shadow 0.5s ease 0.6s,
        height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    /* Start height animation immediately */

    /* Ensure height animation works */
    overflow: hidden;
}

.auth-modal-overlay.active .auth-modal {
    background: #030712;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 1), 0 30px 60px rgba(0, 0, 0, 0.8);

    /* ENTER TRANSITION (When opening) */
    /* Wait for brackets (0.6s) */
    transition:
        background 0.6s ease 0.6s,
        border-color 0.6s ease 0.6s,
        box-shadow 0.6s ease 0.6s,
        height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Turnstile Space Reservation (Prevents jump) */
.cf-turnstile {
    min-height: 65px;
    margin-top: 16px;
    display: flex;
    justify-content: center;
}

/* STRONG HIDING: Target EVERYTHING inside */
.auth-modal .modal-close,
.auth-modal .auth-modal-header,
.auth-modal .tab-switcher,
.auth-modal .auth-view,
.auth-modal .form-group,
.auth-modal .form-input,
.auth-modal .btn-submit,
.auth-modal .form-footer,
.auth-modal .cf-turnstile,
.auth-modal .auth-divider,
.auth-modal .social-buttons {
    opacity: 0 !important;
    transform: scale(0.95);

    /* EXIT TRANSITION: Vanish IMMEDIATELY */
    transition: opacity 0.3s ease 0s, transform 0.3s ease 0s;
}

.auth-modal-overlay.active .modal-close,
.auth-modal-overlay.active .auth-modal-header,
.auth-modal-overlay.active .tab-switcher,
.auth-modal-overlay.active .auth-view,
.auth-modal-overlay.active .form-group,
.auth-modal-overlay.active .form-input,
.auth-modal-overlay.active .btn-submit,
.auth-modal-overlay.active .form-footer,
.auth-modal-overlay.active .cf-turnstile,
.auth-modal-overlay.active .auth-divider,
.auth-modal-overlay.active .social-buttons {
    opacity: 1 !important;
    transform: scale(1);

    /* ENTER TRANSITION: Appear AFTER delay */
    transition: opacity 0.8s ease 0.6s, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.6s;
}

/* Neon accents - EXPANDING CORNERS ANIMATION */
.auth-modal::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-top: 2px solid #06b6d4;
    border-left: 2px solid #06b6d4;
    pointer-events: none;

    /* Start position: Center */
    top: 50%;
    left: 50%;
    opacity: 0;

    /* EXIT TRANSITION: Collapse AFTER content is gone (0.4s delay) */
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.4s;
    z-index: 10;
    /* Ensure on top */
}

.auth-modal-overlay.active .auth-modal::before {
    /* End position: Top Left Corner (Inside border to avoid clip) */
    top: 0;
    left: 0;
    opacity: 1;

    /* ENTER TRANSITION: Expand SLOWLY (1.6s) */
    transition: all 1.6s cubic-bezier(0.16, 1, 0.3, 1) 0s;
}

.auth-modal::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-bottom: 2px solid #06b6d4;
    border-right: 2px solid #06b6d4;
    pointer-events: none;

    /* Start position: Center */
    bottom: 50%;
    right: 50%;
    opacity: 0;

    /* EXIT TRANSITION: Collapse AFTER content is gone (0.4s delay) */
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.4s;
    z-index: 10;
    /* Ensure on top */
}

.auth-modal-overlay.active .auth-modal::after {
    /* End position: Bottom Right Corner (Inside border) */
    bottom: 0;
    right: 0;
    opacity: 1;

    /* ENTER TRANSITION: Expand SLOWLY (1.6s) */
    transition: all 1.6s cubic-bezier(0.16, 1, 0.3, 1) 0s;
}

.auth-modal-overlay.active .auth-modal {
    transform: translateY(0);
}

/* Close Button - Minimal cross */
.modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: transparent;
    border: none;
    color: #475569;
    cursor: pointer;
    padding: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    color: #f8fafc;
    transform: rotate(90deg);
}

/* Header */
.auth-modal-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0;
    letter-spacing: -0.03em;
    color: #f8fafc;
}

.auth-logo span {
    color: #06b6d4;
}

/* Tabs - Minimal text only */
.tab-switcher {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 16px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 0.9rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
    position: relative;
}

.tab-btn:hover {
    color: #cbd5e1;
}

.tab-btn.active {
    color: #06b6d4;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -17px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 1px;
    background: #06b6d4;
    box-shadow: 0 0 10px #06b6d4;
}

/* Forms */
.form-group {
    margin-bottom: 0;
    /* Use padding for spacing to fix animation measurement */
    padding-bottom: 32px;
    /* More space for floating labels */
    position: relative;
}

.form-label {
    position: absolute;
    top: -10px;
    left: 12px;
    background: #030712;
    /* Matches modal bg to hide border behind it */
    padding: 0 8px;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    pointer-events: none;
    transition: all 0.2s;
    z-index: 10;
}

.form-input:focus~.form-label,
.form-input:not(:placeholder-shown)~.form-label {
    color: #06b6d4;
    top: -10px;
}

.form-input {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0;
    padding: 16px;
    color: #fff;
    font-family: 'Space Mono', monospace;
    /* Tech feel */
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.5;
}

.form-input.has-toggle {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 28px;
    /* Perfectly centered (56px input height / 2) */
    transform: translateY(-50%);
    color: #64748b;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
    transition: color 0.2s;
    z-index: 20;
    /* Above input */
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: #fff;
}

.form-input:focus {
    outline: none;
    border-color: #06b6d4;
    box-shadow: inset 0 0 20px rgba(6, 182, 212, 0.1);
    background: rgba(6, 182, 212, 0.02);
}

.form-input::placeholder {
    color: transparent;
    /* Force hide placeholder so label logic works */
}

/* Fix Autofill Background */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus,
.form-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #030712 inset !important;
    -webkit-text-fill-color: white !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Button - Outline Tech */
.btn-submit {
    width: 100%;
    background: #06b6d4;
    color: #000;
    border: none;
    border-radius: 0;
    padding: 16px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 32px;
}

.btn-submit:hover {
    background: #22d3ee;
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.4);
    transform: translateY(-1px);
}

/* Footer links */
.form-footer {
    margin-top: 32px;
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
    font-family: 'Space Grotesk', sans-serif;
}

.form-footer a {
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    transition: border-color 0.2s;
}

.form-footer a:hover {
    border-color: #06b6d4;
    color: #06b6d4;
}

/* Security Note REMOVED */

/* Alerts */
.alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 12px;
    font-size: 0.85rem;
    margin-bottom: 24px;
    display: none;
    font-family: 'Space Mono', monospace;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: #22c55e;
    color: #22c55e;
}

/* Views */
.auth-view {
    display: none;
}

.auth-view.active {
    display: block;
    animation: glitch-in 0.2s ease forwards;
}

@keyframes glitch-in {
    0% {
        opacity: 0;
        transform: translateX(-10px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive */
/* Responsive */
/* Responsive */
@media (max-width: 480px) {
    .auth-modal-overlay {
        display: grid;
        place-items: center;
        overflow-y: auto;
        /* Scroll the page container */
        padding: 24px 0;
        /* Vertical breathing room */
    }

    .auth-modal {
        width: 92%;
        padding: 24px !important;
        margin: auto;
        max-height: none;
        /* Let it grow naturally */
        overflow: visible;
        /* CRITICAL: Keep corners attached */
    }

    .auth-logo {
        font-size: 1.5rem !important;
    }

    .tab-btn {
        padding: 10px 0;
        font-size: 0.9rem;
    }

    .btn-social {
        font-size: 0.8rem;
    }
}

/* Landscape Mobile Fix */
@media (max-height: 600px) {
    .auth-modal-overlay {
        display: block;
        /* Allow block flow for scrolling */
        overflow-y: auto;
        text-align: center;
    }

    .auth-modal {
        margin: 20px auto;
        padding: 20px !important;
    }
}

/* UTILITY: Hard Reset Animation */
.auth-modal.no-transition,
.auth-modal.no-transition *,
.auth-modal.no-transition::before,
.auth-modal.no-transition::after {
    transition: none !important;
    animation: none !important;
}

/* Social Login */
.auth-divider {
    margin: 20px 0 16px 0;
    /* Reduced margins */
    text-align: center;
    position: relative;
    user-select: none;
}

.auth-divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.auth-divider span {
    background: #030712;
    padding: 0 12px;
    color: #64748b;
    font-size: 0.75rem;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.social-buttons {
    display: flex;
    flex-direction: row;
    /* Horizontal layout */
    gap: 12px;
    margin-bottom: 24px;
}

.btn-social {
    flex: 1;
    /* Equal width */
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 10px;
    /* Slightly compact */
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* Closer icons */
    transition: all 0.2s;
}

.btn-social:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.btn-social svg {
    width: 20px;
    height: 20px;
}