/* AdaptiveImages - Styles pour le lazy loading et les transitions */

/* Configuration de base pour toutes les images */
img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Styles pour le lazy loading */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
    background-color: #f5f5f5;
    background-image:
        linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.5) 50%, transparent 60%),
        linear-gradient(90deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px, 20px 20px;
    background-position: 0 0, 0 0;
    min-height: 100px;
}

/* Animation de chargement (shimmer effect) */
.lazy-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.6),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* État chargé */
.ai-loaded {
    opacity: 1;
}

.ai-loaded::before {
    display: none;
}

/* Transition fluide pour les changements d'images */
img[src] {
    transition: opacity 0.2s ease;
}

/* Styles pour les conteneurs d'images */
.image1, .image2, .image3, .image4 {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin: 20px 0;
}

/* Placeholder pour les images en cours de chargement */
.ai-placeholder {
    background: linear-gradient(135deg, #f5f5f5 0%, #eeeeee 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #999;
    font-family: system-ui, -apple-system, sans-serif;
}

.ai-placeholder::after {
    content: '📷';
    font-size: 2rem;
    opacity: 0.5;
}

/* Support pour les images avec aspect-ratio défini */
img[style*="aspect-ratio"] {
    object-fit: cover;
    width: 100%;
}

/* Responsive images avec srcset */
img[srcset] {
    width: 100%;
    height: auto;
}

/* Styles pour les backgrounds adaptatifs */
[ai-bg-src] {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.3s ease;
}

/* Mode debug - affichage des informations */
.ai-debug {
    position: relative;
}

.ai-debug::after {
    content: attr(data-ai-format) ' - ' attr(data-ai-width) 'px';
    position: absolute;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    font-size: 10px;
    font-family: monospace;
}

/* Préférences utilisateur pour les animations */
@media (prefers-reduced-motion: reduce) {
    .lazy-image,
    img[src],
    [ai-bg-src] {
        transition: none;
    }

    .lazy-image::before {
        animation: none;
    }
}

/* Styles pour les petits écrans */
@media (max-width: 768px) {
    .lazy-image {
        min-height: 150px;
    }

    .image1, .image2, .image3, .image4 {
        margin: 15px 0;
    }
}
