/* Main Stylesheet for Malkawi Math Platform */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

:root {
    /* Primary Color Palette */
    --color-primary: #800020; /* Khamri / Maroon */
    --color-primary-light: #a52a2a;
    --color-primary-dark: #580016;
    
    /* Neutrals */
    --color-bg-dark: #121212;
    --color-bg-card: #1e1e1e;
    --color-text-main: #ffffff;
    --color-text-muted: #b0b0b0;
    --color-border: #333333;
    
    /* Accents */
    --color-accent: #ff0040; /* Neon Red/Pink for glows */
    --color-silver: #C0C0C0;
    
    /* Glassmorphism */
    --glass-bg: rgba(30, 30, 30, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    /* Spacing */
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 32px;
    --spacing-xl: 64px;
    
    /* Fonts */
    --font-primary: 'Cairo', sans-serif;
    --font-secondary: 'Tajawal', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--color-bg-dark);
    color: var(--color-text-main);
    font-family: var(--font-primary);
    overflow-x: hidden;
    scroll-behavior: smooth;
    direction: rtl; /* Arabic support */
    text-align: right;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.grid-cols-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h1.hero-title {
    font-size: 4rem;
    background: linear-gradient(45deg, var(--color-text-main), var(--color-primary-light));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(128, 0, 32, 0.5);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-family: var(--font-primary);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(128, 0, 32, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(128, 0, 32, 0.6);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary-light);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: white;
}

/* Animations */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

.floating {
    animation: float 6s ease-in-out infinite;
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(128, 0, 32, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(128, 0, 32, 0); }
    100% { box-shadow: 0 0 0 0 rgba(128, 0, 32, 0); }
}

.glow-effect {
    animation: pulse-glow 2s infinite;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(128, 0, 32, 0.2);
    border-color: var(--color-primary);
}

/* Math Particles Background */
#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    opacity: 0.5;
}

/* Section Specifics */
section {
    padding: var(--spacing-xl) 0;
    position: relative;
}

footer {
    background: var(--color-bg-card);
    padding: var(--spacing-lg) 0;
    text-align: center;
    border-top: 1px solid var(--color-border);
}

/* =========================================
   Migrated & New Styles (Navbar & Hero)
   ========================================= */

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at center, #2a0a10 0%, var(--color-bg-dark) 70%);
}

.hero-content {
    z-index: 2;
    text-align: center;
    max-width: 800px;
    padding: 0 20px;
}

.math-symbol {
    position: absolute;
    font-size: 3rem;
    color: rgba(128, 0, 32, 0.3);
    pointer-events: none;
}

.symbol-1 { top: 10%; left: 10%; animation-delay: 0s; }
.symbol-2 { top: 70%; left: 80%; animation-delay: 2s; }
.symbol-3 { top: 40%; left: 20%; animation-delay: 4s; font-size: 5rem; }
.symbol-4 { top: 20%; left: 60%; animation-delay: 1s; }

/* Navbar Styling */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar.scrolled {
    background: rgba(18, 18, 18, 0.95);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    padding: 10px 0;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 900;
    color: white;
    text-decoration: none;
}

.logo span {
    color: var(--color-primary);
}

.nav-links.desktop-only a {
    color: white;
    text-decoration: none;
    margin-left: 20px;
    font-weight: 600;
    transition: color 0.3s;
}

.nav-links.desktop-only a:hover {
    color: var(--color-primary-light);
}

/* Mobile Menu Styles */
.mobile-only {
    display: none;
}

.hamburger {
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    padding: 5px;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7); /* Dark semi-transparent */
    backdrop-filter: blur(3px);
    z-index: 1000; /* Just below the mobile-menu */
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%; /* Hidden by default */
    width: 80%; /* Takes up 80% on small screens */
    max-width: 320px; /* But no larger than 320px */
    height: 100vh;
    background: rgba(18, 18, 18, 0.98);
    backdrop-filter: blur(20px);
    z-index: 1001; /* Above navbar & overlay */
    border-left: 1px solid var(--glass-border);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: 30px 25px; /* Bigger padding */
    box-shadow: -10px 0 25px rgba(0,0,0,0.7);
    overflow-y: auto; /* Scrollable if screen is very short */
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 15px;
}

