/* Filter Section */
.filter-section {
    padding: 40px 0;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
}

.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 12px 24px;
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-gray);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.3);
}

/* Gallery Container */
.gallery-container {
    padding: 80px 0;
    background: var(--dark-bg);
    min-height: 60vh;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    align-items: start;
}

/* Gallery Item */
.gallery-item {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--card-bg);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.6s ease-out forwards;
}

.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }
.gallery-item:nth-child(6) { animation-delay: 0.6s; }
.gallery-item:nth-child(7) { animation-delay: 0.7s; }
.gallery-item:nth-child(8) { animation-delay: 0.8s; }

.gallery-item:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px var(--shadow-hover);
}

.gallery-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg, 
        rgba(255, 107, 53, 0.9) 0%, 
        rgba(44, 62, 80, 0.8) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.gallery-info {
    text-align: center;
    color: white;
    padding: 1rem;
}

.gallery-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.gallery-category {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Category Badges */
.category-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    backdrop-filter: blur(10px);
}

.category-badge.roleplay {
    background: rgba(52, 152, 219, 0.8);
    color: white;
}

.category-badge.secours {
    background: rgba(155, 89, 182, 0.8);
    color: white;
}

.category-badge.police {
    background: rgba(231, 76, 60, 0.8);
    color: white;
}

.category-badge.civil {
    background: rgba(39, 174, 96, 0.8);
    color: white;
}

.category-badge.vehicules {
    background: rgba(243, 156, 18, 0.8);
    color: white;
}

/* Hidden State */
.gallery-item.hidden {
    display: none;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.close {
    position: absolute;
    top: -50px;
    right: -10px;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    font-weight: bold;
    z-index: 2001;
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.close:hover {
    color: var(--primary-color);
    background: rgba(255, 107, 53, 0.2);
    transform: scale(1.1);
}

/* Navigation Buttons */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    width: calc(100% + 100px);
    left: -50px;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(255, 107, 53, 0.8);
    transform: scale(1.1);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: none;
}

/* Caption */
.lightbox-caption {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 300px;
    grid-column: 1 / -1;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-gray);
}

.empty-state h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-light);
}

.empty-state p {
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .filter-buttons {
        gap: 0.5rem;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 10px;
    }

    .filter-btn {
        padding: 10px 20px;
        font-size: 0.8rem;
        white-space: nowrap;
        min-width: max-content;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }

    .gallery-item img {
        height: 200px;
    }

    .close {
        top: -40px;
        right: 0;
        font-size: 2rem;
        width: 40px;
        height: 40px;
    }

    .lightbox-nav {
        width: calc(100% + 60px);
        left: -30px;
    }

    .nav-btn {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .lightbox-caption {
        bottom: -50px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .gallery-container {
        padding: 60px 0;
    }

    .filter-section {
        padding: 30px 0;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .gallery-item img {
        height: 250px;
    }

    .gallery-title {
        font-size: 1.1rem;
    }

    .gallery-category {
        font-size: 0.8rem;
    }

    .lightbox-content {
        max-width: 95%;
        max-height: 80%;
    }

    .close {
        top: -35px;
        font-size: 1.5rem;
        width: 35px;
        height: 35px;
    }

    .nav-btn {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
}

/* Masonry effect for varied heights */
@supports (grid-template-rows: masonry) {
    .gallery-grid {
        grid-template-rows: masonry;
    }
}

/* Animation pour l'apparition des images */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item.show {
    animation: slideInUp 0.6s ease-out;
}