/*
 * Image Fallback and Error Handling
 * Provides fallback when images fail to load
 */

/* Image error handling */
.premium-hero-slide img {
    background: linear-gradient(135deg, #2c5282, #3182ce) !important;
}

.premium-hero-slide img[alt]:after {
    content: "📷 " attr(alt);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1rem;
    text-align: center;
    background: rgba(0,0,0,0.7);
    padding: 20px;
    border-radius: 10px;
    z-index: 3;
    display: none;
}

/* Show fallback when image fails to load */
.premium-hero-slide img:not([src]),
.premium-hero-slide img[src=""],
.premium-hero-slide img[src="#"] {
    background: linear-gradient(135deg, #2c5282, #3182ce) !important;
}

.premium-hero-slide img:not([src]):after,
.premium-hero-slide img[src=""]:after,
.premium-hero-slide img[src="#"]:after {
    display: block !important;
}

/* Ensure images display on mobile */
@media (max-width: 768px) {
    .premium-hero-slide {
        background: linear-gradient(135deg, #2c5282, #3182ce) !important;
    }
    
    .premium-hero-slide img {
        opacity: 1 !important;
        visibility: visible !important;
        display: block !important;
    }
    
    /* Alternative background images if img tags don't work */
    .premium-hero-slide:nth-child(1) {
        background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.5)), url('images/trang_chinh.png') center/cover no-repeat !important;
    }
    
    .premium-hero-slide:nth-child(2) {
        background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.5)), url('images/trang_chinh1.jpg') center/cover no-repeat !important;
    }
    
    .premium-hero-slide:nth-child(3) {
        background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.5)), url('images/trang_chinh2.jpg') center/cover no-repeat !important;
    }
    
    .premium-hero-slide:nth-child(4) {
        background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.5)), url('images/trang_chinh.png') center/cover no-repeat !important;
    }
}

/* Loading state */
.premium-hero-slide img {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Error state with JavaScript */
.image-error {
    background: linear-gradient(135deg, #2c5282, #3182ce) !important;
}

.image-error:before {
    content: "📷 Ảnh đang tải...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1rem;
    text-align: center;
    background: rgba(0,0,0,0.7);
    padding: 20px;
    border-radius: 10px;
    z-index: 3;
}

/* Mobile specific image handling */
@media (max-width: 768px) {
    .premium-hero-slider {
        background: linear-gradient(135deg, #2c5282, #3182ce) !important;
    }
    
    /* Show content even without images */
    .premium-slide-caption {
        background: rgba(0,0,0,0.8) !important;
        margin-top: auto !important;
    }
}