/**
 * Lightbox - Visionneuse d'images plein écran
 * Styles pour la galerie photos
 */

/* Container lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* Contenu */
.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Image */
.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

.lightbox-image.loading {
    opacity: 0.3;
}

/* Légende */
.lightbox-caption {
    margin-top: 1rem;
    color: white;
    font-size: 1rem;
    text-align: center;
    max-width: 80vw;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
}

/* Compteur */
.lightbox-counter {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 0.875rem;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 500;
}

/* Bouton fermer */
.lightbox-close {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10001;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.lightbox-close:focus {
    outline: 3px solid #6FAFA6;
    outline-offset: 2px;
}

/* Boutons navigation */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10001;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev:focus,
.lightbox-next:focus {
    outline: 3px solid #6FAFA6;
    outline-offset: 2px;
}

.lightbox-prev:disabled,
.lightbox-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Mobile */
@media (max-width: 768px) {
    .lightbox-counter {
        top: 10px;
        right: 10px;
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }

    .lightbox-close {
        top: 10px;
        left: 10px;
        width: 40px;
        height: 40px;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.15);
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-caption {
        font-size: 0.875rem;
        max-width: 90vw;
        margin-top: 0.5rem;
    }

    .lightbox-image {
        max-height: 70vh;
    }
}

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

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

/* Mode réduit animations */
@media (prefers-reduced-motion: reduce) {
    .lightbox,
    .lightbox-image,
    .lightbox-close,
    .lightbox-prev,
    .lightbox-next {
        transition: none !important;
        animation: none !important;
    }
}

/* Grid galerie */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

@media (max-width: 640px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
    }
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.gallery-item:focus {
    outline: 3px solid #6FAFA6;
    outline-offset: 2px;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Overlay sur hover */
.gallery-item::after {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gallery-item:hover::after {
    opacity: 1;
}

/* High contrast mode */
:root[data-contrast="high"] .lightbox {
    background: #000000;
}

:root[data-contrast="high"] .lightbox-close,
:root[data-contrast="high"] .lightbox-prev,
:root[data-contrast="high"] .lightbox-next {
    background: #ffffff;
    border-color: #000000;
    color: #000000;
}

:root[data-contrast="high"] .lightbox-caption,
:root[data-contrast="high"] .lightbox-counter {
    background: #ffffff;
    color: #000000;
    border: 2px solid #000000;
}
