/**
 * Modal - Modal de détails des réalisations
 * BWA Realisations Elementor Widget
 * Style inspiré de bwa-team
 */

/* Modal */
.bwa-realisation-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;
}

.bwa-realisation-modal.active {
    opacity: 1;
    visibility: visible;
}

.bwa-realisation-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;
}

.bwa-realisation-modal-content {
    position: relative;
    background: #161B2C;
    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;
}

.bwa-realisation-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(11, 14, 23, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #9CA3AF;
    z-index: 10;
    transition: all 0.3s ease;
    padding: 9px;
}

.bwa-realisation-modal-close:hover {
    background: rgba(11, 14, 23, 0.95);
    color: #fff;
}

.bwa-realisation-modal-close:active {
    transform: scale(0.95);
}

.bwa-realisation-modal-close svg {
    width: 20px;
    height: 20px;
}

.bwa-realisation-modal-close svg line {
    transition: all 0.3s ease;
}

.bwa-realisation-modal-close:hover svg .line-1 {
    stroke-dasharray: 22;
    stroke-dashoffset: 22;
    animation: bwaRealisationDrawLine 0.4s ease-out forwards;
}

.bwa-realisation-modal-close:hover svg .line-2 {
    stroke-dasharray: 22;
    stroke-dashoffset: 22;
    animation: bwaRealisationDrawLine 0.4s ease-out 0.1s forwards;
}

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

.bwa-realisation-modal-inner {
    display: flex;
    min-height: 500px;
    flex: 1;
    overflow: hidden;
}

/* Slider de la modal */
.bwa-realisation-modal-slider {
    flex: 0 0 55%;
    background: #0B0E17;
    position: relative;
    overflow: hidden;
}

.bwa-slider-container {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.bwa-slider-images {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease;
}

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

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

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

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

.bwa-slider-prev,
.bwa-slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(22, 27, 44, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    font-size: 18px;
    cursor: pointer;
    z-index: 5;
    transition: all 0.3s ease;
    border-radius: 8px;
    color: #9CA3AF;
}

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

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

.bwa-slider-prev:hover,
.bwa-slider-next:hover {
    background: rgba(22, 27, 44, 0.95);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

.bwa-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);
}

.bwa-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;
}

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

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

/* Slider de miniatures */
.bwa-slider-container .bwa-slider-thumbs {
    width: 100%;
    height: 120px;
    box-sizing: border-box;
    overflow: hidden;
    margin: 0 20px 20px;
}

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

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

.bwa-slider-thumbs .swiper-slide-thumb-active {
    opacity: 1;
}

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

/* Masquer les miniatures sur mobile */
@media (max-width: 768px) {
    .bwa-slider-thumbs {
        display: none;
    }
}

/* Informations de la modal */
.bwa-realisation-modal-info {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.bwa-realisation-modal-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
    padding: 40px 40px 0;
}

.bwa-realisation-modal-description {
    color: #9CA3AF;
    line-height: 1.7;
    padding: 0 40px 20px;
}

.bwa-realisation-modal-description p {
    margin-bottom: 15px;
}

.bwa-realisation-modal-description p:last-child {
    margin-bottom: 0;
}

.bwa-realisation-modal-linked-posts {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(11, 14, 23, 0.3);
    margin-top: auto;
    padding: 10px 40px 40px;
}

.bwa-realisation-modal-linked-posts h4 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
}

.bwa-realisation-modal-linked-posts ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.bwa-realisation-modal-linked-posts li {
    margin: 0;
}

.bwa-realisation-linked-post-item {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
    min-width: 60px;
    background: rgba(22, 27, 44, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.bwa-realisation-linked-post-item:hover {
    transform: translateY(-2px);
    background: rgba(22, 27, 44, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.bwa-realisation-linked-post-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

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

html.bwa-realisation-modal-open {
    overflow: hidden !important;
}

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

@media (max-width: 968px) {
    .bwa-realisation-modal {
        padding: 16px;
        box-sizing: border-box;
    }

    .bwa-realisation-modal-content {
        width: min(960px, calc(100vw - 32px));
        max-height: calc(100vh - 32px);
        border-radius: 20px;
    }

    .bwa-realisation-modal-inner {
        flex-direction: column;
        min-height: 0;
        height: 100%;
    }

    .bwa-realisation-modal-slider {
        flex: 0 0 clamp(280px, 40vh, 360px);
    }

    .bwa-slider-container {
        gap: 12px;
    }

    .bwa-slider-container .bwa-slider-thumbs {
        height: 88px;
        margin: 0 16px 16px;
    }

    .bwa-slider-thumbs .swiper-slide {
        width: 88px;
        height: 88px;
        border-radius: 12px;
    }

    .bwa-realisation-modal-info {
        min-height: 0;
        gap: 20px;
    }

    .bwa-realisation-modal-title {
        font-size: 1.6rem;
        line-height: 1.25;
        padding: 28px 28px 0;
    }

    .bwa-realisation-modal-description {
        padding: 0 28px 20px;
    }

    .bwa-realisation-modal-linked-posts {
        padding: 10px 28px 28px;
    }
}

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

    .bwa-realisation-modal-content {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        border-radius: 14px;
    }

    .bwa-realisation-modal-slider {
        flex: 0 0 260px;
    }

    .bwa-realisation-modal-info {
        gap: 16px;
    }

    .bwa-realisation-modal-title {
        font-size: 1.3rem;
        line-height: 1.25;
        padding: 22px 20px 0;
    }

    .bwa-realisation-modal-description {
        padding: 0 20px 16px;
        font-size: 15px;
        line-height: 1.6;
    }

    .bwa-realisation-modal-linked-posts {
        padding: 8px 20px 20px;
    }

    .bwa-realisation-modal-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }

    .bwa-realisation-modal-close svg {
        width: 18px;
        height: 18px;
    }

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

    .bwa-realisation-modal-linked-posts ul {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
    }

    .bwa-realisation-linked-post-title {
        font-size: 12px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .bwa-realisation-modal-slider {
        flex: 0 0 220px;
    }

    .bwa-realisation-modal-info {
        gap: 15px;
    }

    .bwa-realisation-modal-title {
        padding: 20px 16px 0;
        font-size: 1.15rem;
    }

    .bwa-realisation-modal-description {
        padding: 0 16px 14px;
    }

    .bwa-realisation-modal-linked-posts {
        padding: 8px 16px 16px;
    }

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

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

    .bwa-realisation-modal-linked-posts ul {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .bwa-realisation-linked-post-item {
        aspect-ratio: 16/9;
    }
}
