/* بهینه‌سازی عملکرد برای صفحه منو */

/* بهینه‌سازی تصاویر */
.product-image {
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
    contain: layout style paint;
    transition: opacity 0.3s ease;
}

/* Placeholder و loading animation */
.lazy-image {
    opacity: 0;
    filter: blur(5px);
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
    filter: blur(0);
}

/* Skeleton loading */
.product-image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    z-index: 1;
}

.product-image-container.loaded::before {
    display: none;
}

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

/* بهینه‌سازی انیمیشن‌ها */
.product-card {
    will-change: transform, opacity;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* بهینه‌سازی اسکرول */
.products-scroll {
    contain: layout style;
    will-change: scroll-position;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.products-scroll::-webkit-scrollbar {
    display: none;
}

/* بهینه‌سازی کانتینرها */
.product-image-container {
    contain: layout style paint;
}

/* بهینه‌سازی فونت‌ها */
@font-face {
    font-family: 'FontAwesome';
    font-display: swap;
}

/* بهینه‌سازی انیمیشن‌های ورود */
@keyframes fadeInOptimized {
    from {
        opacity: 0;
        transform: translateY(20px) translateZ(0);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

.fade-in-optimized {
    animation: fadeInOptimized 0.6s ease forwards;
    will-change: opacity, transform;
}

/* بهینه‌سازی hover effects */
.product-card:hover .product-image {
    transform: scale(1.08) translateZ(0);
}

/* بهینه‌سازی برای موبایل */
@media (max-width: 768px) {
    .product-image {
        contain: layout style paint;
    }
    
    .products-scroll {
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }
    
    .product-card {
        scroll-snap-align: start;
    }
    
    /* بهبود loading در موبایل */
    .lazy-image {
        transition: opacity 0.2s ease, filter 0.2s ease;
    }
    
    .product-image-container::before {
        animation-duration: 1s;
    }
}

/* بهینه‌سازی برای تبلت */
@media (max-width: 1024px) {
    .product-image {
        contain: layout style paint;
    }
    
    .lazy-image {
        transition: opacity 0.25s ease, filter 0.25s ease;
    }
}

/* بهینه‌سازی برای دسکتاپ */
@media (min-width: 1025px) {
    .product-image {
        contain: layout style paint;
    }
    
    .lazy-image {
        transition: opacity 0.3s ease, filter 0.3s ease;
    }
}

/* بهبود performance برای اسکرول */
.products-scroll {
    contain: layout style;
    will-change: scroll-position;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overscroll-behavior: contain;
}

.products-scroll::-webkit-scrollbar {
    display: none;
}

/* بهینه‌سازی انیمیشن‌ها */
.product-card {
    will-change: transform, opacity;
    backface-visibility: hidden;
    transform: translateZ(0);
    contain: layout style paint;
}

/* بهبود hover effects */
.product-card:hover .product-image {
    transform: scale(1.08) translateZ(0);
}

/* بهینه‌سازی فونت‌ها */
@font-face {
    font-family: 'FontAwesome';
    font-display: swap;
}

/* بهینه‌سازی انیمیشن‌های ورود */
@keyframes fadeInOptimized {
    from {
        opacity: 0;
        transform: translateY(20px) translateZ(0);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

.fade-in-optimized {
    animation: fadeInOptimized 0.6s ease forwards;
    will-change: opacity, transform;
}

/* بهینه‌سازی برای تبلت */
@media (max-width: 1024px) {
    .product-image {
        contain: layout style paint;
    }
}

/* بهینه‌سازی برای دسکتاپ */
@media (min-width: 1025px) {
    .product-image {
        contain: layout style paint;
    }
} 