@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@200;300;400;500;600;700;800&family=Tajawal:wght@200;300;400;500;700;800;900&display=swap');

:root {
    /* Brand Colors */
    --primary: #84cc16;
    --primary-glow: rgba(132, 204, 22, 0.4);
    
   --bg-core: #ffffff; 
    --bg-card: #ffffff;
    --text-main: #1f2937; /* Dark Gray - replaces muddy gray */
    --text-muted: #5f6164;
    --glass-border: rgb(171, 231, 4); 
    --glass-surface: rgba(0, 0, 0, 0.02);
    --primary-glow: rgba(132, 204, 22, 0.3);
        --text-main: #111827;     /* almost black */
    --text-muted: #4b5563;   /* gray-600 */
    --text-soft: #6b7280;
    /* --- NEW FONTS --- */
    --font-en: 'Outfit', sans-serif;   /* Premium, Modern */
    --font-ar: 'Tajawal', sans-serif;  /* Clean, Professional */
    
    --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
}

/* REFINED LIGHT MODE - Pure White & Dark Gray */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-core);
    color: var(--text-main);
    /* FIX 1: Use the English variable by default instead of 'Montserrat' */
    font-family: var(--font-ar), var(--font-en), sans-serif;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* --- 2. THEME UTILITIES (Fixing the Gray Text) --- */
.bg-theme-core { background-color: var(--bg-core) !important; }
.bg-theme-card { background-color: var(--bg-card) !important; }
.text-theme-main {
    color: var(--text-main) !important;
}
.text-theme-muted {
    color: var(--text-muted) !important;
}

/* Forces Tailwind gray classes to use our Dark Gray in light mode */
body.light-mode .text-white,
body.light-mode .text-gray-300,
body.light-mode .text-gray-400,
body.light-mode .text-gray-500 { 
    color: var(--text-main) !important; 
}

/* Glowing Green for Navigation Links */
.nav-link-glow {
    color: var(--primary) !important;
    text-shadow: 0 0 10px var(--primary-glow);
    font-weight: 700;
}

/* --- 3. FIX: THE TOP BAR (NAVBAR) & GAP --- */
header#navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1.5rem;
    background: transparent !important;
}

/* Ensures video section ignores nav height to kill the bar gap */
#smooth-wrapper {
    padding-top: 0 !important;
}

#navbar .glass-panel {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transition: all 0.3s ease;
}

body.light-mode #navbar .glass-panel {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border) !important;
}

body.light-mode #navbar a, 
body.light-mode #navbar span,
body.light-mode #navbar i { color: var(--text-main) !important; }

/* --- 4. HERO VIDEO, SHADOW & BLUR --- */
.hero-video {
    filter: blur(2px) brightness(0.5); /* Added Blur + Shadow brightness */
    transform: scale(1.05);
    transition: filter 0.5s ease;
}

/* "Pinch of White" Effect for Light Mode */
body.light-mode .hero-video {
    filter: blur(5px) brightness(1.08) saturate(0.8);
}

/* ===== VIDEO READABILITY FIX ===== */
.video-shadow-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.55),
        rgba(0,0,0,0.65)
    );
    z-index: 1;
}

body.light-mode .video-shadow-overlay {
    background: linear-gradient(to bottom, rgba(236, 231, 231, 0.4) 0%, transparent 50%, rgba(241, 241, 241, 0.2) 100%);
}
/* Force readability on glass & video */
.glass-panel,
.hero-section,
.video-overlay {
    color: #111827;
}

.glass-panel p {
    color: #4b5563;
}
.btn-magnetic {
    color: #111827 !important;
    border-color: #84cc16;
}

.btn-magnetic:hover {
    color: #000 !important;
}

/* --- 5. GLASS COMPONENTS --- */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

.glass-card {
    background: linear-gradient(145deg, var(--glass-surface) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    transition: all 0.5s var(--ease-out-expo);
}

.glass-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 30px var(--primary-glow);
    transform: translateY(-5px);
}

/* --- 6. STATS CONTAINER --- */
.stats-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin: 4rem auto;
    position: relative;
    z-index: 20;
}

.stat-item {
    background: rgba(221, 219, 219, 0.03);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2.5rem 3rem;
    text-align: center;
    min-width: 240px;
    transition: all 0.4s var(--ease-out-expo);
}

body.light-mode .stat-item {
    background: rgba(250, 249, 249, 0.6);
    border: 1px solid rgba(0,0,0,0.1);
}


