/* Performance Optimization CSS */
/* تحسينات الأداء وسرعة التحميل */

/* Critical CSS - Above the fold optimizations */
/* تحسينات CSS الحرجة - المحتوى المرئي أولاً */

/* Font loading optimization */
/* تحسين تحميل الخطوط */
@font-face {
    font-family: 'Tajawal';
    font-display: swap; /* Improves font loading performance */
    src: url('../fonts/Tajawal-Regular.woff2') format('woff2'),
         url('../fonts/Tajawal-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Tajawal';
    font-display: swap;
    src: url('../fonts/Tajawal-Bold.woff2') format('woff2'),
         url('../fonts/Tajawal-Bold.woff') format('woff');
    font-weight: 700;
    font-style: normal;
}

/* Image optimization classes */
/* فئات تحسين الصور */
.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-lazy {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.img-lazy.loaded {
    opacity: 1;
}

.img-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    min-height: 200px;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Layout optimization */
/* تحسين التخطيط */
.container-fluid {
    contain: layout style paint;
}

.row {
    contain: layout;
}

/* Reduce layout shifts */
/* تقليل تحركات التخطيط */
.aspect-ratio-16-9 {
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.aspect-ratio-4-3 {
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.aspect-ratio-1-1 {
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

/* Performance-optimized animations */
/* رسوم متحركة محسنة للأداء */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* GPU acceleration for smooth animations */
/* تسريع GPU للرسوم المتحركة السلسة */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Critical above-the-fold styles */
/* أنماط حرجة للمحتوى المرئي أولاً */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Navigation optimization */
/* تحسين التنقل */
.navbar {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
    contain: layout style paint;
}

.navbar-brand img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* Button optimizations */
/* تحسينات الأزرار */
.btn {
    transition: all 0.2s ease;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

/* Card optimizations */
/* تحسينات البطاقات */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    contain: layout style paint;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.card-img-top {
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card:hover .card-img-top {
    transform: scale(1.05);
}

/* Loading states */
/* حالات التحميل */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Scroll optimization */
/* تحسين التمرير */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* Reduce motion for accessibility */
/* تقليل الحركة لإمكانية الوصول */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Mobile optimizations */
/* تحسينات الهاتف المحمول */
@media (max-width: 768px) {
    .hero-section {
        min-height: 70vh;
        padding: 2rem 1rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Print optimizations */
/* تحسينات الطباعة */
@media print {
    .navbar,
    .footer,
    .btn,
    .modal {
        display: none !important;
    }
    
    .container {
        width: 100% !important;
        max-width: none !important;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* High contrast mode support */
/* دعم وضع التباين العالي */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Dark mode support */
/* دعم الوضع المظلم */
@media (prefers-color-scheme: dark) {
    .card {
        background-color: #2d3748;
        color: #e2e8f0;
    }
    
    .navbar {
        background: rgba(45, 55, 72, 0.95);
        color: #e2e8f0;
    }
}

/* Focus management for accessibility */
/* إدارة التركيز لإمكانية الوصول */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 9999;
}

.skip-link:focus {
    top: 6px;
}

/* Performance monitoring */
/* مراقبة الأداء */
.perf-mark {
    display: none;
}

/* Critical resource hints */
/* تلميحات الموارد الحرجة */
.preload-hint {
    display: none;
}