/**
 * 🎨 Styles Lightbox + Carrousel
 */

/* ============================================
   LIGHTBOX CONTAINER
   ============================================ */

.photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.photo-lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* Overlay sombre */
.lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
}

/* Container principal */
.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================
   IMAGE PRINCIPALE
   ============================================ */

.lightbox-image-container {
    position: relative;
    width: 100%;
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

/* Loader */
.lightbox-loader {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   NAVIGATION (FLÈCHES)
   ============================================ */

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(102, 126, 234, 0.9);
    border-color: rgba(102, 126, 234, 1);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

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

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

/* Mobile : boutons plus petits */
@media (max-width: 768px) {
    .lightbox-prev,
    .lightbox-next {
        width: 48px;
        height: 48px;
    }
    
    .lightbox-prev {
        left: 1rem;
    }
    
    .lightbox-next {
        right: 1rem;
    }
}

/* ============================================
   HEADER (COMPTEUR + FERMER)
   ============================================ */

.lightbox-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
    z-index: 10;
}

.lightbox-counter {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.lightbox-close {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: rgba(239, 68, 68, 0.9);
    border-color: rgb(239, 68, 68);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

/* ============================================
   INFO (NOM ENTREPRISE)
   ============================================ */

.lightbox-info {
    position: absolute;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    padding: 1rem 2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 600px;
    z-index: 10;
}

.lightbox-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
}

.lightbox-info p {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Mobile : info plus compacte */
@media (max-width: 768px) {
    .lightbox-info {
        bottom: 120px;
        padding: 0.75rem 1.5rem;
        max-width: 90%;
    }
    
    .lightbox-info h3 {
        font-size: 1.1rem;
    }
    
    .lightbox-info p {
        font-size: 0.85rem;
    }
}

/* ============================================
   MINIATURES
   ============================================ */

.lightbox-thumbnails {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    max-width: 90%;
    z-index: 10;
}

/* Masquer scrollbar */
.lightbox-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.lightbox-thumbnails::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    opacity: 0.5;
}

.thumbnail:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.thumbnail.active {
    opacity: 1;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Mobile : miniatures plus petites */
@media (max-width: 768px) {
    .lightbox-thumbnails {
        bottom: 1rem;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .thumbnail {
        width: 60px;
        height: 60px;
    }
}

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

@media (max-width: 768px) {
    .lightbox-content {
        padding: 1rem;
    }
    
    .lightbox-image-container {
        height: 50vh;
        margin-bottom: 1rem;
    }
    
    .lightbox-header {
        padding: 1rem;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.photo-lightbox.active .lightbox-content {
    animation: fadeInScale 0.3s ease;
}

/* ============================================
   ACCESSIBILITÉ
   ============================================ */

.lightbox-prev:focus,
.lightbox-next:focus,
.lightbox-close:focus {
    outline: 2px solid #667eea;
    outline-offset: 4px;
}

/* Mode clair (si jamais) */
@media (prefers-color-scheme: light) {
    .lightbox-overlay {
        background: rgba(0, 0, 0, 0.92);
    }
}
