/**
 * Math Minds Academy - ملف التصميم الرئيسي
 * يحتوي على المتغيرات، الأساسيات، ومكونات الواجهة
 * 
 * @version 1.0
 * @author Math Minds Team
 */

/* ========================================
   🎨 CSS Variables & Reset
   ======================================== */
:root {
    /* 🎨 الألوان */
    --color-primary: #0EA5E9;
    --color-primary-dark: #0284C7;
    --color-secondary: #F59E0B;
    --color-secondary-dark: #D97706;
    --color-background: #FFFFFF;
    --color-background-alt: #F8FAFC;
    --color-text: #1E293B;
    --color-text-light: #64748B;
    --color-success: #10B981;
    --color-error: #EF4444;
    --color-border: #E2E8F0;
    
    /* 🔤 الخطوط */
    --font-arabic: 'Cairo', 'Tajawal', 'Noto Sans Arabic', sans-serif;
    --font-english: 'Poppins', 'Inter', system-ui, sans-serif;
    
    /* 📏 الأبعاد */
    --container-max: 1280px;
    --header-height: 80px;
    --border-radius: 12px;
    --border-radius-lg: 24px;
    
    /* ✨ الظلال */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    
    /* 🎬 الانتقالات */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
}

/* 🔄 Dark Mode Variables */
[data-theme="dark"] {
    --color-background: #0F172A;
    --color-background-alt: #1E293B;
    --color-text: #F1F5F9;
    --color-text-light: #94A3B8;
    --color-border: #334155;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
}

/* 🧹 Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-arabic);
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* دعم اللغة الإنجليزية */
body.ltr {
    font-family: var(--font-english);
    direction: ltr;
}

/* 🗂️ Container */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* 🔗 Links */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-dark);
}

/* 🖼️ Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 📝 Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }

p {
    margin-bottom: 1rem;
    color: var(--color-text-light);
}

/* 🎨 Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: white;
}

.btn-secondary {
    background: var(--color-secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--color-secondary-dark);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: white;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* 📋 Forms */
input, textarea, select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    background: var(--color-background);
    color: var(--color-text);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--color-text);
}

.form-note {
    display: block;
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-top: 0.25rem;
}

/* 🎴 Cards */
.card {
    background: var(--color-background);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* 🎯 Sections */
section {
    padding: 5rem 0;
}

.section-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 3rem;
}

.section-header h2 {
    position: relative;
    display: inline-block;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--color-secondary);
    border-radius: 2px;
}

/* ========================================
   🧭 Header Styles
   ======================================== */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    z-index: 1000;
    transition: all var(--transition-normal);
}

[data-theme="dark"] .main-header {
    background: rgba(15, 23, 42, 0.95);
}

.main-header.scrolled {
    height: 70px;
    box-shadow: var(--shadow-md);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-text);
}

.logo-icon {
    font-size: 2rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.logo-main {
    color: var(--color-primary);
}

.logo-sub {
    font-size: 0.75rem;
    color: var(--color-secondary);
    font-weight: 400;
}

/* Navigation */
.nav-desktop {
    display: none;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    font-weight: 500;
    color: var(--color-text);
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-primary);
    background: rgba(14, 165, 233, 0.1);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lang-switcher {
    display: flex;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.lang-link {
    padding: 0.25rem 0.5rem;
    color: var(--color-text-light);
    border-radius: 4px;
}

.lang-link.active,
.lang-link:hover {
    color: var(--color-primary);
    background: rgba(14, 165, 233, 0.1);
}

.lang-separator {
    color: var(--color-border);
}

.btn-register {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: block;
    width: 40px;
    height: 40px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.hamburger {
    width: 24px;
    height: 3px;
    background: var(--color-text);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Navigation */
.nav-mobile {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--color-background);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    transform: translateY(-150%);
    transition: transform var(--transition-normal);
    z-index: 999;
}

.nav-mobile.active {
    transform: translateY(0);
}

.nav-list-mobile {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-list-mobile a {
    display: block;
    padding: 1rem;
    font-weight: 500;
    color: var(--color-text);
    border-radius: var(--border-radius);
    transition: background var(--transition-fast);
}

.nav-list-mobile a:hover {
    background: var(--color-background-alt);
    color: var(--color-primary);
}

.mobile-cta {
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

/* 🌙 Dark Mode Toggle */
.dark-mode-toggle {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-lg);
    z-index: 900;
    transition: transform var(--transition-fast);
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
}

.dark-mode-toggle .icon-sun { display: none; }
[data-theme="dark"] .dark-mode-toggle .icon-sun { display: block; }
[data-theme="dark"] .dark-mode-toggle .icon-moon { display: none; }

/* 📱 WhatsApp Float */
.whatsapp-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #25D366;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.75rem;
    box-shadow: var(--shadow-lg);
    z-index: 900;
    transition: transform var(--transition-fast);
    animation: pulse 2s infinite;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    animation: none;
}

.whatsapp-float svg {
    width: 30px;
    height: 30px;
}

.whatsapp-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: var(--color-secondary);
    border-radius: 50%;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* 🍪 Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-background);
    border-top: 1px solid var(--color-border);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    transition: transform var(--transition-normal);
}

.cookie-banner.hidden {
    transform: translateY(100%);
}

.cookie-content {
    max-width: var(--container-max);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.cookie-buttons {
    display: flex;
    gap: 0.5rem;
}

/* ⏳ Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-background);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    text-align: center;
}

.logo-preloader {
    margin-bottom: 2rem;
}

.logo-icon {
    width: 80px;
    height: 80px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto 1rem;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: var(--color-primary);
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { width: 0%; margin-left: 0; }
    50% { width: 100%; margin-left: 0; }
    100% { width: 0%; margin-left: 100%; }
}

.loading-text {
    font-size: 0.9rem;
    color: var(--color-text-light);
}

/* 📜 Scroll Progress */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--color-primary);
    width: 0%;
    z-index: 1001;
    transition: width 0.1s ease;
}

