/* ========================================
   CORRECTIFS CAROUSEL ET LIGHTBOX MOBILE  
   Résout le problème de scroll bloqué
   ======================================== */

/* 1. LIGHTBOX - Améliorations mobile */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto; /* Permettre scroll dans la lightbox si nécessaire */
}

.lightbox.active {
    display: flex;
}


/* Contenu lightbox responsive */
.lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 85vh;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.lightbox-content img,
.lightbox-content video,
.lightbox-content iframe {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
}

/* Boutons lightbox plus accessibles sur mobile */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: fixed;
    background: rgba(255, 87, 34, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10001;
    color: white !important;
    font-size: 24px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.lightbox-close {
    top: 2rem;
    right: 2rem;
}

.lightbox-prev {
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
}

/* États hover/active */
.lightbox-close:hover,
.lightbox-close:active,
.lightbox-prev:not(:disabled):hover,
.lightbox-prev:not(:disabled):active,
.lightbox-next:not(:disabled):hover,
.lightbox-next:not(:disabled):active {
    background: rgba(230, 74, 25, 1);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(255, 87, 34, 0.5);
}

.lightbox-prev:hover,
.lightbox-prev:active {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-next:hover,
.lightbox-next:active {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev:disabled,
.lightbox-next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(108, 117, 125, 0.6);
}

/* Mobile - Boutons plus petits mais toujours visibles */
@media (max-width: 768px) {
    .lightbox {
        padding: 0.5rem;
    }
    
    .lightbox-content {
        max-width: 98vw;
        max-height: 90vh;
    }
    
    .lightbox-content img,
    .lightbox-content video,
    .lightbox-content iframe {
        max-height: 75vh;
    }
    
    .lightbox-close,
    .lightbox-prev,
    .lightbox-next {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .lightbox-close {
        top: 1rem;
        right: 1rem;
    }
    
    .lightbox-prev {
        left: 1rem;
    }
    
    .lightbox-next {
        right: 1rem;
    }
}

@media (max-width: 480px) {
    .lightbox-close,
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .lightbox-prev {
        left: 0.5rem;
    }
    
    .lightbox-next {
        right: 0.5rem;
    }
}

/* 2. MODAL ALBUM - Corrections mobile */
.album-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto; /* Permettre scroll dans la modal */
    padding: 0;
}

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

.modal-content-album {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    position: relative;
    z-index: 1;
    min-height: auto;
    max-height: none;
}

/* Mobile - Modal plein écran */
@media (max-width: 768px) {
    .album-modal {
        padding: 0;
    }
    
    .modal-content-album {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .album-images-grid {
        flex: 1;
        overflow-y: auto;
        padding: 1rem;
    }
}


/* 3. CAROUSEL PRINCIPAL - Fix boutons mobiles */
@media (max-width: 768px) {
    .carousel-arrow {
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
        background: rgba(255, 87, 34, 0.95) !important;
        border: 2px solid rgba(255, 255, 255, 0.9) !important;
        backdrop-filter: blur(10px);
        box-shadow: 0 4px 12px rgba(255, 87, 34, 0.4);
    }

    .carousel-arrow:active {
        background: rgba(230, 74, 25, 1) !important;
        transform: translateY(-50%) scale(1.05) !important;
    }

    .carousel-arrow.prev { left: 10px !important; }
    .carousel-arrow.next { right: 10px !important; }
}

/* 4. SCROLL CORPOREL - Correction du blocage */
.body-scroll-lock {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
}

/* Sur mobile, utiliser une approche différente */
@media (max-width: 768px) {
    .body-scroll-lock {
        overflow: hidden !important;
        /* Pas de position fixed sur mobile pour éviter les problèmes */
        position: static;
        width: auto;
        top: auto;
        left: auto;
    }
}

/* 5. NAVIGATION GESTURES MOBILE */
.lightbox,
.album-modal {
    touch-action: pan-y pinch-zoom;
}

/* Support swipe gestures sur mobile */
@media (max-width: 768px) {
    .lightbox-content,
    .modal-content-album {
        touch-action: pan-y;
    }
}

/* 6. INDICATEURS DE CHARGEMENT */
.lightbox-content::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 87, 34, 0.2);
    border-top: 4px solid rgba(255, 87, 34, 0.8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: -1;
}

.lightbox-content:has(img),
.lightbox-content:has(video),
.lightbox-content:has(iframe) {
}

.lightbox-content:has(img)::before,
.lightbox-content:has(video)::before,
.lightbox-content:has(iframe)::before {
    display: none;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}