@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);
    
    /* --- FORCED LIGHT MODE COLORS --- */
    --bg-core: #ffffff; 
    --bg-card: #ffffff;
    --text-main: #111827;   /* Almost Black */
    --text-muted: #6b7280;  /* Gray */
    --text-soft: #9ca3af;
    
    /* --- GLASS --- */
    --glass-border: rgba(132, 204, 22, 0.3); 
    --glass-surface: rgba(0, 0, 0, 0.02);
    
    /* --- FONTS --- */
    --font-en: 'Outfit', sans-serif;
    --font-ar: 'Tajawal', sans-serif;
    
    --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
}

/* --- 1. GLOBAL RESET & TYPOGRAPHY --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-core);
    color: var(--text-main);
    font-family: var(--font-ar), var(--font-en), sans-serif; /* Default to Arabic font preference */
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* Force RTL Direction for Arabic */
html[dir="rtl"] { direction: rtl; text-align: right; }

html[dir="rtl"] body, html[dir="rtl"] h1, html[dir="rtl"] h2, 
html[dir="rtl"] h3, html[dir="rtl"] h4, html[dir="rtl"] p, 
html[dir="rtl"] span, html[dir="rtl"] a, html[dir="rtl"] button {
    font-family: var(--font-ar) !important;
}

/* --- 2. NAVBAR (Fixed Visibility) --- */
header#navbar {
    position: fixed;
    top: 0; left: 0; width: 100%; z-index: 1000;
    padding: 1.5rem;
    transition: all 0.4s ease;
    background: transparent;
}

/* Top State: Transparent BG + White Text */
header#navbar .glass-panel {
    background: rgba(0, 0, 0, 0.2) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

header#navbar a, 
header#navbar span, 
header#navbar i,
header#navbar .fa-bars {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Scrolled State: White BG + Dark Text */
header#navbar.scrolled {
    padding-top: 0.5rem; padding-bottom: 0.5rem;
}

header#navbar.scrolled .glass-panel {
    background: rgba(255, 255, 255, 0.95) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

header#navbar.scrolled a, 
header#navbar.scrolled span, 
header#navbar.scrolled i,
header#navbar.scrolled .fa-bars {
    color: #111827 !important;
    text-shadow: none;
}

header#navbar a:hover, 
header#navbar .text-\[\#84cc16\] {
    color: #84cc16 !important;
}

/* --- 3. HERO & TYPEWRITER --- */
#hero-title-slider, 
#hero-desc-slider {
    color: #ffffff !important;
    text-shadow: 0 4px 10px rgba(0,0,0,0.3);
    min-height: 120px;
    display: block;
}

.gradient-text {
    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;
    animation: blink 0.9s infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* --- 4. 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);
}

/* --- 5. 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(250, 249, 249, 0.8);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 24px;
    padding: 2.5rem 3rem;
    text-align: center;
    min-width: 240px;
    transition: all 0.4s var(--ease-out-expo);
}

/* --- 6. BACKGROUND & NOISE --- */
#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");
}

/* --- 7. BUTTONS --- */
.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%; }

/* --- 8. MATERIAL MODAL (Vertical Animation) --- */
/* Base Modal Container */
.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); /* Darker backdrop */
    backdrop-filter: blur(8px);
    z-index: 99999;
    
    /* Animation States */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    
    /* Layout */
    display: flex; align-items: center; justify-content: center;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.material-modal {
    position: relative; width: 100%; max-width: 1200px;
    z-index: 100000;
}

.material-modal-transparent {
    width: 100%; display: flex; flex-wrap: wrap; 
    justify-content: center; gap: 24px;
}

/* Close Button */
.modal-close-btn {
    position: fixed; top: 30px; right: 30px; z-index: 100001;
    width: 50px; height: 50px;
    background: rgba(255,255,255,0.1); 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 Slices - Vertical Opening */
.glass-slice {
    position: relative;
    width: 280px; height: 400px;
    border-radius: 20px; overflow: hidden;
    background-size: cover; background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.4s ease;
    cursor: pointer;
    
    /* Vertical Animation Setup */
    opacity: 0;
    transform: scaleY(0);
    transform-origin: top;
    animation: openVertical 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.glass-slice:hover {
    transform: scaleY(1) translateY(-10px) scale(1.02);
    border-color: #84cc16;
    box-shadow: 0 0 20px rgba(132, 204, 22, 0.4);
}

.glass-slice::before {
    content: ''; position: absolute; inset: 0;
    background-image: inherit; background-size: cover; background-position: center;
    transition: transform 0.7s ease; z-index: 0;
}
.glass-slice:hover::before { transform: scale(1.1); }

/* Glass Overlay Text */
.glass-overlay {
    position: absolute; bottom: 0; left: 0; width: 100%; padding: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    animation: fadeInText 0.5s ease 0.3s forwards;
    z-index: 2;
}

.glass-overlay h4 { color: white; font-size: 1.2rem; font-weight: bold; margin-bottom: 5px; }
.glass-overlay p { color: #ccc; font-size: 0.9rem; }

/* Animations */
@keyframes openVertical {
    0% { opacity: 0; transform: scaleY(0); }
    100% { opacity: 1; transform: scaleY(1); }
}
@keyframes fadeInText { to { opacity: 1; } }

/* Stagger Delays */
.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; }

/* --- 9. CONTACT MODAL (Light Mode Fixes) --- */
#contact-modal .material-modal {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}
#contact-modal h3, #contact-modal h4 { color: #111827 !important; }
#contact-modal p, #contact-modal span { color: #555555 !important; }
#contact-modal .fa-xmark { color: #333 !important; }
#contact-modal a {
    background: #f3f4f6 !important; border: 1px solid #e5e7eb !important;
}
#contact-modal a:hover {
    background: rgba(132, 204, 22, 0.1) !important; border-color: #84cc16 !important;
}

/* --- 10. MOBILE MENU (Clean) --- */
@media (max-width: 768px) {
    h1 { font-size: 2.5rem !important; line-height: 1.2; }
    h2 { font-size: 2rem !important; }

    #mobile-menu {
        position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
        background: rgba(5, 5, 5, 0.95); backdrop-filter: blur(20px);
        z-index: 9999; display: flex; flex-direction: column;
        align-items: center; justify-content: center; gap: 1.5rem;
        opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
    }
    
    #mobile-menu.active { opacity: 1; pointer-events: all; }
    
    #mobile-menu a {
        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); }
    #mobile-menu a:hover { background: rgba(255, 255, 255, 0.2); border-color: #84cc16; }
}

@media (min-width: 768px) {
    #mobile-menu, .fa-bars, button[onclick="toggleMobileMenu()"] { display: none !important; }
}