/**
 * Lazy Loading Iframes CSS - Story 1.6
 * Skeleton loaders with shimmer animation (Story 1.2 pattern)
 * GPU-accelerated animations with transform (Code Review Fix)
 * prefers-reduced-motion support (WCAG 2.1 AA)
 */

/* Container avec aspect ratio */
.lazy-iframe-container {
    position: relative;
    overflow: hidden;
    width: 100%;
}

/* Aspect ratio 16:9 par défaut */
.aspect-video {
    aspect-ratio: 16 / 9;
}

/* Skeleton loader (visible initially) */
.lazy-iframe-container .skeleton-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f0f0f0;
    z-index: 1;
}

/* Shimmer animation (GPU-accelerated with transform) */
.skeleton-iframe::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Hide skeleton when loading complete */
.lazy-iframe-container.loaded .skeleton-iframe {
    display: none;
}

/* Iframe initial state (hidden) */
.lazy-iframe {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    width: 100%;
    height: 100%;
    border: none;
}

/* Iframe loaded state (visible) */
.lazy-iframe.loaded {
    opacity: 1;
}

/* Error state */
.lazy-iframe-container.error .skeleton-iframe::before {
    animation: none;
    background: #ffebee;
    content: '⚠️ Chargement échoué';
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c62828;
    font-size: 14px;
}

/* prefers-reduced-motion (WCAG 2.1 AA) */
@media (prefers-reduced-motion: reduce) {
    .skeleton-iframe::before {
        animation: none !important;
    }

    .lazy-iframe {
        transition: none !important;
    }
}
