/* Critical CSS - يتم تحميله فوراً */
:root {
    --primary: #15409e;
    --secondary: #fb9d3b;
    --accent: #0f2e6b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #0f172a;
    --light: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --gradient-primary: linear-gradient(135deg, #15409e 0%, #1e4fb8 50%, #2563eb 100%);
    --gradient-secondary: linear-gradient(135deg, #fb9d3b 0%, #f97316 50%, #ea580c 100%);
    --gradient-hero: linear-gradient(135deg, rgba(15, 64, 158, 0.95) 0%, rgba(30, 79, 184, 0.9) 100%);

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Cairo', sans-serif;
    direction: rtl;
    font-variant-numeric: lining-nums;
    font-feature-settings: "lnum";
}

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

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Page Management */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* Header - Critical */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--gray-200);
    transition: var(--transition);
}

.header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

/* Enhanced Logo Styles - Critical */
.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-xl);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.logo::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(21, 64, 158, 0.05), rgba(59, 130, 246, 0.05));
    opacity: 0;
    transition: var(--transition);
    border-radius: var(--radius-xl);
}

.logo:hover::before {
    opacity: 1;
}

.logo:hover {
    transform: translateY(-2px);
}

.logo-icon-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Logo Image - Critical */
.logo-image {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-xl);
    object-fit: cover;
    border: 3px solid transparent;
    background: var(--gradient-primary);
    padding: 2px;
    transition: var(--transition);
    position: relative;
    z-index: 2;
    box-shadow: var(--shadow-md);
}

.logo-image:hover {
    transform: scale(1.05);
    border-color: var(--secondary);
    box-shadow: var(--shadow-lg);
}

/* Fallback Icon - Critical */
.logo-icon {
    width: 56px;
    height: 56px;
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light);
    font-size: 1.5rem;
    font-weight: 800;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.logo-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: rotate(45deg);
    transition: var(--transition);
    opacity: 0;
}

.logo:hover .logo-icon {
    background: linear-gradient(135deg, #1e4fb8 0%, #3b82f6 50%, #60a5fa 100%);
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

.logo:hover .logo-icon::before {
    opacity: 1;
    animation: logoShine 0.6s ease-in-out;
}

@keyframes logoShine {
    0% {
        left: -100%;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        left: 100%;
        opacity: 0;
    }
}

.logo-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: var(--gradient-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light);
    font-size: 0.7rem;
    font-weight: 700;
    border: 2px solid var(--light);
    box-shadow: var(--shadow-md);
    z-index: 3;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.logo-text h2 {
    color: var(--primary);
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.1;
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

.logo-text p {
    color: var(--secondary);
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.8;
}

.nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0;
    position: relative;
    transition: var(--transition);
    cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--secondary);
    transition: var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.header-cta {
    background: var(--gradient-secondary);
    color: var(--light);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-cta:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.mobile-menu {
    display: none;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero Section - Above the fold */
.hero {
    min-height: 100vh;
    background: var(--gradient-hero);
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding-top: 80px;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(1px);
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    position: relative;
    z-index: 2;
}

.hero-text h1 {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--light);
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero-text .subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-primary {
    background: var(--light);
    color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-2xl);
}

.btn-outline {
    background: transparent;
    color: var(--light);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--light);
}

/* Responsive - Critical */
@media (max-width: 768px) {
    .nav {
        display: none;
    }

    .mobile-menu {
        display: block;
    }

    .hero-content {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }

    .hero-text h1 {
        font-size: 2.5rem;
    }

    .container {
        padding: 0 1rem;
    }

    .logo {
        gap: 0.75rem;
    }

    .logo-text h2 {
        font-size: 1.4rem;
    }

    .logo-text p {
        font-size: 0.7rem;
    }

    .logo-image,
    .logo-icon {
        width: 48px;
        height: 48px;
    }

    .logo-badge {
        width: 16px;
        height: 16px;
        font-size: 0.6rem;
        top: -2px;
        right: -2px;
    }
}

@media (max-width: 480px) {
    .logo-text h2 {
        font-size: 1.2rem;
    }

    .logo-text p {
        display: none;
    }

    .header-cta span {
        display: none;
    }

    .header-cta {
        padding: 0.75rem;
        min-width: 48px;
        justify-content: center;
    }

    .logo-image,
    .logo-icon {
        width: 40px;
        height: 40px;
    }

    .logo-icon {
        font-size: 1.2rem;
    }
}
