/* =================================================================
   OPTIMISATION IMAGES HERO - Techniques de performance
   ================================================================= */

/* Préchargement critique des images */
.hero-preload {
    position: absolute;
    top: -9999px;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* Optimisation du carousel hero */
.hero-carousel-background {
    background-color: #006A4E; /* Couleur de fallback */
    min-height: 60vh;
}

.hero-carousel-background .carousel-item {
    position: relative;
    height: 60vh;
    min-height: 500px;
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
}

.hero-carousel-background .carousel-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    /* Chargement progressif */
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.hero-carousel-background .carousel-item img.loaded {
    opacity: 1;
}

/* Images responsives selon la taille d'écran */
@media (max-width: 768px) {
    .hero-carousel-background .carousel-item {
        height: 50vh;
        min-height: 400px;
    }
    
    /* Masquer certaines images sur mobile pour économiser la bande passante */
    .hero-carousel-background .carousel-item:not(.active) {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero-carousel-background .carousel-item {
        height: 40vh;
        min-height: 300px;
    }
}

/* Technique de lazy loading avec intersection observer */
.hero-carousel-background .carousel-item img[data-lazy] {
    opacity: 0;
    filter: blur(5px);
    transition: all 0.3s;
}

.hero-carousel-background .carousel-item img[data-lazy].loaded {
    opacity: 1;
    filter: blur(0);
}

/* Optimisation pour les connexions lentes */
@media (prefers-reduced-data: reduce) {
    .hero-carousel-background .carousel-item:not(.active) {
        display: none;
    }
}

/* Spinner de chargement */
.hero-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.hero-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #FFD700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}