/* Image Loading Animation CSS - Optimized for existing website styles */

.image-container {
    position: relative;
    display: block;
    overflow: hidden;
    background-color: #f8f9fa;
    border-radius: 0;
    width: 100%;
    margin: 0;
    padding: 0;
}

.image-loading {
    position: relative;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    min-height: 150px; /* Minimum height for product thumbnails */
}

.image-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 2px solid #e3e3e3;
    border-top: 2px solid #003360; /* Use website brand color */
    border-radius: 50%;
    animation: loading-spin 1s linear infinite;
    z-index: 2;
}

.image-loading::after {
    content: 'Laden...';
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #666;
    z-index: 2;
    font-family: 'Raleway', Arial, sans-serif; /* Match website font */
}

@keyframes loading-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes loading-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.image-loaded {
    animation: fade-in 0.4s ease-in;
}

@keyframes fade-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.image-error {
    background-color: #f8d7da;
    color: #721c24;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border: 1px solid #f5c6cb;
    min-height: 150px;
}

.image-error::before {
    content: '⚠️ ';
    margin-right: 5px;
}

/* Specific styles for product pages */
.impl_fea_car_img .image-container {
    width: 100%;
    height: auto;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

.impl_fea_car_img .image-loading {
    min-height: 200px; /* Better height for product thumbnails */
    margin: 0 !important;
    border-radius: 0 !important;
}

.impl_fea_car_img {
    margin-bottom: 0 !important;
}

.impl_fea_car_img img.lazy-load,
.impl_fea_car_img .image-loaded {
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

/* Specific styles for product detail slider */
#lightSlider .image-container {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

#lightSlider .image-loading {
    min-height: 350px;
    width: 100% !important;
}

/* Override LightSlider inline styles */
#lightSlider {
    width: 100% !important;
    height: auto !important;
    padding-bottom: 0 !important;
}

#lightSlider li {
    width: 100% !important;
    height: auto !important;
}

#lightSlider img.lazy-load {
    width: 100% !important;
    height: auto !important;
    display: block !important;
}

#lightSlider .image-loaded {
    width: 100% !important;
    height: auto !important;
    display: block !important;
}

/* Force override of any inline styles on the slider container */
.lSSlideWrapper {
    width: 100% !important;
    height: auto !important;
}

.lSSlideOuter {
    width: 100% !important;
    height: auto !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .image-loading::before {
        width: 25px;
        height: 25px;
        border-width: 2px;
    }
    
    .image-loading::after {
        font-size: 10px;
        top: 65%;
    }
    
    .impl_fea_car_img .image-loading {
        min-height: 180px;
    }
}

/* Ensure lazy load images don't interfere with existing CSS */
img.lazy-load {
    display: block !important;
    max-width: 100%;
    height: auto;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Only apply to loaded lazy images */
img.image-loaded {
    display: block !important;
    max-width: 100%;
    height: auto;
}

/* Loading container for grid layouts */
.impl_fea_car_box .image-container {
    margin-bottom: 15px;
}

/* Fix for any Bootstrap conflicts */
.image-container .img-fluid {
    width: 100%;
    height: auto;
}

/* Hover effects preservation */
.impl_fea_car_img:hover .image-loaded {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

/* Fix for lightslider compatibility */
.lSSlideOuter .image-container {
    height: 100% !important;
    width: 100% !important;
    display: block !important;
    position: relative !important;
}

.lSSlideOuter .image-loading {
    height: 100% !important;
    min-height: 300px;
    width: 100% !important;
}

.lSSlideOuter li {
    height: auto !important;
}

/* Override any Bootstrap/CSS conflicts for sliders */
.demo ul li {
    margin: 0 !important;
    padding: 0 !important;
}

.demo .image-container {
    height: auto !important;
    min-height: 300px;
}

/* Prevent extreme widths in LightSlider while preserving functionality */
.lSSlideWrapper {
    max-width: 100% !important;
    overflow: hidden !important;
}

#lightSlider li {
    max-width: 100% !important;
}