/**
 * Gallery CSS - Styles pour la Galerie Média Enrichie
 * Support: 5 images + vidéo, lightbox, zoom, navigation
 */

/* ==================== Galerie Principale ==================== */

.media-gallery {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.main-media-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f5f5f5;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.main-media {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.main-image:hover {
    transform: scale(1.05);
}

/* Video Container */
.video-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    object-fit: cover;
}

/* Navigation Arrows */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #333;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gallery-nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.gallery-prev {
    left: 16px;
}

.gallery-next {
    right: 16px;
}

/* Zoom Button */
.gallery-zoom {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #333;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gallery-zoom:hover {
    background: white;
    transform: scale(1.1);
}

/* ==================== Thumbnails ==================== */

.media-thumbnails {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: #d4af37 #f5f5f5;
}

.media-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.media-thumbnails::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
}

.media-thumbnails::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 3px;
}

.thumbnail {
    flex: 0 0 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.thumbnail:hover {
    border-color: #d4af37;
    transform: translateY(-2px);
}

.thumbnail.active {
    border-color: #d4af37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

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

/* Video Thumbnail */
.thumbnail-video {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    gap: 4px;
}

.thumbnail-video i {
    font-size: 24px;
}

.thumbnail-video span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

/* ==================== Lightbox ==================== */

.media-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 10000;
}

.lightbox-media {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 85vh;
}

.lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-media .video-container {
    width: 90vw;
    max-width: 1200px;
    aspect-ratio: 16 / 9;
}

/* Lightbox Close Button */
.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    transition: all 0.3s ease;
    z-index: 10001;
}

.lightbox-close:hover {
    background: white;
    color: #333;
    transform: rotate(90deg);
}

/* Lightbox Navigation */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    transition: all 0.3s ease;
    z-index: 10001;
    backdrop-filter: blur(10px);
}

.lightbox-nav:hover {
    background: white;
    color: #333;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: -70px;
}

.lightbox-next {
    right: -70px;
}

/* Lightbox Counter */
.lightbox-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

/* ==================== Responsive ==================== */

@media (max-width: 768px) {
    .gallery-nav {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .gallery-prev {
        left: 8px;
    }
    
    .gallery-next {
        right: 8px;
    }
    
    .gallery-zoom {
        width: 36px;
        height: 36px;
        font-size: 16px;
        bottom: 8px;
        right: 8px;
    }
    
    .thumbnail {
        flex: 0 0 60px;
        height: 60px;
    }
    
    .thumbnail-video i {
        font-size: 20px;
    }
    
    .thumbnail-video span {
        font-size: 9px;
    }
    
    .lightbox-nav {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
    }
    
    .lightbox-counter {
        bottom: 20px;
        font-size: 14px;
    }
}

/* ==================== Animations ==================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.media-lightbox {
    animation: fadeIn 0.3s ease;
}

.thumbnail {
    animation: slideIn 0.3s ease backwards;
}

.thumbnail:nth-child(1) { animation-delay: 0.05s; }
.thumbnail:nth-child(2) { animation-delay: 0.1s; }
.thumbnail:nth-child(3) { animation-delay: 0.15s; }
.thumbnail:nth-child(4) { animation-delay: 0.2s; }
.thumbnail:nth-child(5) { animation-delay: 0.25s; }
.thumbnail:nth-child(6) { animation-delay: 0.3s; }

/* ==================== Zoom Effect ==================== */

.main-image.zoomed {
    transform: scale(1.5);
    cursor: zoom-out;
}

/* ==================== Loading State ==================== */

.main-media.loading {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ==================== Accessibility ==================== */

.gallery-nav:focus,
.gallery-zoom:focus,
.lightbox-close:focus,
.lightbox-nav:focus,
.thumbnail:focus {
    outline: 3px solid #d4af37;
    outline-offset: 2px;
}

/* ==================== Print Styles ==================== */

@media print {
    .gallery-nav,
    .gallery-zoom,
    .media-thumbnails,
    .media-lightbox {
        display: none;
    }
    
    .main-image {
        cursor: default;
        transform: none !important;
    }
}