/* 🦶 Footer */
.main-footer {
    background: var(--color-background-alt);
    padding: 4rem 0 2rem;
    margin-top: 3rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--color-text);
}

.footer-desc {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.footer-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--color-secondary);
    border-radius: 2px;
}

.footer-list {
    list-style: none;
}

.footer-list li {
    margin-bottom: 0.5rem;
}

.footer-list a {
    color: var(--color-text-light);
    transition: color var(--transition-fast);
}

.footer-list a:hover {
    color: var(--color-primary);
}

.social-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.social-link {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-background);
    color: var(--color-text);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.social-link:hover {
    transform: translateY(-3px);
    color: white;
}

.social-link.facebook:hover { background: #1877F2; }
.social-link.instagram:hover { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.social-link.tiktok:hover { background: #000; }
.social-link.whatsapp:hover { background: #25D366; }

.social-link svg {
    width: 20px;
    height: 20px;
}

.newsletter-form {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.newsletter-form input {
    flex: 1;
    padding: 0.75rem 1rem;
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-contact {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: var(--color-text-light);
    flex-wrap: wrap;
}

.footer-copyright {
    font-size: 0.9rem;
    color: var(--color-text-light);
}

.footer-legal {
    margin-top: 0.5rem;
}

.footer-legal a {
    color: var(--color-text-light);
    margin: 0 0.25rem;
}

/* ========================================
   🏠 Hero Section
   ======================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: var(--header-height);
    background: linear-gradient(135deg, var(--color-background-alt) 0%, var(--color-background) 100%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 70%;
    height: 150%;
    background: radial-gradient(circle, rgba(14,165,233,0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-content {
    max-width: 600px;
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(14, 165, 233, 0.1);
    color: var(--color-primary);
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.hero h1 {
    margin-bottom: 1.5rem;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: var(--color-text);
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-image {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 50%;
    max-width: 700px;
    opacity: 0;
    animation: fadeInRight 1s ease forwards 0.5s;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* ========================================
   📦 Responsive Design
   ======================================== */
@media (min-width: 768px) {
    .nav-desktop {
        display: block;
    }
    
    .mobile-menu-toggle {
        display: none;
    }
    
    .hero {
        padding: 0;
    }
    
    .hero-content {
        padding: 4rem 0;
    }
    
    .hero-image {
        position: relative;
        transform: none;
        top: auto;
        width: 45%;
        margin-right: -2rem;
    }
    
    .cookie-content {
        flex-wrap: nowrap;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
    
    section {
        padding: 7rem 0;
    }
}

/* RTL Support - Basic */
.rtl {
    direction: rtl;
    text-align: right;
}

.rtl .hero::before {
    right: auto;
    left: -20%;
}

.rtl .hero-image {
    right: auto;
    left: 0;
}

.rtl .footer-title::after {
    left: auto;
    right: 0;
}

/* 🎨 Utility Classes */
.text-center { text-align: center; }
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }

.bg-primary { background: var(--color-primary); }
.bg-secondary { background: var(--color-secondary); }
.bg-alt { background: var(--color-background-alt); }

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* 🎬 Animation Utilities */
[data-aos] {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-aos].aos-animate {
    opacity: 1;
}

/* 🖱️ Focus Styles for Accessibility */
a:focus, button:focus, input:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* 🖨️ Print Styles */
@media print {
    .main-header, .main-footer, .whatsapp-float, .dark-mode-toggle, .cookie-banner {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    a {
        text-decoration: underline;
        color: black;
    }
}