/* 
 * Login 3D & Glassmorphism Theme 
 * Designed for visual depth and modern aesthetics
 */

/* =========================================
   1. Global & Background Layer
   ========================================= */
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    transition: background 0.5s ease;
}

/* Background Layer Container */
.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    transition: background 0.5s ease;
}

/* 
 * Light Mode (Aurora Lab) 
 * Background: Clear, high-key, energetic
 */
body:not(.night-mode) .bg-layer {
    background: #f8fafc; /* Very light cool grey base */
}

/* Aurora Lab Fluid Spheres Container */
.aurora-container {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

body:not(.night-mode) .aurora-container {
    display: block;
}

.aurora-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.8;
    mix-blend-mode: multiply;
    animation: aurora-float 20s infinite alternate;
}

/* 1. Lavender Blob */
.aurora-blob-1 {
    top: 10%;
    left: 20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #e0c3fc 0%, #8ec5fc 100%);
    animation-delay: 0s;
}

/* 2. Mint Blob */
.aurora-blob-2 {
    bottom: 10%;
    right: 10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #a1ffce 0%, #faffd1 100%);
    animation-delay: -5s;
}

/* 3. Lemon Blob */
.aurora-blob-3 {
    top: 40%;
    left: 40%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #f6d365 0%, #fda085 100%);
    animation-delay: -10s;
}

@keyframes aurora-float {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

/* 
 * Dark Mode (Cyber Neon) 
 * Background: Deep Radial Gradient (#0A0E17 -> #050505)
 */
body.night-mode .bg-layer {
    background: radial-gradient(circle at center, #0A0E17 0%, #050505 100%);
}


/* =========================================
   2. 3D Art Installations (CSS Only)
   ========================================= */

/* Container for 3D elements - Expanded to cover more screen area */
.art-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw; /* Full width */
    height: 100vh; /* Full height */
    perspective: 1200px;
    pointer-events: none;
    overflow: hidden;
}

/* 
 * Dark Mode Object: Neon Geometric Crystals (Cyber Deep)
 * Scaled UP and positioned to be visible around the card
 */
.neon-crystal {
    display: none;
    width: 800px; /* Much larger */
    height: 800px;
    position: absolute;
    top: 50%;
    left: 50%;
    /* No translate here, we handle centering in faces to allow orbit */
    transform-style: preserve-3d;
    animation: rotate-crystal 30s linear infinite; /* Slower rotation for massive object */
}

/* Constructing a Cube - Spread out to surround the center */
/* The login card is roughly 400x600. We need the crystal to orbit AROUND it. */
.crystal-face {
    position: absolute;
    width: 300px; /* Larger faces */
    height: 300px;
    background: rgba(0, 0, 0, 0.2); /* More transparent to see through */
    border: 2px solid rgba(57, 255, 20, 0.4); 
    box-shadow: 
        0 0 30px rgba(57, 255, 20, 0.1),
        inset 0 0 40px rgba(57, 255, 20, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    backface-visibility: visible;
    /* Center the face within the 800x800 container before transform */
    left: 250px; 
    top: 250px;
}

/* Push faces further out (translateZ) to clear the login card space */
.face-front  { transform: translateZ(400px); }
.face-back   { transform: rotateY(180deg) translateZ(400px); }
.face-right  { transform: rotateY(90deg) translateZ(400px); }
.face-left   { transform: rotateY(-90deg) translateZ(400px); }
.face-top    { transform: rotateX(90deg) translateZ(400px); }
.face-bottom { transform: rotateX(-90deg) translateZ(400px); }

/* Core Glow Pulse - Massive Ambient Light */
.crystal-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px; /* Huge glow */
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 255, 242, 0.15) 0%, rgba(168, 85, 247, 0.05) 60%, transparent 80%);
    filter: blur(60px);
    opacity: 1;
    animation: pulse-core 6s ease-in-out infinite;
    mix-blend-mode: screen;
    z-index: -1; /* Behind everything */
}

