/*
 * Carousel d'images avec modale
 * 
 * @author LGI Sustainable innovation
 * @version 1.0
 */

.image-carousel {
    position: relative;
    width: 100%;
    margin: 40px 0;
    overflow: hidden;
}

.carousel-container {
    position: relative;
    padding: 0 60px;
}

.carousel-track-wrapper {
    overflow: hidden;
    width: 100%;
}

.carousel-track {
    display: flex;
    gap: 20px;
    transition: transform 0.5s ease-in-out;
}

.carousel-slide {
    flex: 0 0 calc(25% - 15px);
    min-width: calc(25% - 15px);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.carousel-slide:hover {
    opacity: 0.8;
}

.carousel-slide img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

.carousel-slide::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 123, 196, 0);
    transition: background 0.3s ease;
    border-radius: 8px;
    pointer-events: none;
}

.carousel-slide:hover::after {
    background: rgba(0, 123, 196, 0.1);
}

/* Boutons de navigation */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--main-color-blue);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.carousel-btn:hover {
    background: var(--main-color-orange);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.carousel-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-btn.prev {
    left: 0;
}

.carousel-btn.next {
    right: 0;
}

.carousel-btn:disabled {
    background: var(--main-color-gray);
    cursor: not-allowed;
    opacity: 0.5;
}

.carousel-btn:disabled:hover {
    transform: translateY(-50%) scale(1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Modale plein écran */
.carousel-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.carousel-modal.active {
    display: flex;
}

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

.modal-content-wrapper {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--main-color-orange);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.modal-close:hover {
    background: var(--main-color-blue);
    transform: rotate(90deg) scale(1.1);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 123, 196, 0.8);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10000;
}

.modal-nav:hover {
    background: var(--main-color-orange);
    transform: translateY(-50%) scale(1.1);
}

.modal-nav.prev {
    left: 30px;
}

.modal-nav.next {
    right: 30px;
}

/* Responsive */
@media screen and (max-width: 1024px) {
    .carousel-slide {
        flex: 0 0 calc(33.333% - 14px);
        min-width: calc(33.333% - 14px);
    }
}

@media screen and (max-width: 768px) {
    .carousel-slide {
        flex: 0 0 calc(50% - 10px);
        min-width: calc(50% - 10px);
    }

    .carousel-slide img {
        height: 200px;
    }

    .carousel-container {
        padding: 0 50px;
    }

    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .modal-nav {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .modal-nav.prev {
        left: 15px;
    }

    .modal-nav.next {
        right: 15px;
    }
}

@media screen and (max-width: 480px) {
    .carousel-slide {
        flex: 0 0 100%;
        min-width: 100%;
    }

    .carousel-slide img {
        height: 180px;
    }

    .carousel-container {
        padding: 0 45px;
    }

    .carousel-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}
