/* ===== IMAGE FIX CSS ===== */
/* CSS untuk memastikan semua gambar tampil dengan benar */

/* Force image display */
img {
    display: block !important;
    max-width: 100% !important;
    height: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Product images specific fixes */
.produk .box .image {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 8px !important;
    background: #f8f9fa !important;
    min-height: 200px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 200px !important;
}

.produk .box .image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: all 0.3s ease !important;
    border-radius: 8px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 2 !important;
    background: #fff !important;
}

.produk .box .image img:hover {
    transform: scale(1.05) !important;
}

/* Home section images */
.home .image img,
.about .image img {
    width: 100% !important;
    height: auto !important;
    max-width: 500px !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Cart images */
.cart-item-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    border-radius: 8px !important;
}

/* Checkout images */
.checkout .order-items img {
    width: 50px !important;
    height: 50px !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Loading placeholder */
.image-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%) !important;
    background-size: 200% 100% !important;
    animation: loading 1.5s infinite !important;
}

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

/* Error placeholder */
.image-error {
    background: #f8f9fa !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #6c757d !important;
    font-size: 2rem !important;
    border: 2px dashed #dee2e6 !important;
    border-radius: 8px !important;
}

.image-error::before {
    content: '🍚' !important;
    font-size: 3rem !important;
}

/* Responsive image fixes */
@media (max-width: 768px) {
    .produk .box .image {
        min-height: 150px !important;
        height: 150px !important;
    }
    
    .produk .box .image img {
        height: 150px !important;
    }
    
    .home .image img,
    .about .image img {
        max-width: 100% !important;
        height: auto !important;
    }
}

@media (max-width: 480px) {
    .produk .box .image {
        min-height: 120px !important;
        height: 120px !important;
    }
    
    .produk .box .image img {
        height: 120px !important;
    }
}

/* Force visibility for all images */
img[src*="beras"],
img[src*="home-"],
img[src*="about-"],
img[src*="menu-"],
img[src*="products/"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-width: 100% !important;
    height: auto !important;
}

/* Lazy loading support */
img[loading="lazy"] {
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

img[loading="lazy"].loaded {
    opacity: 1 !important;
}

/* Print styles */
@media print {
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .produk .box .image {
        border: 2px solid #000 !important;
    }
    
    .produk .box .image img {
        border: 1px solid #000 !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .produk .box .image img {
        transition: none !important;
    }
    
    .produk .box .image img:hover {
        transform: none !important;
    }
    
    .image-loading {
        animation: none !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .produk .box .image {
        background: #2d3748 !important;
    }
    
    .image-error {
        background: #2d3748 !important;
        color: #a0aec0 !important;
        border-color: #4a5568 !important;
    }
}

/* Accessibility improvements */
img:focus {
    outline: 2px solid #4299e1 !important;
    outline-offset: 2px !important;
}

/* Performance optimizations */
img {
    image-rendering: auto !important;
    image-rendering: crisp-edges !important;
    image-rendering: -webkit-optimize-contrast !important;
}

/* WebP support fallback */
.webp img[src$=".jpg"],
.webp img[src$=".png"] {
    /* Styles for browsers that support WebP */
}

.no-webp img[src$=".webp"] {
    /* Fallback for browsers that don't support WebP */
    display: none !important;
}

/* Intersection Observer loading */
img[data-src] {
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

img[data-src].loaded {
    opacity: 1 !important;
}