/* ==========================================================================
   1. VARIABLES & SANITIZATION RESET
   ========================================================================== */
:root {
    --neon-green: #008751;
    --neon-pink: #ff0055;
    --text-main: #ffffff;
    --text-muted: #8fa0b5;
    --glass-card: rgba(8, 11, 9, 0.65);
    --glass-border: rgba(0, 135, 81, 0.2);
}

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

html, body {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden; /* Strict viewport lock against scroll boundaries */
    background: transparent;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    color: var(--text-main);
}

#vanta-auth-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
}

/* ==========================================================================
   2. APP WRAPPER ARCHITECTURE
   ========================================================================== */
.auth-app-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
    z-index: 5;
}

.auth-header {
    width: 100%;
    display: flex;
    justify-content: center;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.auth-logo {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 0 6px var(--neon-green));
}

.auth-brand-name {
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 5px;
    color: white;
}

/* ==========================================================================
   3. HIGH-END 3D FLIP MECHANISM DECK
   ========================================================================== */
.auth-stage-viewport {
    width: 100%;
    max-width: 440px;
    height: 480px;
    margin: 0 auto;
    perspective: 1200px; /* Crucial field depth parameter for 3D spin orbits */
}

.auth-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d; /* Force nested nodes to respect 3D rotation space */
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Flipped toggle handler execution state */
.auth-card-inner.flipped-state {
    transform: rotateY(180deg);
}

.auth-panel-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden; /* Conceptually hides the inverted rear face when flipped */
    -webkit-backface-visibility: hidden;
    background: var(--glass-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 30px 60px rgba(0,0,0,0.4);
}

.face-front {
    z-index: 2;
    transform: rotateY(0deg);
}

.face-back {
    transform: rotateY(180deg); /* Pre-rotates back card panel out of direct path view */
    border-color: rgba(255, 0, 85, 0.2);
}

/* ==========================================================================
   4. FORM ELEMENTS & MATRICES
   ========================================================================== */
.panel-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 0.35rem;
}

.face-back .panel-header h2 {
    color: var(--neon-pink);
}

.panel-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-form-matrix {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.input-glow-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.input-glow-group label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.input-glow-group input {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

/* Cyber Focus Glow Adjustments */
.input-glow-group input:focus {
    background: rgba(0, 135, 81, 0.05);
    border-color: var(--neon-green);
    box-shadow: 0 0 15px rgba(0, 135, 81, 0.25), inset 0 0 10px rgba(0, 135, 81, 0.1);
}

.face-back .input-glow-group input:focus {
    background: rgba(255, 0, 85, 0.05);
    border-color: var(--neon-pink);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.25), inset 0 0 10px rgba(255, 0, 85, 0.1);
}

.auth-action-trigger {
    width: 100%;
    padding: 0.95rem;
    background: var(--neon-green);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.auth-action-trigger:hover {
    background: #00a362;
    box-shadow: 0 0 20px rgba(0, 135, 81, 0.5);
    transform: translateY(-2px);
}

.auth-action-trigger.accent-pink {
    background: var(--neon-pink);
}

.auth-action-trigger.accent-pink:hover {
    background: #ff1a6c;
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.5);
}

/* ==========================================================================
   5. INTER PANEL SWITCH TOGGLERS
   ========================================================================== */
.panel-footer-toggle {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.toggle-link-action {
    background: none;
    border: none;
    color: var(--neon-green);
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: text-shadow 0.2s ease;
}

.face-back .toggle-link-action {
    color: var(--neon-pink);
}

.toggle-link-action:hover {
    text-shadow: 0 0 8px currentColor;
}

/* ==========================================================================
   6. UTILITY BLOCKING PRELOADER
   ========================================================================== */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #030305;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease, visibility 0.4s;
}

.loader-content {
    text-align: center;
    width: 80%;
    max-width: 400px;
}

.loader-title {
    font-size: 0.9rem;
    letter-spacing: 6px;
    color: var(--neon-green);
    margin-bottom: 1.5rem;
    text-shadow: 0 0 10px rgba(0, 135, 81, 0.4);
}

.progress-bar-container {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(to right, var(--neon-purple), var(--neon-green));
    box-shadow: 0 0 8px var(--neon-green);
}

.progress-text {
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.preloader.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ==========================================================================
   7. INTERACTIVE DEVICE BREAKPOINTS
   ========================================================================== */
@media (max-width: 480px) {
    .auth-app-container {
        padding: 1.5rem 1rem;
    }
    .auth-stage-viewport {
        height: 520px; /* Expands height boundaries slightly for mobile keyboards */
    }
    .auth-panel-face {
        padding: 1.75rem 1.25rem;
    }
}
