/* ==========================================================================
   SecurityInBuilt - V2 Ultra Premium Core Stylesheet
   Theme: Hybrid Glassmorphism + Neumorphism
   ========================================================================== */

/* --- CSS Variables for Light & Dark Mode --- */
:root {
    /* Light Mode Tokens */
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-glass: rgba(255, 255, 255, 0.7);
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-accent: #0284c7;
    
    --border-glass: rgba(15, 23, 42, 0.05);
    
    --neu-shadow-inset: inset 2px 2px 5px rgba(0,0,0,0.05), inset -2px -2px 5px rgba(255,255,255, 1);
    --neu-shadow-outset: 10px 10px 20px rgba(0,0,0,0.05), -10px -10px 20px rgba(255,255,255, 1);
    --glow-shadow: 0 10px 25px rgba(2, 132, 199, 0.15);

    --cursor-color: rgba(2, 132, 199, 0.15);
    
    --nav-height: 80px;
    --border-radius: 16px;
    --font-display: 'Sora', sans-serif;
    --font-sans: 'Inter', sans-serif;
}

[data-theme="dark"] {
    /* Dark Mode Tokens */
    --bg-base: #050b14;
    --bg-surface: #0a1324;
    --bg-surface-glass: rgba(10, 19, 36, 0.3);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-accent: #38bdf8;
    
    --border-glass: rgba(56, 189, 248, 0.1);
    
    --neu-shadow-inset: inset 2px 2px 5px rgba(0,0,0,0.6), inset -2px -2px 5px rgba(255,255,255, 0.05);
    --neu-shadow-outset: 5px 5px 15px rgba(0,0,0,0.6), -5px -5px 15px rgba(255,255,255, 0.02);
    --glow-shadow: 0 0 30px rgba(56, 189, 248, 0.25);

    --cursor-color: rgba(56, 189, 248, 0.15);
}

/* Default to dark if system prefers dark and no theme set */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-base: #050b14;
        --bg-surface: #0a1324;
        --bg-surface-glass: rgba(10, 19, 36, 0.3);
        --text-primary: #f8fafc;
        --text-secondary: #94a3b8;
        --text-accent: #38bdf8;
        --border-glass: rgba(56, 189, 248, 0.1);
        --neu-shadow-inset: inset 2px 2px 5px rgba(0,0,0,0.6), inset -2px -2px 5px rgba(255,255,255, 0.05);
        --neu-shadow-outset: 5px 5px 15px rgba(0,0,0,0.6), -5px -5px 15px rgba(255,255,255, 0.02);
        --glow-shadow: 0 0 30px rgba(56, 189, 248, 0.25);
        --cursor-color: rgba(56, 189, 248, 0.15);
    }
}

/* --- Global Resets & Typography --- */
html, body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    scroll-behavior: smooth;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

h1, h2, h3, h4, h5, h6, .display-font {
    font-family: var(--font-display);
    line-height: 1.2;
}

/* Texture Overlay */
.noise-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Custom Cursor */
.custom-cursor {
    position: fixed;
    top: 0; left: 0;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--cursor-color) 0%, transparent 60%);
    pointer-events: none;
    transform: translate3d(-50%, -50%, 0);
    z-index: 1; /* Below content */
    transition: width 0.3s, height 0.3s, background 0.3s;
    will-change: transform;
}

/* Pre-loader */
#preloader {
    position: fixed;
    inset: 0;
    background: var(--bg-base);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s;
    animation: forceHideLoader 0.3s ease 0.5s forwards;
}

@keyframes forceHideLoader {
    to { opacity: 0; visibility: hidden; pointer-events: none; }
}

/* Failsafe for GS-Reveal: If JS fails or is blocked, show content after a delay */
.gs-reveal {
    transition: opacity 0.8s ease, transform 0.8s ease;
}

