/* Galerie d'images avec lightbox */

.fim-gallery-container {
    margin: 40px 0;
}

.fim-gallery {
    display: grid;
    gap: 20px;
    margin: 0 auto;
}

.fim-gallery-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.fim-gallery-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.fim-gallery-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.fim-gallery-item-wrapper {
    display: flex;
    flex-direction: column;
}

.fim-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    max-height: 320px;
    background: #f8f8f8;
    border: solid 1px;
    border-color: #3EBEED;
}

.fim-gallery-caption {
    margin-top: 10px;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    text-align: center;
}

.fim-gallery-link {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 220px;
    max-height: 320px;
    position: relative;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.fim-gallery-item img {
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: contain;
    transition: transform 0.3s ease;
    display: block;
}

.fim-gallery-overlay {
    display: none;
}

.fim-gallery-link:hover img {
    cursor: pointer;
}

.fim-gallery-icon {
    display: none;
}

/* Lightbox */
.fim-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fim-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
}

.fim-lightbox-content {
    position: relative;
    z-index: 100000;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fim-lightbox-image-container {
    max-width: 100%;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fim-lightbox-image {
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.fim-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 40px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    z-index: 100001;
    line-height: 1;
    padding: 0;
}

.fim-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.fim-lightbox-prev,
.fim-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 60px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    z-index: 100001;
    line-height: 1;
    padding: 0;
}

.fim-lightbox-prev {
    left: 20px;
}

.fim-lightbox-next {
    right: 20px;
}

.fim-lightbox-prev:hover,
.fim-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
}

.fim-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 100001;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .fim-gallery-columns-3,
    .fim-gallery-columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .fim-gallery {
        gap: 15px;
    }

    .fim-gallery-item,
    .fim-gallery-link {
        min-height: 180px;
        max-height: 260px;
    }

    .fim-gallery-item img {
        max-height: 260px;
    }
    
    .fim-lightbox-prev,
    .fim-lightbox-next {
        width: 50px;
        height: 50px;
        font-size: 40px;
    }
    
    .fim-lightbox-prev {
        left: 10px;
    }
    
    .fim-lightbox-next {
        right: 10px;
    }
    
    .fim-lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 30px;
    }
}

@media screen and (max-width: 480px) {
    .fim-gallery-columns-2,
    .fim-gallery-columns-3,
    .fim-gallery-columns-4 {
        grid-template-columns: 1fr;
    }
    
    .fim-gallery {
        gap: 10px;
    }

    .fim-gallery-item,
    .fim-gallery-link {
        min-height: 160px;
        max-height: 220px;
    }

    .fim-gallery-item img {
        max-height: 220px;
    }
}
