/**
 * Gallery Masonry Styles
 * Pinterest-style photo grid with infinite scroll
 */

/* ===========================
   GALLERY SECTION
   =========================== */
.gallery-section {
    padding: 0 0;
    background: #FFFFFF;
    min-height: 100vh;
}

.container-full {
    width: 100%;
    max-width: 100%;
    padding: 0;
}

/* ===========================
   FILTERS (Now in Hero Section)
   =========================== */
.gallery-filters {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: nowrap;
    padding: 0 1rem;
    margin: 0 auto;
    max-width: 100%;
    width: 100%;
}

.filter-btn {
    padding: 0.75rem 1.25rem;
    border: 2px solid #FFFFFF !important;
    background: transparent;
    backdrop-filter: blur(10px);
    color: #FFFFFF !important;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    flex: 1 1 auto;
    justify-content: center;
}

.filter-btn span {
    color: #FFFFFF !important;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #FFFFFF !important;
    color: #FFFFFF !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.filter-btn:hover span {
    color: #FFFFFF !important;
}

.filter-btn.active {
    background: #FFFFFF !important;
    color: #5170FF !important;
    border-color: #FFFFFF !important;
    box-shadow: 0 4px 16px rgba(81, 112, 255, 0.4);
}

.filter-btn.active span {
    color: #5170FF !important;
}

.filter-icon {
    font-size: 1.1rem;
}

/* ===========================
   MASONRY GRID
   =========================== */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding: 2rem 1rem;
    max-width: 1800px;
    margin: 0 auto;
}

.masonry-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    background: #F9FAFB;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    aspect-ratio: 4 / 3;
}

.masonry-item.vertical {
    aspect-ratio: 3 / 4;
}

.masonry-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

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

/* Caption overlay */
.masonry-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.masonry-item:hover .masonry-caption {
    opacity: 1;
}

.masonry-caption p {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.masonry-categories {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.category-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 6px;
}

/* ===========================
   LOADING & EMPTY STATES
   =========================== */
.gallery-loading {
    padding: 3rem;
    text-align: center;
}

.gallery-loading .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #F3F4F6;
    border-top-color: #5170FF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.gallery-loading p {
    color: #6B7280;
    font-size: 0.95rem;
}

.gallery-empty {
    padding: 5rem 2rem;
    text-align: center;
}

.gallery-empty .empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.gallery-empty p {
    color: #6B7280;
    font-size: 1.1rem;
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* ===========================
   LIGHTBOX
   =========================== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 2rem;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.lightbox.hidden {
    opacity: 0;
    pointer-events: none;
}

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

.lightbox-content img,
.lightbox-content video {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

.lightbox-caption {
    margin-top: 1.5rem;
    color: white;
    text-align: center;
    max-width: 600px;
}

.lightbox-caption p {
    margin: 0;
    font-size: 1rem;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 1200px) {
    .masonry-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .gallery-section {
        padding: 2rem 0;
    }

    .hero-gallery {
        padding: 6rem 0 2.5rem !important;
    }

    .gallery-filters {
        gap: 0.5rem;
        padding: 0 1rem;
        flex-wrap: wrap;
    }

    .filter-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        flex: 0 1 auto;
    }

    .masonry-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 0.75rem;
        padding: 1rem 0.75rem;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
    }

    .lightbox-prev {
        left: 1rem;
    }

    .lightbox-next {
        right: 1rem;
    }
}

@media (max-width: 480px) {
    .hero-gallery h1 {
        font-size: 2.5rem !important;
        margin-bottom: 1.5rem !important;
    }

    .gallery-filters {
        gap: 0.5rem;
        padding: 0 0.5rem;
        flex-wrap: wrap;
    }

    .filter-btn {
        padding: 0.5rem 0.85rem;
        font-size: 0.8rem;
        flex: 0 1 auto;
    }

    .masonry-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 1rem 0.5rem;
    }

    .lightbox {
        padding: 1rem;
    }

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