.close-menu {
    font-size: 1.8rem; /* Slightly larger X */
    cursor: pointer;
    color: var(--color-text-muted);
    transition: color 0.3s;
    background: rgba(255,255,255,0.05); /* Tap target background */
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-menu:hover {
    color: var(--color-primary);
    background: rgba(255,255,255,0.1);
}

.mobile-links {
    display: flex;
    flex-direction: column;
    gap: 25px; /* More spacing */
}

.mobile-link {
    color: var(--color-text-main);
    text-decoration: none;
    font-size: 1.25rem; /* Larger font */
    font-weight: 700;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    padding: 5px 0;
}

.mobile-link:hover {
    color: var(--color-primary);
    transform: translateX(-5px); /* Slide left slightly on hover */
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block;
    }
    
    .hero-title {
        font-size: 2.5rem; 
    }
}

.page-header {
    padding: 120px 0 40px; 
    text-align: center;
    background: linear-gradient(to bottom, rgba(128, 0, 32, 0.2), transparent);
}

.page-header h1 {
    font-size: 3rem;
    color: var(--color-primary-light);
    margin-bottom: 10px;
}

.filters {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    padding: 10px 25px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-primary);
    font-weight: 600;
}

.filter-btn:hover, .filter-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 4px 15px rgba(128, 0, 32, 0.3);
}

.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.course-card {
    overflow: hidden;
    transition: all 0.4s ease;
    opacity: 1; /* For filter animation */
}

.course-card:hover {
    transform: translateY(-10px);
}

.card-image {
    height: 180px;
    background: linear-gradient(135deg, #2a0a10, #1a1a1a);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: #444; /* Icon color default */
}

.card-image i {
    transition: color 0.3s;
}

.course-card:hover .card-image i {
    color: var(--color-primary);
}

.badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
}

.badge-free {
    background: #28a745;
    color: white;
}

.badge-paid {
    background: var(--color-primary);
    color: white;
}

.card-body {
    padding: 25px;
}

.card-body h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: white;
}

.card-body p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* =========================================
   Course Details Styles
   ========================================= */

.course-hero {
    padding: 150px 0 80px;
    background: radial-gradient(circle at top right, #3a0e16 0%, var(--color-bg-dark) 60%);
    border-bottom: 1px solid var(--color-border);
}

.hero-layout {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 40px;
}

.hero-info {
    flex: 2;
}

.category-tag {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-primary-light);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 15px;
}

.hero-info h1 {
    font-size: 2.8rem;
    margin-bottom: 20px;
}

.course-meta {
    display: flex;
    gap: 20px;
    margin-top: 30px;
    color: var(--color-silver);
}

.course-meta i {
    color: var(--color-primary);
    margin-left: 8px;
}

.hero-card {
    flex: 1;
    padding: 0;
    overflow: hidden;
    position: sticky;
    top: 100px; /* Sticky sidebar */
}

.preview-video {
    height: 200px;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    position: relative;
}

.preview-video:hover i {
    color: var(--color-primary);
    transform: scale(1.1);
}

.preview-video i {
    transition: all 0.3s;
    margin-bottom: 10px;
}

.price-box {
    padding: 30px;
    text-align: center;
}

.price-box h2 {
    font-size: 2.5rem;
    color: white;
    margin-bottom: 20px;
}

.guarantee {
    font-size: 0.8rem;
    color: #28a745;
    margin-top: 15px;
}

/* Tabs & Content */
.course-content {
    padding-top: 50px;
}

.tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--color-border);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.2rem;
    font-weight: 700;
    padding: 10px 20px;
    cursor: pointer;
    font-family: var(--font-primary);
    position: relative;
    top: 2px;
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--color-primary);
    border-bottom: 3px solid var(--color-primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Lesson Items */
.lessons-list {
    padding: 0;
}

.lesson-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.3s;
}

.lesson-item:last-child {
    border-bottom: none;
}

.lesson-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.lesson-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.lesson-info .icon {
    font-size: 1.5rem;
    color: var(--color-text-muted);
    width: 40px;
    text-align: center;
}

.lesson-item.unlocked .icon {
    color: var(--color-primary);
}

.lesson-info h4 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
}

.lesson-info .meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.lock-icon {
    color: #666;
}

/* File Cards */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.file-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.file-icon {
    background: linear-gradient(45deg, #cc2e2e, #a00);
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem; /* fix icon size */
}

/* Responsive Course Page */
@media (max-width: 900px) {
    .hero-layout {
        flex-direction: column;
    }
    
    .hero-card {
        width: 100%;
        position: static;
        margin-top: 30px;
    }

    .hero-info h1 {
        font-size: 2rem;
    }
}