/* ==========================================================================
   Carousel commun : styles du conteneur + keyframes mutualisés des slides
   Extrait de templates/carousel/carousel-container.html et des blocs <style>
   des slides (keyframes dupliqués : slideInDown/slideInUp/fadeIn/bounce/
   slideInLeft/drift).
   Chargé en dernier par carousel-container.html (comme le <style> d'origine)
   pour préserver la cascade : son @keyframes pulse (opacité) l'emporte sur
   celui des slides, comme auparavant.
   ========================================================================== */

/* Keyframes mutualisés (utilisés par tous les slides) */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes drift {
    0% { transform: translateX(0); }
    100% { transform: translateX(60px); }
}

/* Conteneur du carousel */
.home-carousel-container {
    position: relative;
    width: 100%;
    margin: 2rem 0;
}

.carousel-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.carousel-slides {
    position: relative;
    width: 100%;
    display: flex;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-slide-wrapper {
    width: 100%;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.carousel-slide-wrapper[data-active="true"] {
    opacity: 1;
}

.carousel-slide-wrapper:not([data-active="true"]) {
    position: absolute;
    top: 0;
    left: 0;
}

/* Navigation dots */
.carousel-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 10;
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.carousel-dot:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.2);
}

.carousel-dot.active {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Navigation arrows */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
    z-index: 10;
}

.carousel-arrow {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 0, 0, 0.3);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    pointer-events: auto;
    opacity: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.carousel-wrapper:hover .carousel-arrow {
    opacity: 1;
}

.carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(0, 0, 0, 0.5);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.carousel-arrow:active {
    transform: scale(0.95);
}

/* Play/Pause controls */
.carousel-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.carousel-wrapper:hover .carousel-controls {
    opacity: 1;
}

.carousel-wrapper.paused .carousel-controls {
    opacity: 1;
}

.carousel-control {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.carousel-control:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.carousel-control.paused i::before {
    content: '\f04b'; /* play icon */
}

/* Responsive */
@media (max-width: 768px) {
    .home-carousel-container {
        margin: 1rem 0;
    }

    .carousel-wrapper {
        border-radius: 16px;
    }

    .carousel-nav {
        padding: 0 15px;
    }

    .carousel-arrow {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        opacity: 1; /* Always visible on mobile */
    }

    .carousel-dots {
        bottom: 15px;
        gap: 10px;
    }

    .carousel-dot {
        width: 10px;
        height: 10px;
    }

    .carousel-controls {
        top: 15px;
        right: 15px;
        opacity: 1; /* Always visible on mobile */
    }

    .carousel-control {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
}

/* Smooth loading animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.home-carousel-container {
    animation: slideIn 0.8s ease-out;
}

/* Progress bar */
.carousel-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to bottom,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0.4) 100%);
    backdrop-filter: blur(10px);
    z-index: 11;
}

.carousel-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    width: 0%;
    transition: width linear;
    will-change: width;
    position: relative;
}

.carousel-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8));
    filter: blur(2px);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.carousel-wrapper.paused .carousel-progress-fill {
    animation-play-state: paused;
}
