/* ========================================
   GALLERY PAGE STYLES
   ======================================== */
/* Hero section uses home page structure - no custom hero styles needed */

/* Gallery Filters */
.gallery-filters-section {
    padding: 1.5rem 0;
    background: var(--jetbrains-bg-darker);
    position: sticky;
    top: 80px;
    z-index: 90;
    border-bottom: 1px solid var(--jetbrains-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gallery-filters {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-btn {
    background: var(--jetbrains-bg-card);
    border: 1px solid var(--jetbrains-border);
    color: var(--jetbrains-text-light);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--color-c-primary);
    border-color: var(--color-c-primary);
    color: var(--jetbrains-text-light);
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3), 0 2px 8px rgba(255, 51, 51, 0.2);
    transform: translateY(-2px);
}

.filter-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.125rem 0.5rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 700;
}

.filter-btn:hover .filter-count,
.filter-btn.active .filter-count {
    background: rgba(255, 255, 255, 0.3);
}

/* Gallery Grid */
.gallery-section {
    padding: 4rem 0;
    background: var(--bg-dark);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* Gallery Item */
.gallery-item {
    background: var(--glass-bg-light);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-5px);
    border-color: var(--brand-red);
    box-shadow: 0 20px 40px rgba(213, 0, 0, 0.2);
}

.gallery-item-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
}

.gallery-item-image img,
.gallery-item-image video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0.9;
}

.gallery-item:hover .gallery-item-image img,
.gallery-item:hover .gallery-item-image video {
    transform: scale(1.1);
    opacity: 1;
}

.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-view-btn {
    background: var(--brand-red);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.5rem;
}

.gallery-view-btn:hover {
    background: var(--brand-red-light);
    transform: scale(1.1);
}

/* Video Badge */
.video-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--brand-red);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    z-index: 2;
}

/* Gallery Caption */
.gallery-item-caption {
    padding: 1.5rem;
}

.gallery-item-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.gallery-item-desc {
    color: var(--text-gray);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Load More Section */
.gallery-load-more {
    text-align: center;
    padding: 3rem 0 1rem;
}

.load-more-status {
    margin-top: 1rem;
    color: var(--text-gray);
    font-size: 0.95rem;
}

/* Enhanced Lightbox Styles */
.lightbox-body {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
    padding: 2rem;
    align-items: start;
}

.lightbox-media {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-media img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 15px;
}

.lightbox-media video {
    width: 100%;
    height: auto;
    max-height: 70vh;
    border-radius: 15px;
}

/* Fullscreen Gallery Lightbox */
.gallery-lightbox-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox-fullscreen .lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.gallery-lightbox-fullscreen .lightbox-body {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    grid-template-columns: 1fr;
    gap: 0;
}

.gallery-lightbox-fullscreen .lightbox-media {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox-fullscreen .lightbox-media img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 0;
}

.gallery-lightbox-fullscreen .lightbox-media video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 0;
}

.gallery-lightbox-fullscreen .lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    font-size: 1.5rem;
}

.gallery-lightbox-fullscreen .lightbox-close:hover {
    background: var(--brand-red);
    border-color: var(--brand-red);
    transform: scale(1.1);
}

.gallery-lightbox-fullscreen .lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    font-size: 1.5rem;
}

.gallery-lightbox-fullscreen .lightbox-nav:hover {
    background: var(--brand-red);
    border-color: var(--brand-red);
    transform: translateY(-50%) scale(1.1);
}

.gallery-lightbox-fullscreen .lightbox-prev {
    left: 2rem;
}

.gallery-lightbox-fullscreen .lightbox-next {
    right: 2rem;
}

.lightbox-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.lightbox-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Lightbox Navigation */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--glass-bg-light);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--text-light);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    font-size: 1.25rem;
}

.lightbox-nav:hover {
    background: var(--brand-red);
    border-color: var(--brand-red);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

/* Lightbox Counter */
.lightbox-counter {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg-dark);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: var(--text-light);
    font-weight: 600;
    border: 1px solid var(--glass-border);
}

