/* Lazy Loading Styles */

/* Base styles for lazy-loaded images */
img.lazyload,
img.lazyloading {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    background-color: #f5f5f5;
    background-image: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* When image is loaded */
img.lazyloaded {
    opacity: 1;
    background: none;
    animation: none;
}

/* Error state */
img.lazyload-error {
    background-color: #ffebee;
    position: relative;
}

img.lazyload-error::after {
    content: '⚠';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #f44336;
}

/* Shimmer animation for loading state */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Container for responsive images */
.responsive-image {
    position: relative;
    overflow: hidden;
    background-color: #f5f5f5;
}

/* Aspect ratio containers */
.aspect-ratio-box {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio (adjust as needed) */
    background: #f5f5f5;
}

.aspect-ratio-box img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Product image specific styles */
.product-image {
    width: 100%;
    height: 200px; /* Adjust based on your design */
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Hover effects for product images */
.product-card:hover .product-image {
    transform: scale(1.03);
}

/* Blur-up technique for progressive loading */
.blur-up {
    filter: blur(5px);
    transition: filter 0.5s ease-out;
}

.blur-up.lazyloaded {
    filter: blur(0);
}

/* For background images */
.lazy-bg {
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    transition: background-image 0.3s ease-in-out;
}

/* Print styles */
@media print {
    img.lazyload,
    img.lazyloading {
        opacity: 1 !important;
        background: none !important;
        animation: none !important;
    }
}

/* Performance optimizations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