[data-theme="light"] .gs-reveal {
    /* Ensure visible by default if JS doesn't explicitly hide it */
    opacity: 1;
}
.loader-scanline {
    width: 2px;
    height: 120px;
    background: var(--text-accent);
    box-shadow: 0 0 20px var(--text-accent);
    animation: scan 1.2s infinite ease-in-out alternate;
    margin-bottom: 2rem;
}
@keyframes scan {
    0% { transform: translateY(-30px) scaleY(1); opacity: 0.5; }
    100% { transform: translateY(30px) scaleY(1.5); opacity: 1; }
}

/* --- Layout Components --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Glassmorphism + Neumorphism Components --- */
.glass-panel {
    background: var(--bg-surface-glass);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    box-shadow: var(--neu-shadow-outset);
    border-radius: var(--border-radius);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.4s ease, border-color 0.4s ease;
    will-change: transform, box-shadow;
}

.glass-panel:hover {
    box-shadow: var(--glow-shadow), var(--neu-shadow-outset);
    transform: translateY(-5px);
    border-color: rgba(56, 189, 248, 0.4);
}

/* Animation Delays */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }
.delay-500 { transition-delay: 500ms; }

.pwd-strength-bar-init {
    width: 0%;
    background: #ef4444;
}

/* Reusable Button */
.btn-glow {
    position: relative;
    display: inline-block;
    padding: 1rem 2rem;
    font-family: var(--font-display);
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    box-shadow: var(--neu-shadow-outset);
    border-radius: 8px;
    transition: all 0.3s ease;
    overflow: hidden;
    text-decoration: none;
}

.btn-glow.primary {
    color: var(--text-accent);
}

.btn-glow::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
}

.btn-glow:hover {
    box-shadow: var(--glow-shadow), var(--neu-shadow-inset);
    transform: translateY(-2px);
    color: var(--text-accent);
}

.btn-glow:hover::before {
    left: 100%;
}

.gradient-text {
    background: linear-gradient(135deg, var(--text-accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

/* Navbar Theme Toggle */
.theme-toggle {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    box-shadow: var(--neu-shadow-outset);
    border-radius: 50%;
    width: 44px; height: 44px;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
}
.theme-toggle:hover {
    box-shadow: var(--neu-shadow-inset);
    color: var(--text-accent);
}

/* WebGL Container */
#webgl-hero-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Ensure content sits above WebGL and cursor */
.z-content {
    position: relative;
    z-index: 10;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-accent);
}

/* Legacy Support (Keeping core classes intact for other pages temporarily) */
.navbar {
    height: var(--nav-height);
    display: flex;
    align-items: center;
    position: fixed;
    top: 0; left: 0; width: 100%;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid transparent;
}

.navbar.scrolled {
    background: var(--bg-surface-glass);
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    height: 70px;
    border-bottom: 1px solid var(--border-glass);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.nav-container {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
}

.logo-text { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; }

.nav-item {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: relative;
    text-decoration: none;
}

.nav-item:hover {
    color: var(--text-accent);
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--text-accent);
    transition: width 0.3s ease;
}

.nav-item:hover::after {
    width: 100%;
}

.section-padding { padding: 8rem 0; }
.section-title { font-size: 2.5rem; margin-bottom: 1rem; text-align: center; }
.section-desc { color: var(--text-secondary); font-size: 1.1rem; text-align: center; max-width: 600px; margin: 0 auto 4rem; }

/* AI Scanner Animation Effect */
.ai-scan-effect {
    position: relative;
    overflow: hidden;
}
.ai-scan-effect::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 50px;
    background: linear-gradient(to bottom, transparent, rgba(56, 189, 248, 0.4), transparent);
    transform: rotate(45deg);
    animation: aiScan 4s infinite linear;
    pointer-events: none;
}
@keyframes aiScan {
    0% { top: -100%; }
    100% { top: 200%; }
}

@media (max-width: 768px) {
    .nav-links:not(.mobile-menu-overlay) { display: none; }
    
    .menu-btn {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 20px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 2001;
    }

    .menu-btn span {
        width: 100%;
        height: 2px;
        background-color: var(--text-primary);
        transition: all 0.3s ease;
    }

    .mobile-menu-overlay a {
        position: relative;
        overflow: hidden;
    }
}

/* --- V3 Platform Upgrades --- */

/* Risk Analyzer UI */
.risk-btn {
    padding: 1rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.risk-btn.active {
    background: var(--text-accent);
    color: white;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
    border-color: var(--text-accent);
}

/* Video Hybrid Layer */
.video-hybrid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    opacity: 0.1;
    pointer-events: none;
    mix-blend-mode: overlay;
}

#bg-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%) contrast(150%);
}