/* --- 8. MODAL FIX (Scroll & Close) --- */
.modal-backdrop {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    
    /* Glass Effect */
    background: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(15px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(15px) saturate(150%) !important;
    
    z-index: 99999; /* Highest priority */
    opacity: 0; 
    pointer-events: none; 
    transition: opacity 0.4s ease;
    
    /* SCROLL FIX: Allow the modal itself to scroll if content is tall */
    overflow-y: auto; 
    display: block; /* Changed from flex to block to support scrolling */
    padding: 2rem 0; /* Add space at top/bottom */
}

/* Active State */
.modal-backdrop.active { 
    opacity: 1; 
    pointer-events: all; 
}

/* Light Mode Tint */
body.light-mode .modal-backdrop {
    background: rgba(255, 255, 255, 0.4) !important;
}

/* Container for the slices */
.material-modal-transparent {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 20px !important;
    margin: 0 auto; /* Center horizontally */
    min-height: 100%; /* Ensure it takes full height for vertical alignment */
    
    display: flex;
    flex-direction: row;
    align-items: center; /* Center vertically on desktop */
    justify-content: center;
    gap: 20px;
    width: 100%;
    max-width: 1200px;
}

/* The Close Button - FIXED POSITION */
.modal-close-btn {
    position: fixed !important; /* Stays in corner even when scrolling */
    top: 25px;
    right: 25px;
    z-index: 100000; /* Above everything */
    width: 50px;
    height: 50px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}
.modal-close-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    transform: rotate(90deg);
}
.glass-slice { opacity: 0; transform: translateY(40px); }
.modal-backdrop.active .glass-slice {
    opacity: 1;
    transform: translateY(0);
}

/* MOBILE RESPONSIVE FIXES */
@media (max-width: 768px) {
    .material-modal-transparent {
        flex-direction: column !important; /* Stack slices */
        align-items: center !important;
        justify-content: flex-start !important; /* Start from top */
        padding-top: 80px !important; /* Space for close button */
        height: auto !important; /* Allow growing */
    }
    
    .glass-slice {
        width: 100% !important;
        height: 250px !important;
        margin-bottom: 20px;
        flex: none !important;
    }
}
/* --- 8. GLOBAL ELEMENTS --- */
#webgl-canvas, #glass-canvas {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.noise-overlay {
    position: fixed; inset: 0; z-index: 9998; pointer-events: none; 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.65' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* --- 9. RTL SUPPORT (FIXED FONTS) --- */
html[dir="rtl"] { direction: rtl; text-align: right; }

/* FIX 2: Force Tajawal font on everything when RTL is active */
html[dir="rtl"] body,
html[dir="rtl"] h1, 
html[dir="rtl"] h2, 
html[dir="rtl"] h3, 
html[dir="rtl"] h4, 
html[dir="rtl"] h5, 
html[dir="rtl"] h6, 
html[dir="rtl"] p, 
html[dir="rtl"] span, 
html[dir="rtl"] a, 
html[dir="rtl"] button {
    font-family: var(--font-ar) !important;
}

