/* ================================
   GALLERY SECTION
   ================================ */

.gallery-section {
    padding: 3rem 0;
    background: #fff;
}

.gallery-section .section-header-centered {
    margin-bottom: 2rem;
}

/* Gallery Grid - CSS Grid for better control */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

/* Gallery Item */
.gallery-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* Gallery Thumbnail */
.gallery-thumb {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 aspect ratio */
    overflow: hidden;
}

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

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

/* Overlay */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 79, 160, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.overlay-content {
    text-align: center;
    color: #fff;
}

.overlay-content i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 8px;
}

.overlay-content .image-count {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Gallery Info */
.gallery-info {
    padding: 12px 15px;
    background: #fff;
}

.gallery-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.4em;
}

/* ================================
   LIGHTBOX / MODAL
   ================================ */

.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
}

.lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    z-index: 1;
}

/* Lightbox Header */
.lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.lightbox-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    text-transform: uppercase;
}

.lightbox-close {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.25rem;
    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 Body */
.lightbox-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px 0;
    min-height: 0;
}

.lightbox-image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: calc(100% - 120px);
    max-height: 100%;
    width: 100%;
    height: 100%;
}

.lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 280px);
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.lightbox-caption {
    margin-top: 15px;
    color: rgba(255,255,255,0.8);
    font-size: 0.95rem;
    text-align: center;
    max-width: 600px;
}

/* Navigation Buttons */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

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

.lightbox-prev {
    left: 0;
}

.lightbox-next {
    right: 0;
}

/* Lightbox Footer */
.lightbox-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.lightbox-thumbnails {
    display: flex;
    gap: 8px;
    max-width: 100%;
    overflow-x: auto;
    padding: 5px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.lightbox-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.lightbox-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.lightbox-thumbnails .thumb {
    flex-shrink: 0;
    width: 60px;
    height: 45px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.lightbox-thumbnails .thumb:hover {
    opacity: 0.8;
}

.lightbox-thumbnails .thumb.active {
    opacity: 1;
    border-color: #2196F3;
}

.lightbox-thumbnails .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lightbox-counter {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

.lightbox-counter .current {
    color: #fff;
    font-weight: 600;
}

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

@media (max-width: 1399.98px) {
    .gallery-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1199.98px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }
}

@media (max-width: 991.98px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .lightbox-container {
        padding: 15px;
    }

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

    .lightbox-nav {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }

    .lightbox-image {
        max-height: calc(100vh - 250px);
    }
}

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

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .gallery-info {
        padding: 10px 12px;
    }

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

    .overlay-content i {
        font-size: 2rem;
    }

    .lightbox-header {
        padding-bottom: 10px;
    }

    .lightbox-title {
        font-size: 1rem;
    }

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

    .lightbox-body {
        padding: 15px 0;
    }

    .lightbox-image-container {
        max-width: calc(100% - 80px);
    }

    .lightbox-nav {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .lightbox-image {
        max-height: calc(100vh - 220px);
    }

    .lightbox-caption {
        font-size: 0.85rem;
        margin-top: 10px;
    }

    .lightbox-thumbnails .thumb {
        width: 50px;
        height: 38px;
    }
}

@media (max-width: 575.98px) {
    .gallery-grid {
        gap: 10px;
    }

    .gallery-thumb {
        padding-top: 100%; /* Square on mobile */
    }

    .gallery-info {
        padding: 8px 10px;
    }

    .gallery-name {
        font-size: 0.75rem;
        min-height: auto;
        -webkit-line-clamp: 1;
    }

    .lightbox-image {
        max-height: calc(100vh - 200px);
    }

    .lightbox-footer {
        gap: 10px;
        padding-top: 10px;
    }

    .lightbox-thumbnails .thumb {
        width: 45px;
        height: 34px;
    }
}