/* Section Transitions */
.gs-reveal {
    opacity: 0;
}

/* Scan Line Animation */
.ai-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--text-accent), transparent);
    animation: storyScan 3s linear infinite;
    z-index: 5;
    opacity: 0.5;
}

@keyframes storyScan {
    0% { top: 0; }
    100% { top: 100%; }
}

/* Glow Utilities */
.glow-text-red {
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.glow-text-cyan {
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

/* --- RADAR SCANNER --- */
.radar-container {
    background: radial-gradient(circle, rgba(0,255,242,0.05) 0%, rgba(0,0,0,0.8) 100%);
    box-shadow: 0 0 50px rgba(0,255,242,0.1);
}

.radar-line {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50%;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--text-accent));
    transform-origin: left center;
    animation: radar-sweep 4s linear infinite;
    z-index: 5;
}

.radar-circles .circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(0,255,242,0.1);
    border-radius: 50%;
}

.radar-circles .circle:nth-child(1) { width: 30%; height: 30%; }
.radar-circles .circle:nth-child(2) { width: 60%; height: 60%; }
.radar-circles .circle:nth-child(3) { width: 90%; height: 90%; }

.threat-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #ff3e3e;
    border-radius: 50%;
    box-shadow: 0 0 10px #ff3e3e;
    animation: pulse-red 2s infinite;
}

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

@keyframes pulse-red {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(3); opacity: 0; }
}

/* --- GLITCH EFFECT --- */
.glitch {
    position: relative;
    display: inline-block;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #00fff2;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(31px, 9999px, 94px, 0); }
    20% { clip: rect(62px, 9999px, 42px, 0); }
    40% { clip: rect(16px, 9999px, 78px, 0); }
    60% { clip: rect(89px, 9999px, 23px, 0); }
    80% { clip: rect(54px, 9999px, 67px, 0); }
    100% { clip: rect(43px, 9999px, 11px, 0); }
}

@keyframes glitch-anim2 {
    0% { clip: rect(65px, 9999px, 12px, 0); }
    20% { clip: rect(23px, 9999px, 87px, 0); }
    40% { clip: rect(98px, 9999px, 34px, 0); }
    60% { clip: rect(12px, 9999px, 56px, 0); }
    80% { clip: rect(45px, 9999px, 90px, 0); }
    100% { clip: rect(76px, 9999px, 21px, 0); }
}

/* --- POPUP VISIBILITY --- */
.popup-active {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* --- TABLE ENHANCEMENTS --- */
table th, table td {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

tr:hover td {
    background: rgba(0,255,242,0.02);
}

/* --- BENTO GRID & PREMIUM UI --- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: auto;
    }
    .bento-item-large {
        grid-column: span 2;
        grid-row: span 2;
    }
}

.magnetic-wrap {
    display: inline-block;
    position: relative;
}

/* Card Glow Effect */
.tilt-card {
    position: relative;
}

.tilt-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(800px circle at var(--mouse-x) var(--mouse-y), rgba(56, 189, 248, 0.15), transparent 40%);
    border-radius: inherit;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.tilt-card:hover::before {
    opacity: 1;
}

.tilt-card > * {
    position: relative;
    z-index: 2;
}
