/**
 * Timeline Gallery Modal Styles
 * Inspired by bwa-our-realisation modal
 *
 * @package BwaTimeline
 */

/* Modal */
.bwatimeline-gallery-modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
}

.bwatimeline-gallery-modal.active {
    opacity: 1;
    visibility: visible;
}

.bwatimeline-gallery-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1;
}

.bwatimeline-gallery-modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 1100px;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.bwatimeline-gallery-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #333;
    z-index: 10;
    transition: opacity 0.3s ease;
    padding: 9px;
}

.bwatimeline-gallery-modal-close:hover {
    opacity: 0.7;
}

.bwatimeline-gallery-modal-close:active {
    opacity: 0.5;
}

.bwatimeline-gallery-modal-close svg {
    width: 20px;
    height: 20px;
}

.bwatimeline-gallery-modal-close svg line {
    transition: all 0.3s ease;
}

.bwatimeline-gallery-modal-close:hover svg .line-1 {
    stroke-dasharray: 22;
    stroke-dashoffset: 22;
    animation: bwaTimelineDrawLine 0.4s ease-out forwards;
}

.bwatimeline-gallery-modal-close:hover svg .line-2 {
    stroke-dasharray: 22;
    stroke-dashoffset: 22;
    animation: bwaTimelineDrawLine 0.4s ease-out 0.1s forwards;
}

@keyframes bwaTimelineDrawLine {
    to {
        stroke-dashoffset: 0;
    }
}

.bwatimeline-gallery-modal-inner {
    display: flex;
    min-height: 500px;
    height: 100%;
    flex: 1;
    overflow: hidden;
}

/* Slider de la modal */
.bwatimeline-modal-slider {
    flex: 1;
    background: #f5f5f5;
    position: relative;
    overflow: hidden;
    display: flex;
    gap: 20px;
    padding: 20px;
}

.bwatimeline-slider-container {
    position: relative;
    width: calc(100% - 149px);
}

.bwatimeline-slider-main {
    flex: 1;
    width: 100%;
    min-height: 320px;
    border-radius: 15px;
    overflow: hidden;
}

.bwatimeline-slider-images {
    display: flex;
    height: 100%;
    align-items: center;
    transition: transform 0.5s ease;
}

/* Swiper specific styles */
.bwatimeline-slider-images.swiper-wrapper {
    height: 100%;
    transition-property: transform;
}

.bwatimeline-slider-images .swiper-slide {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    position: relative;
}

.bwatimeline-slider-images .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Legacy styles for non-Swiper images */
.bwatimeline-slider-images img {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bwatimeline-slider-prev,
.bwatimeline-slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 15px 20px;
    font-size: 18px;
    cursor: pointer;
    z-index: 5;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.bwatimeline-slider-prev {
    left: 15px;
}

.bwatimeline-slider-next {
    right: 15px;
}

.bwatimeline-slider-prev:hover,
.bwatimeline-slider-next:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bwatimeline-slider-prev:active,
.bwatimeline-slider-next:active {
    transform: translateY(-50%) scale(0.95);
}

.bwatimeline-slider-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.bwatimeline-slider-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.bwatimeline-slider-dot:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

.bwatimeline-slider-dot.active {
    background: #fff;
    width: 32px;
    border-radius: 6px;
}

/* Slider de miniatures - À droite en desktop */
.bwatimeline-slider-thumbs-container {
    width: 140px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 5px;
}

.bwatimeline-slider-thumbs-container::-webkit-scrollbar {
    width: 6px;
}

.bwatimeline-slider-thumbs-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.bwatimeline-slider-thumbs-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.bwatimeline-slider-thumbs-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.bwatimeline-slider-thumbs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bwatimeline-slider-thumbs.bwa-thumbs-hidden {
    display: none !important;
}

.bwatimeline-slider-thumbs .swiper-wrapper {
    flex-direction: column;
}

.bwatimeline-slider-thumbs .swiper-slide {
    width: 120px !important;
    height: 120px;
    aspect-ratio: 1 / 1;
    opacity: 0.4;
    transition: opacity 0.3s ease-out;
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
}

.bwatimeline-slider-thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border: 2px solid #fff;
}

.bwatimeline-slider-thumbs img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Empêcher le scroll du body quand la modale est ouverte */
body.bwatimeline-gallery-modal-open {
    overflow: hidden !important;
}

html.bwatimeline-gallery-modal-open {
    overflow: hidden !important;
}

/* ===================================
   RESPONSIVE
   =================================== */

/* Tablette et mobile - Miniatures en bas */
@media (max-width: 968px) {
    .bwatimeline-gallery-modal {
        padding: 14px;
    }

    .bwatimeline-modal-slider {
        flex-direction: column;
        gap: 15px;
    }

    .bwatimeline-gallery-modal-inner {
        min-height: 0;
    }

    .bwatimeline-slider-container {
        flex: 1;
        width: 100%;
    }

    .bwatimeline-slider-main {
        min-height: 280px;
    }

    .bwatimeline-slider-thumbs-container {
        width: 100%;
        height: 120px;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 5px 0;
    }

    .bwatimeline-slider-thumbs-container::-webkit-scrollbar {
        height: 6px;
        width: auto;
    }

    .bwatimeline-slider-thumbs {
        flex-direction: row;
    }

    .bwatimeline-slider-thumbs .swiper-wrapper {
        flex-direction: row;
    }

    .bwatimeline-slider-thumbs .swiper-slide {
        width: 120px !important;
        height: 120px;
    }
}

@media (max-width: 768px) {
    .bwatimeline-gallery-modal {
        padding: 10px;
    }

    .bwatimeline-gallery-modal-content {
        width: 100%;
        max-width: 95%;
        max-height: calc(100vh - 20px);
        border-radius: 12px;
    }

    .bwatimeline-gallery-modal-inner {
        min-height: 0;
    }

    .bwatimeline-modal-slider {
        padding: 15px;
    }

    .bwatimeline-slider-main {
        min-height: 230px;
        border-radius: 12px;
    }

    .bwatimeline-slider-dots {
        bottom: 12px;
    }

    .bwatimeline-gallery-modal-close {
        width: 36px;
        height: 36px;
    }

    .bwatimeline-gallery-modal-close svg {
        width: 18px;
        height: 18px;
    }

    .bwatimeline-slider-prev,
    .bwatimeline-slider-next {
        padding: 12px 16px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .bwatimeline-gallery-modal {
        padding: 8px;
    }

    .bwatimeline-gallery-modal-content {
        max-width: 100%;
        max-height: calc(100vh - 16px);
        border-radius: 10px;
    }

    .bwatimeline-modal-slider {
        padding: 10px;
        gap: 10px;
    }

    .bwatimeline-slider-main {
        min-height: 200px;
    }

    .bwatimeline-slider-prev {
        left: 10px;
    }

    .bwatimeline-slider-next {
        right: 10px;
    }

    .bwatimeline-slider-prev,
    .bwatimeline-slider-next {
        padding: 10px 14px;
        font-size: 14px;
    }

    .bwatimeline-slider-thumbs-container {
        height: 84px;
    }

    .bwatimeline-slider-thumbs .swiper-slide {
        width: 84px !important;
        height: 84px;
    }
}