/* ========================================
   RESPONSIVE ADJUSTMENTS FOR GALLERY
   ======================================== */

@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }

    .lightbox-body {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .lightbox-media img,
    .lightbox-media video {
        max-height: 50vh;
    }
}

@media (max-width: 768px) {
    .gallery-hero {
        padding: 6rem 0 3rem;
    }

    .gallery-hero-title {
        font-size: 2rem;
    }

    .gallery-hero-subtitle {
        font-size: 1.1rem;
    }

    .gallery-hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .gallery-hero-actions .btn {
        width: 100%;
        max-width: 300px;
    }

    .gallery-filters-section {
        top: 70px;
        padding: 1rem 0;
    }

    .gallery-filters {
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding: 0 1rem;
        -webkit-overflow-scrolling: touch;
    }

    .gallery-filters::-webkit-scrollbar {
        height: 4px;
    }

    .gallery-filters::-webkit-scrollbar-thumb {
        background: var(--brand-red);
        border-radius: 4px;
    }

    .filter-btn {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .gallery-item-caption {
        padding: 1rem;
    }

    .gallery-item-title {
        font-size: 1.1rem;
    }

    .gallery-item-desc {
        font-size: 0.875rem;
    }

    .gallery-view-btn {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .video-badge {
        width: 35px;
        height: 35px;
        font-size: 0.875rem;
    }

    .lightbox-body {
        padding: 1rem;
    }

    .lightbox-nav {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }

    .lightbox-prev {
        left: 0.5rem;
    }

    .lightbox-next {
        right: 0.5rem;
    }

    /* Mobile styles for fullscreen gallery lightbox */
    .gallery-lightbox-fullscreen .lightbox-content {
        padding: 1rem;
    }

    .gallery-lightbox-fullscreen .lightbox-close {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .gallery-lightbox-fullscreen .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .gallery-lightbox-fullscreen .lightbox-prev {
        left: 1rem;
    }

    .gallery-lightbox-fullscreen .lightbox-next {
        right: 1rem;
    }

    .lightbox-actions {
        flex-direction: column;
    }

    .lightbox-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-hero {
        padding: 5rem 0 2rem;
    }

    .gallery-section {
        padding: 2rem 0;
    }

    .lightbox-media img,
    .lightbox-media video {
        max-height: 40vh;
    }

    .gallery-lightbox-fullscreen .lightbox-media img,
    .gallery-lightbox-fullscreen .lightbox-media video {
        max-height: 80vh;
    }

    .lightbox-counter {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
}

/* Skeleton Loading State (Optional Enhancement) */
.gallery-item.loading {
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.gallery-item.loading .gallery-item-image {
    background: linear-gradient(
            90deg,
            var(--glass-bg-light) 25%,
            rgba(255, 255, 255, 0.15) 50%,
            var(--glass-bg-light) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    .gallery-item,
    .gallery-item-image img,
    .gallery-item-image video,
    .gallery-item-overlay,
    .gallery-view-btn,
    .lightbox-nav,
    .filter-btn {
        transition: none !important;
        animation: none !important;
    }

    .gallery-item:hover .gallery-item-image img,
    .gallery-item:hover .gallery-item-image video {
        transform: none !important;
    }
}

/* Print Styles for Gallery */
@media print {
    .gallery-filters-section,
    .gallery-load-more,
    .lightbox,
    .whatsapp-float,
    .gallery-item-overlay {
        display: none !important;
    }

    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    .gallery-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .gallery-item-caption {
        background: white;
        color: black;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .filter-btn {
        border: 2px solid currentColor;
    }

    .filter-btn.active {
        background: var(--text-light);
        color: var(--bg-dark);
    }

    .gallery-item {
        border: 2px solid var(--text-light);
    }

    .gallery-view-btn {
        border: 2px solid white;
    }
}