/* Pulse Waves - Expanding to edges */
.crystal-core::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    border-radius: 50%;
    border: 1px solid rgba(168, 85, 247, 0.2);
    opacity: 0;
    animation: pulse-wave 6s linear infinite;
}

@keyframes pulse-wave {
    0% { transform: scale(0.5); opacity: 0; }
    50% { opacity: 0.5; }
    100% { transform: scale(1.5); opacity: 0; }
}

body.night-mode .neon-crystal {
    display: block;
}

@keyframes rotate-crystal {
    0% { transform: rotateX(0deg) rotateY(0deg); }
    100% { transform: rotateX(360deg) rotateY(360deg); }
}

@keyframes pulse-core {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
}


/* =========================================
   3. UI Layer: Glassmorphism Login Card
   ========================================= */
.login-card {
    width: 400px;
    padding: 40px;
    border-radius: 24px;
    position: relative;
    z-index: 10;
    transition: all 0.3s ease;

    /* Glassmorphism Core */
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);

    /* 3D Border Light */
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* 
 * Light Mode Card Details (Float Glass)
 */
body:not(.night-mode) .login-card {
    background: rgba(255, 255, 255, 0.4); /* More transparent */
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.8);
    border-left: 1px solid rgba(255, 255, 255, 0.8);
    color: #334155; /* Dark grey text */
    
    /* Stronger Blur for "Thick Glass" effect */
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    
    /* Glass Edge & Shadow */
    box-shadow: 
        0 8px 32px 0 rgba(31, 38, 135, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

/* Dark Mode Card Details (Cyber Deep) */
body.night-mode .login-card {
    background: rgba(0, 0, 0, 0.6); /* Darker, more opaque */
    
    /* Neon Border Gradient (Simulated with pseudo-element to be 1px thin) */
    position: relative;
    border: none;
    box-shadow: 
        0 0 40px rgba(0, 0, 0, 0.8),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden; /* Ensure border stays within radius */
}

/* Thin Neon Border Layer */
body.night-mode .login-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px; 
    padding: 1px; /* The border thickness */
    background: linear-gradient(135deg, #00fff2 0%, #39FF14 50%, #a855f7 100%); 
    -webkit-mask: 
       linear-gradient(#fff 0 0) content-box, 
       linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude; 
    pointer-events: none;
    z-index: 1;
}

/* Ensure text is readable */
body.night-mode .login-card {
    color: #e2e8f0;
}
body.night-mode .brand-logo {
    /* Cyber Text Gradient */
    background: linear-gradient(to right, #00fff2, #39FF14);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
}
body.night-mode .brand-subtitle {
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.75rem;
}


/* =========================================
   4. Input Fields (3D Inset)
   ========================================= */
.login-card .form-control {
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: transparent; /* Let the glass show through or use subtle fill */
}

/* Light Mode Input */
body:not(.night-mode) .login-card .form-control {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: #334155;
    /* Inset Shadow for "Recessed" look */
    box-shadow: 
        inset 2px 2px 5px rgba(166, 180, 200, 0.2), 
        inset -2px -2px 5px rgba(255, 255, 255, 0.8);
}
body:not(.night-mode) .login-card .form-control:focus {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 
        inset 1px 1px 2px rgba(166, 180, 200, 0.2), 
        0 0 0 3px rgba(66, 153, 225, 0.3);
    border-color: #4299e1;
}

/* Dark Mode Input */
body.night-mode .login-card .form-control {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    /* Inset Shadow */
    box-shadow: 
        inset 2px 2px 6px rgba(0, 0, 0, 0.6), 
        inset -1px -1px 2px rgba(255, 255, 255, 0.05);
}
body.night-mode .login-card .form-control:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: #8b5cf6;
    box-shadow: 
        inset 2px 2px 6px rgba(0, 0, 0, 0.8), 
        0 0 0 3px rgba(139, 92, 246, 0.3);
}

/* Placeholder colors */
body:not(.night-mode) .login-card .form-control::placeholder { color: #94a3b8; }
body.night-mode .login-card .form-control::placeholder { color: #64748b; }


/* =========================================
   5. Buttons (3D & Glow)
   ========================================= */
.btn-login {
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Active State Animation (Press) */
.btn-login:active {
    transform: scale(0.95);
}

/* Light Mode: Klein Blue Button */
body:not(.night-mode) .btn-login {
    background: #002FA7; /* Pure Klein Blue */
    color: #ffffff;
    box-shadow: 
        0 10px 20px -5px rgba(0, 47, 167, 0.4),
        0 4px 6px -2px rgba(0, 47, 167, 0.2);
}
body:not(.night-mode) .btn-login:hover {
    background: #002585;
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(0, 47, 167, 0.5);
}
body:not(.night-mode) .btn-login:active {
    transform: scale(0.98) translateY(0);
}

/* Dark Mode: Lime Neon (#39FF14) Button */
body.night-mode .btn-login {
    background: #39FF14;
    color: #000;
    font-weight: 800; /* Extra bold for impact */
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 
        0 0 20px rgba(57, 255, 20, 0.5),
        inset 0 0 10px rgba(255, 255, 255, 0.5);
    border: 1px solid #39FF14;
}
body.night-mode .btn-login:hover {
    background: #000;
    color: #39FF14;
    box-shadow: 
        0 0 30px rgba(57, 255, 20, 0.8),
        inset 0 0 20px rgba(57, 255, 20, 0.2);
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.8);
}
body.night-mode .btn-login:active {
    transform: scale(0.95);
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.4);
}


/* =========================================
   6. Decorations (Floating Spheres & Icons)
   ========================================= */
.deco-sphere {
    position: absolute;
    border-radius: 50%;
    z-index: 11; 
    pointer-events: none;
}

/* Top Left: Deep Purple Matte Sphere */
.deco-sphere.top-left {
    width: 40px;
    height: 40px;
    top: -15px;
    left: -15px;
    background: radial-gradient(circle at 30% 30%, #a855f7, #581c87);
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
}

/* Bottom Right: Bright Orange Glass Ring */
.deco-sphere.bottom-right {
    width: 50px;
    height: 50px;
    bottom: -20px;
    right: -20px;
    background: transparent;
    border: 6px solid rgba(255, 165, 0, 0.8); /* Orange */
    box-shadow: 
        0 0 10px rgba(255, 165, 0, 0.5),
        inset 0 0 10px rgba(255, 165, 0, 0.3);
    transform: rotate(45deg);
}

/* 
 * 3D Icons (Aurora Lab only)
 * Decorative floating icons for Light Mode
 */
.deco-icon-3d {
    position: absolute;
    font-size: 28px;
    z-index: 11;
    color: #6366f1; /* Indigo */
    filter: drop-shadow(0 4px 6px rgba(99, 102, 241, 0.3));
    animation: float-icon 6s ease-in-out infinite;
    background: rgba(255, 255, 255, 0.8);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.deco-icon-3d.top-right {
    top: -20px;
    right: -20px;
    animation-delay: 1s;
}

.deco-icon-3d.bottom-left {
    bottom: -20px;
    left: -20px;
    animation-delay: 2s;
}

@keyframes float-icon {
    0%, 100% { transform: translateY(0) rotate(5deg); }
    50% { transform: translateY(-10px) rotate(-5deg); }
}

/* Hide Icons in Night Mode (Cyber Deep) */
body.night-mode .deco-icon-3d {
    display: none;
}

/* Adjust text colors for visibility */
.brand-logo {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
body.night-mode .brand-logo {
    background: linear-gradient(135deg, #a78bfa 0%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(167, 139, 250, 0.3);
}

.brand-subtitle {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 2rem;
}
body.night-mode .brand-subtitle {
    color: #94a3b8;
}

/* 
 * 7. Dynamic Input Field Glow (Streamer Effect)
 */
.input-group.custom-input-group {
    position: relative;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.3); /* Static border color (via padding gap) */
    padding: 2px; /* Creates the border thickness */
    transition: all 0.3s ease;
    overflow: hidden; 
    z-index: 1;
    display: flex; /* Ensure flex layout for children */
}

/* Streamer Layer (Behind content, in the padding area) */
.input-group.custom-input-group::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg, 
        transparent 0%, 
        transparent 70%, 
        #002FA7 85%, /* Tail start */
        #60a5fa 95%, /* Highlight */
        transparent 100%
    );
    top: -50%;
    left: -50%;
    z-index: 0;
    transform-origin: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* Activate streamer on hover/focus */
.input-group.custom-input-group:hover::before,
.input-group.custom-input-group:focus-within::before {
    opacity: 1;
    animation: rotate-border 3s linear infinite;
}

/* Inner Content (Inputs) Styling */
.input-group.custom-input-group .form-control,
.input-group.custom-input-group .input-group-text {
    background: rgba(255, 255, 255, 0.6); /* Glass Body */
    border: none; /* Remove individual borders */
    color: #334155;
    z-index: 2; /* Sit above the streamer */
    position: relative;
    height: auto; /* Let flex handle height */
}

/* Icon specific */
.input-group.custom-input-group .input-group-text {
    border-radius: 10px 0 0 10px;
    color: #002FA7;
    padding-right: 10px;
}

/* Input specific */
.input-group.custom-input-group .form-control {
    border-radius: 0 10px 10px 0;
    padding-left: 5px;
}

/* Light Mode Overrides */
body:not(.night-mode) .input-group.custom-input-group {
    background: rgba(255, 255, 255, 0.5); /* Lighter static border */
}

/* Dark Mode Overrides */
body.night-mode .input-group.custom-input-group {
    background: rgba(255, 255, 255, 0.1); /* Dark static border */
}
body.night-mode .input-group.custom-input-group .form-control,
body.night-mode .input-group.custom-input-group .input-group-text {
    background: rgba(0, 0, 0, 0.4);
    color: #e2e8f0;
}
body.night-mode .input-group.custom-input-group .input-group-text {
    color: #a78bfa;
}
body.night-mode .input-group.custom-input-group::before {
    background: conic-gradient(
        from 0deg, 
        transparent 0%, 
        transparent 70%, 
        #39FF14 85%, 
        #a1ffce 95%, 
        transparent 100%
    );
}

@keyframes rotate-border {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Remove old masking ::after as we use padding approach now */
.input-group.custom-input-group::after {
    display: none;
}

/* 
 * 8. 3D Checkbox Cube 
 */
.checkbox-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Hide default bootstrap checkbox to use our custom cube */
.form-check-input.cube-input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
    appearance: none; /* Force remove default appearance */
    -webkit-appearance: none;
    pointer-events: none; /* Let clicks pass through to label */
}

/* Ensure label wrapper handles clicks */
.checkbox-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.cube-visual {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.cube-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(0, 47, 167, 0.5);
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    backface-visibility: hidden;
}

/* Front Face (Unchecked) */
.cube-face.front {
    transform: translateZ(8px);
}

/* Back Face (Checked) */
.cube-face.back {
    transform: rotateY(180deg) translateZ(8px);
    background: #002FA7;
    border-color: #002FA7;
    color: white;
    box-shadow: 0 0 10px rgba(0, 47, 167, 0.6);
}

/* Dark Mode Cube */
body.night-mode .cube-face {
    border-color: rgba(57, 255, 20, 0.5);
    background: rgba(0, 0, 0, 0.5);
}
body.night-mode .cube-face.back {
    background: #39FF14;
    border-color: #39FF14;
    color: black;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.6);
}

/* Checkbox handling */
.checkbox-wrapper input:checked ~ .cube-visual {
    transform: rotateY(180deg);
}
.checkbox-wrapper {
    cursor: pointer;
}

/* Link colors */
.login-card a {
    color: #6366f1;
    transition: color 0.2s;
}
body.night-mode .login-card a {
    color: #a78bfa;
}
.login-card a:hover {
    color: #4f46e5;
    text-decoration: underline;
}
body.night-mode .login-card a:hover {
    color: #c4b5fd;
}


/* Glass Effect for Modals */
.glass-effect {
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

body:not(.night-mode) .glass-effect {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

body.night-mode .glass-effect {
    background: rgba(20, 20, 20, 0.85);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
}
