/* ====================================
   Gallery Page Styles
   ==================================== */

/* Gallery Main Section */
.gallery-main-section {
    background: #fff;
}

/* Gallery Filter Buttons */
.gallery-filter-container {
    margin: 40px 0 60px 0;
}

.gallery-filter-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: 2px solid #ddd;
    color: #666;
    padding: 8px 20px;
    border-radius: 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 80px;
}

.filter-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: all 0.5s ease;
}

.filter-btn:hover:before {
    left: 100%;
}

.filter-btn:hover {
    border-color: var(--theme, #6A47ED);
    color: var(--theme, #6A47ED);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(106, 71, 237, 0.2);
}

.filter-btn.active {
    background: var(--theme, #6A47ED);
    border-color: var(--theme, #6A47ED);
    color: #fff;
    box-shadow: 0 5px 20px rgba(106, 71, 237, 0.3);
}

.filter-btn.active:hover {
    background: var(--theme, #5A37DD);
    border-color: var(--theme, #5A37DD);
    color: #fff;
}

/* Gallery Grid Columns */
#galleryGrid .col-xl-4,
#galleryGrid .col-lg-6,
#galleryGrid .col-md-6 {
    display: flex;
}

/* Gallery Item */
.gallery-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    opacity: 1;
    transform: scale(1);
    will-change: opacity, transform;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio (9/16 = 0.5625) */
}

.gallery-item.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.gallery-item:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(-5px) scale(1.02);
}

.gallery-item.hidden:hover {
    transform: scale(0.8);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Prevent layout shift during filtering */
#galleryGrid {
    min-height: 600px;
    transition: all 0.3s ease;
}

#galleryGrid.filtering {
    opacity: 0.7;
    pointer-events: none;
}

/* Filter button loading state */
.filter-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Gallery Item Inner Container */
.gallery-item-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.gallery-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item:hover .gallery-item-overlay {
    background: rgba(0, 0, 0, 0.1);
}

/* Loading State */
.gallery-item.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-animation 1.5s infinite;
}

@keyframes loading-animation {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.gallery-item.loading .gallery-item-inner {
    background: #f5f5f5;
}

/* Lightbox Modal */
.lightbox-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.lightbox-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10001;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

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

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10001;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-content {
    position: relative;
    z-index: 10000;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 100px;
}

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

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
    pointer-events: none;
    user-select: none;
}

.lightbox-image.zoomed {
    transform: scale(1.5);
    cursor: grab;
    transition: transform 0.3s ease;
}

.lightbox-image.zoomed:active {
    cursor: grabbing;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive Design */
@media (min-width: 1400px) {
    .filter-btn {
        padding: 9px 22px;
        font-size: 15px;
        min-width: 85px;
    }
}

@media (max-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 992px) {
    .filter-btn {
        padding: 7px 18px;
        font-size: 13px;
        min-width: 75px;
    }

    .lightbox-content {
        padding: 80px 60px;
    }
}

@media (max-width: 768px) {
    .gallery-filter-container {
        margin: 30px 0 50px 0;
    }
    
    .gallery-filter-buttons {
        gap: 8px;
        justify-content: center;
    }
    
    .filter-btn {
        padding: 6px 16px;
        font-size: 13px;
        min-width: 70px;
        border-radius: 0;
    }

    .lightbox-content {
        padding: 70px 20px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 576px) {
    .gallery-filter-container {
        margin: 25px 0 40px 0;
    }
    
    .gallery-filter-buttons {
        gap: 6px;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .filter-btn {
        padding: 5px 14px;
        font-size: 12px;
        min-width: 60px;
        border-radius: 0;
        letter-spacing: 0.3px;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .lightbox-close {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .gallery-filter-container {
        margin: 20px 0 35px 0;
    }
    
    .filter-btn {
        padding: 4px 12px;
        font-size: 11px;
        min-width: 55px;
        border-radius: 0;
        font-weight: 500;
    }
}

@media (max-width: 360px) {
    .gallery-filter-buttons {
        gap: 4px;
    }
    
    .filter-btn {
        padding: 4px 10px;
        font-size: 10px;
        min-width: 50px;
        border-radius: 0;
    }
}