/* --- 10. BUTTONS & EFFECTS --- */
.btn-magnetic {
    position: relative; display: inline-flex; align-items: center; padding: 1rem 2.5rem; 
    border: 1px solid var(--primary); border-radius: 100px; color: var(--primary);
    text-decoration: none; overflow: hidden; transition: all 0.4s ease;
}
.btn-magnetic:hover { color: #000 !important; box-shadow: 0 0 30px var(--primary-glow); }
.btn-magnetic::before {
    content: ''; position: absolute; top: 0; left: 0; width: 0%; height: 100%;
    background: var(--primary); z-index: -1; transition: width 0.4s var(--ease-out-expo);
}
.btn-magnetic:hover::before { width: 100%; }

.typing-active::after {
    content: '|'; color: var(--primary); animation: blink 0.9s infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.gradient-text {
    /* Change these hex codes to your preferred Dark Gray or Apple Green */
    background: linear-gradient(135deg, #fbfcfb 0%, #ffffff 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}
.typing-active::after {
    content: '|';
    color: #84cc16; /* Change the cursor color here */
    animation: blink 0.9s infinite;
}
/* --- MATERIAL SLICES ANIMATION --- */

/* The invisible wrapper */
.material-modal-transparent {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* The individual glass slices */
.glass-slice {
    opacity: 0;
    transform: translateY(50px) scale(0.9);
    animation: slicePop 0.6s cubic-bezier(0.19, 1, 0.22, 1) forwards;
    background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(255,255,255,0.01));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

/* Hover effect for slices */
.glass-slice:hover {
    transform: translateY(-10px) scale(1.02) !important;
    border-color: #84cc16;
    box-shadow: 0 0 30px rgba(132, 204, 22, 0.2);
    z-index: 10;
}

@keyframes slicePop {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Staggered Delays (for the "one after the other" effect) */
.slice-delay-1 { animation-delay: 0.1s; }
.slice-delay-2 { animation-delay: 0.2s; }
.slice-delay-3 { animation-delay: 0.3s; }
.slice-delay-4 { animation-delay: 0.4s; }

/* --- 11. MOBILE RESPONSIVENESS & GLASS MENU --- */

/* --- 11. MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    h1 { font-size: 2.5rem !important; line-height: 1.2; }
    h2 { font-size: 2rem !important; }

    /* GLASS MOBILE MENU CONTAINER */
    #mobile-menu {
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100vh;
        background: rgba(5, 5, 5, 0.9); /* Darker background for better contrast */
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 9999;
        display: flex; flex-direction: column;
        align-items: center; justify-content: center;
        gap: 1.5rem;
        
        /* Hidden State */
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    
    /* Active State */
    #mobile-menu.active { 
        opacity: 1; 
        pointer-events: all; 
    }
    
    /* GLASS PILLS (Links) */
    #mobile-menu a {
        position: relative;
        font-size: 1.2rem;
        color: white;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        text-decoration: none;
        
        background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(255,255,255,0.01));
        border: 1px solid rgba(255, 255, 255, 0.15);
        padding: 1rem 0;
        width: 80%;
        max-width: 300px;
        text-align: center;
        border-radius: 50px;
        
        transform: translateY(20px);
        transition: all 0.3s ease;
    }

    #mobile-menu.active a { transform: translateY(0); }

    /* Hover Effect */
    #mobile-menu a:hover {
        background: rgba(255, 255, 255, 0.2);
        border-color: #84cc16;
    }
}
/* FORCE MODAL CONTENT VISIBILITY */
#material-modal.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* FIX CONTAINER */
.material-modal-transparent {
    width: 100%;
    max-width: 1200px;
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: stretch;
    gap: 24px;
    z-index: 100001;
}
.glass-slice {
    width: 280px !important;
    height: 360px !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    z-index: 100002;
}
/* --- CONTACT MODAL LIGHT MODE FIX --- */

/* Default (Dark Mode) is handled by HTML classes, 
   We only need to override for Light Mode */

body.light-mode #contact-modal .material-modal {
    background: rgba(255, 255, 255, 0.95) !important; /* White Glass */
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1) !important;
}

body.light-mode #contact-modal h3,
body.light-mode #contact-modal h4 {
    color: #1a1a1a !important; /* Dark Text */
}

body.light-mode #contact-modal p,
body.light-mode #contact-modal span {
    color: #555555 !important; /* Grey Text */
}

body.light-mode #contact-modal .fa-xmark {
    color: #333 !important;
}

/* Light Mode Buttons inside Modal */
body.light-mode #contact-modal a {
    background: #f3f4f6 !important; /* Light Grey Button Background */
    border: 1px solid #e5e7eb !important;
}

body.light-mode #contact-modal a:hover {
    background: rgba(132, 204, 22, 0.1) !important;
    border-color: #84cc16 !important;
}
/* --- FIX: PREVENT INVISIBLE OVERLAYS BLOCKING CLICKS --- */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 99999;
    
    /* Default Hidden State */
    opacity: 0;
    visibility: hidden; /* CRITICAL: Hides it from mouse clicks */
    pointer-events: none; /* CRITICAL: Lets clicks pass through */
    
    transition: opacity 0.3s ease, visibility 0.3s ease;
    
    /* Center Content */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible; /* Re-enable */
    pointer-events: all; /* Re-enable clicks */
}
/* --- FORCE HIDE MOBILE MENU ON DESKTOP --- */
@media (min-width: 768px) {
    /* Hide the entire full-screen menu overlay */
    #mobile-menu {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
        opacity: 0 !important;
        z-index: -1 !important;
    }

    /* Hide the hamburger button (3 lines) */
    .fa-bars, 
    button[onclick="toggleMobileMenu()"] {
        display: none !important;
    }
}
/* --- FIX: ZOMBIE MODALS BLOCKING CLICKS --- */
.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 99999;
    opacity: 0;
    visibility: hidden; /* Hides it from mouse */
    pointer-events: none; /* Clicks pass through */
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: center;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all; /* Re-enable clicks */
}

/* FIX: Hide Mobile Menu on Desktop */
@media (min-width: 768px) {
    #mobile-menu { display: none !important; }
}


