/**
 * FGS Gallery Styles
 * Version: 3.14.0
 */

/* ========================================
   LAYOUT GRID (Classique)
   ======================================== */

.fgs-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--fgs-columns, 3), 1fr);
    gap: 15px;
    padding: 20px 0;
    margin: 0;
}

.fgs-gallery-grid .fgs-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 1;
    background: #f0f0f0;
    cursor: pointer;
}

/* ========================================
   LAYOUT MASONRY (Pinterest style)
   ======================================== */

.fgs-gallery-masonry {
    column-count: var(--fgs-columns, 3);
    column-gap: 15px;
    padding: 20px 0;
    margin: 0;
}

.fgs-gallery-masonry .fgs-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 15px;
    break-inside: avoid;
    background: #f0f0f0;
    cursor: pointer;
    display: inline-block;
    width: 100%;
}

.fgs-gallery-masonry .fgs-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   LAYOUT SLIDER (Carousel)
   ======================================== */

.fgs-gallery-slider {
    position: relative;
    max-width: 100%;
    margin: 20px 0;
}

.fgs-slider-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    /* background défini via shortcode slider_bg */
}

.fgs-slider-track {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.fgs-slider-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fgs-slider-item.active {
    opacity: 1;
    z-index: 1;
}

.fgs-slider-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.fgs-slider-prev,
.fgs-slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 40px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.fgs-slider-prev:hover,
.fgs-slider-next:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.fgs-slider-prev {
    left: 20px;
}

.fgs-slider-next {
    right: 20px;
}

.fgs-slider-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.fgs-slider-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
}

.fgs-slider-dot.active {
    background: #0073aa;
    transform: scale(1.3);
}

.fgs-slider-dot:hover {
    background: #888;
}

/* ========================================
   COMMUN À TOUS LES LAYOUTS
   ======================================== */

.fgs-gallery-item a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.fgs-gallery-grid .fgs-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.fgs-gallery-masonry .fgs-gallery-item img {
    transition: transform 0.3s ease;
}

/* Overlay au hover (Grid et Masonry) */
.fgs-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fgs-gallery-item:hover .fgs-gallery-overlay {
    opacity: 1;
}

.fgs-gallery-item:hover img {
    transform: scale(1.05);
}

.fgs-gallery-icon {
    font-size: 32px;
    color: white;
}

/* Message vide */
.fgs-gallery-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Message erreur */
.fgs-error {
    padding: 15px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    color: #c33;
}

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

@media (max-width: 768px) {
    .fgs-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .fgs-gallery-masonry {
        column-count: 2;
        column-gap: 10px;
    }
    
    .fgs-slider-prev,
    .fgs-slider-next {
        width: 40px;
        height: 40px;
        font-size: 30px;
    }
    
    .fgs-slider-prev {
        left: 10px;
    }
    
    .fgs-slider-next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .fgs-gallery-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .fgs-gallery-masonry {
        column-count: 1;
    }
    
    .fgs-slider-prev,
    .fgs-slider-next {
        width: 35px;
        height: 35px;
        font-size: 25px;
    }
}

/* Loading state */
.fgs-gallery-item img[loading="lazy"] {
    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;
    }
}

/* GLightbox customization */
.glightbox-clean .gslide-description {
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 20px;
}
