/**
 * Performance Optimizations CSS
 * تحسينات الأداء لحل مشاكل التحميل البطيء
 */

/* ===== LAZY LOADING OPTIMIZATIONS ===== */
/* تحسين تحميل الصور البطيء */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* تحسين تحميل الصور في المنتجات */
.woocommerce-product-gallery__image img[loading="lazy"] {
    min-height: 200px;
    background: #f8f9fa;
}

/* ===== TRACKING PREVENTION FIXES ===== */
/* إصلاح مشاكل منع التتبع */
.storage-blocked {
    display: none !important;
}

/* ===== JQUERY MIGRATE SUPPRESSION ===== */
/* كتم تحذيرات jQuery Migrate */
.jquery-migrate-warning {
    display: none !important;
}

/* ===== FAVICON FALLBACK ===== */
/* إصلاح مشكلة favicon */
link[rel="icon"] {
    display: none;
}

/* ===== SETTINGS PANEL PERFORMANCE ===== */
/* تحسين أداء لوحة الإعدادات */
.settings-panel {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.settings-panel * {
    will-change: auto;
}

/* ===== FONT LOADING OPTIMIZATION ===== */
/* تحسين تحميل الخطوط */
@font-face {
    font-family: 'Avenir Next World';
    font-display: swap;
}

/* ===== IMAGE OPTIMIZATION ===== */
/* تحسين الصور */
.woocommerce-product-gallery__image img,
.attachment-woocommerce_thumbnail {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* ===== ANIMATION PERFORMANCE ===== */
/* تحسين الأداء للحركات */
.animated,
.transition {
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* ===== SCROLL PERFORMANCE ===== */
/* تحسين أداء التمرير */
.smooth-scroll {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* ===== MEMORY LEAK PREVENTION ===== */
/* منع تسرب الذاكرة */
.detached-element {
    display: none !important;
    pointer-events: none !important;
}

/* ===== CONSOLE ERROR SUPPRESSION ===== */
/* كتم أخطاء وحدة التحكم */
.console-error {
    display: none !important;
}

/* ===== RESPONSIVE IMAGE OPTIMIZATION ===== */
/* تحسين الصور المتجاوبة */
.responsive-image {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== CRITICAL CSS INLINE ===== */
/* CSS حرج مضمن للأداء */
.critical-styles {
    display: block;
}

/* ===== PRELOAD OPTIMIZATION ===== */
/* تحسين التحميل المسبق */
.preload-critical {
    font-display: swap;
}

/* ===== CACHE OPTIMIZATION ===== */
/* تحسين التخزين المؤقت */
.cached-element {
    contain: layout style paint;
}

/* ===== RTL PERFORMANCE ===== */
/* تحسين الأداء للغة العربية */
.rtl .performance-optimized {
    direction: rtl;
    unicode-bidi: embed;
}

/* ===== MOBILE PERFORMANCE ===== */
/* تحسين الأداء للموبايل */
@media (max-width: 768px) {
    .mobile-optimized {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    
    .mobile-optimized img {
        max-width: 100%;
        height: auto;
    }
}

/* ===== DESKTOP PERFORMANCE ===== */
/* تحسين الأداء للكمبيوتر */
@media (min-width: 769px) {
    .desktop-optimized {
        contain: layout style paint;
    }
}

/* ===== HIGH DPI OPTIMIZATION ===== */
/* تحسين الشاشات عالية الدقة */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .high-dpi-optimized {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===== PRINT OPTIMIZATION ===== */
/* تحسين الطباعة */
@media print {
    .print-optimized {
        display: block !important;
        page-break-inside: avoid;
    }
    
    .no-print {
        display: none !important;
    }
}

/* ===== ACCESSIBILITY PERFORMANCE ===== */
/* تحسين الأداء مع إمكانية الوصول */
@media (prefers-reduced-motion: reduce) {
    .animated,
    .transition {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== DARK MODE PERFORMANCE ===== */
/* تحسين الأداء للوضع المظلم */
@media (prefers-color-scheme: dark) {
    .dark-mode-optimized {
        background-color: #1a1a1a;
        color: #ffffff;
    }
}

/* ===== LOW BANDWIDTH OPTIMIZATION ===== */
/* تحسين الأداء للاتصال البطيء */
@media (max-width: 480px) {
    .low-bandwidth-optimized {
        background-image: none !important;
    }
    
    .low-bandwidth-optimized img {
        max-width: 100%;
        height: auto;
    }
} 