/* ==========================================
   LIGHTBOX - Visionneuse d'images moderne
   ========================================== */

.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

/* ===== Overlay (fond sombre) ===== */
.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    cursor: zoom-out;
}

/* ===== Conteneur principal ===== */
.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 100px;
    box-sizing: border-box;
}

/* ===== Header avec bouton fermer ===== */
.lightbox-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px;
    display: flex;
    justify-content: flex-end;
    z-index: 10;
}

.lightbox-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-close:active {
    transform: scale(0.95);
}

/* ===== Zone de l'image ===== */
.lightbox-image-wrapper {
    position: relative;
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.lightbox-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    cursor: zoom-in;
    animation: lightboxFadeIn 0.3s ease;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

@keyframes lightboxFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== Boutons de navigation ===== */
.lightbox-nav {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-nav:active {
    transform: scale(0.95);
}

.lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== Compteur ===== */
.lightbox-counter {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 16px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    z-index: 10;
}

/* ===== Miniatures ===== */
.lightbox-thumbnails {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    max-width: 90%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.lightbox-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.lightbox-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.lightbox-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.lightbox-thumbnail:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.lightbox-thumbnail.active {
    opacity: 1;
    border-color: var(--primary, #ffd600);
    transform: scale(1.1);
}

/* ===== Responsive ===== */

/* Tablette */
@media (max-width: 900px) {
    .lightbox-content {
        padding: 50px 15px 90px;
    }

    .lightbox-nav {
        width: 48px;
        height: 48px;
    }

    .lightbox-close {
        width: 44px;
        height: 44px;
    }

    .lightbox-counter {
        font-size: 14px;
        padding: 8px 16px;
    }

    .lightbox-thumbnail {
        width: 50px;
        height: 50px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .lightbox-content {
        padding: 40px 10px 80px;
    }

    .lightbox-image-wrapper {
        gap: 10px;
    }

    .lightbox-nav {
        width: 44px;
        height: 44px;
    }

    .lightbox-nav svg {
        width: 24px;
        height: 24px;
    }

    .lightbox-close {
        width: 40px;
        height: 40px;
    }

    .lightbox-counter {
        bottom: 70px;
        font-size: 13px;
        padding: 6px 14px;
    }

    .lightbox-thumbnails {
        padding: 8px;
        gap: 6px;
    }

    .lightbox-thumbnail {
        width: 45px;
        height: 45px;
    }
}

/* Très petit mobile */
@media (max-width: 480px) {
    .lightbox-content {
        padding: 30px 5px 70px;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
        position: absolute;
        bottom: 90px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-header {
        padding: 15px;
    }

    .lightbox-counter {
        bottom: 60px;
    }

    .lightbox-thumbnails {
        bottom: 10px;
        padding: 6px;
        gap: 4px;
    }

    .lightbox-thumbnail {
        width: 40px;
        height: 40px;
    }
}

/* ===== Accessibilité ===== */
.lightbox-close:focus-visible,
.lightbox-nav:focus-visible,
.lightbox-thumbnail:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* ===== Animations réduites ===== */
@media (prefers-reduced-motion: reduce) {
    .lightbox,
    .lightbox-image,
    .lightbox-nav,
    .lightbox-close,
    .lightbox-thumbnail {
        transition: none;
        animation: none;
    }
}

/* ===== Masquer le scroll du body quand lightbox ouverte ===== */
body.lightbox-open {
    overflow: hidden;
}
