/* ملف الأنيميشن الخفيف والمحسن */
/* تحسين الأداء على الهاتف والكمبيوتر */

/* تحسين أنيميشن الإشعارات */
.cart-notification {
    animation: slideInLight 0.1s ease-out;
}

@keyframes slideInLight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* تحسين أنيميشن البطاقات - إصلاح مشكلة الاختفاء */
.product-card {
    /* إزالة الأنيميشن التلقائي لتجنب الاختفاء */
    /* animation: fadeInLight 0.3s ease-out; */
    /* تحسين الأداء */
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* أنيميشن الظهور التدريجي - يستخدم فقط عند إضافة الكلاس يدوياً */
.fade-in-light {
    animation: fadeInLight 0.15s ease-out;
}

@keyframes fadeInLight {
    from {
        opacity: 0;
        transform: translateY(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تحسين أنيميشن الأزرار */
.btn-light-animation {
    transition: all 0.1s ease-out !important;
    will-change: transform, box-shadow;
    transform: translateZ(0);
}

.btn-light-animation:hover {
    transform: translateY(-1px) !important;
}

.btn-light-animation:active {
    transform: translateY(0) !important;
    transition: all 0.05s ease-out !important;
}

/* تحسين أنيميشن حقول الإدخال */
.input-light-animation {
    transition: border-color 0.1s ease-out !important;
    will-change: border-color, box-shadow;
    transform: translateZ(0);
}

.input-light-animation:focus {
    box-shadow: 0 0 4px rgba(255,215,0,0.1) !important;
}

/* تحسين أنيميشن القوائم */
.select-light-animation {
    transition: border-color 0.1s ease-out !important;
    will-change: border-color, box-shadow;
    transform: translateZ(0);
}

.select-light-animation:focus {
    box-shadow: 0 0 4px rgba(255,215,0,0.1) !important;
}

/* تحسين أنيميشن الصور */
.image-light-animation {
    transition: transform 0.1s ease-out !important;
    will-change: transform;
    transform: translateZ(0);
}

.image-light-animation:hover {
    transform: scale(1.01) !important;
}

/* تحسين أنيميشن الروابط */
.link-light-animation {
    transition: color 0.1s ease-out !important;
    will-change: color;
    transform: translateZ(0);
}

.link-light-animation:hover {
    transform: none !important;
}

/* تحسين أنيميشن الشارات */
.badge-light-animation {
    transition: transform 0.1s ease-out !important;
    will-change: transform;
    transform: translateZ(0);
}

.badge-light-animation:hover {
    transform: scale(1.01) !important;
}

/* تحسين أنيميشن التحميل */
.loading-light-animation {
    animation: pulseLight 1.5s ease-in-out infinite;
}

@keyframes pulseLight {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.95;
        transform: scale(1.005);
    }
}

/* تحسين أنيميشن الظهور التدريجي */
.slide-up-light {
    animation: slideUpLight 0.15s ease-out;
}

@keyframes slideUpLight {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تحسين أنيميشن التمرير */
.scroll-smooth-light {
    scroll-behavior: smooth;
}

/* تحسين أنيميشن التحديث */
.update-light-animation {
    transition: opacity 0.1s ease-out !important;
    will-change: opacity;
    transform: translateZ(0);
}

.update-light-animation.updating {
    opacity: 0.9;
}

/* تحسين أنيميشن الإخفاء */
.hide-light-animation {
    animation: hideLight 0.1s ease-in;
}

@keyframes hideLight {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.99);
    }
}

/* تحسين الأداء على الأجهزة المحمولة */
@media (max-width: 768px) {
    /* إزالة جميع الأنيميشن على الهاتف لتحسين الأداء */
    .btn-light-animation:hover {
        transform: none !important;
    }
    
    .image-light-animation:hover {
        transform: none !important;
    }
    
    .link-light-animation:hover {
        transform: none !important;
    }
    
    .badge-light-animation:hover {
        transform: none !important;
    }

    /* تقليل وقت الأنيميشن على الهاتف */
    .btn-light-animation,
    .input-light-animation,
    .select-light-animation,
    .image-light-animation,
    .link-light-animation,
    .badge-light-animation {
        transition: none !important;
    }

    /* إزالة الأنيميشن الثقيل على الهاتف */
    .fade-in-light {
        animation: none !important;
        opacity: 1 !important;
    }

    .slide-up-light {
        animation: none !important;
        opacity: 1 !important;
    }

    .loading-light-animation {
        animation: none !important;
    }
}

/* تحسين الأداء على الأجهزة الضعيفة */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .btn-light-animation,
    .input-light-animation,
    .select-light-animation,
    .image-light-animation,
    .link-light-animation,
    .badge-light-animation {
        transition: none !important;
    }
}

/* تحسينات إضافية للأداء */
* {
    /* تحسين الأداء */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* تحسين تحميل الصور */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* تحسين التمرير */
html {
    scroll-behavior: smooth;
}

/* تحسين الأداء للعناصر الثابتة */
.fixed, .sticky {
    transform: translateZ(0);
    will-change: transform;
}
