/* ==========================================================================
   SECTION: BLOCK GALLERY FEED (SLIDER TRÀN VIỀN & LƯỚI ẢNH LIGHTBOX)
   Path: light-ui/templates/sections/block-gallery-feed/style.css
   Refactored using Global Design Tokens from assets/css/global.css
   ========================================================================== */

/* ==========================================================================
   DẠNG 1: OFFICE GALLERY SECTION - FULL WIDTH SLIDER
   ========================================================================== */
.crb-block-fullwidth.block-gallery-feed--slider,
.sec-office-gallery {
    padding-top: 50px;
    padding-bottom: 30px;
    background-color: var(--color-surface, #F7F2EE);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    font-family: var(--font-body, 'Nunito Sans', sans-serif);
}

/* Khung tiêu đề giữ căn lề chuẩn hệ thống */
.sec-office-gallery .office-gallery__header,
.sec-office-gallery .crb-container {
    max-width: var(--container-max-w, 1200px);
    margin: 0 auto;
    padding: 0 var(--container-pad-x, 20px);
    box-sizing: border-box;
}

.sec-office-gallery .office-gallery__title {
    font-family: var(--ff-h3, 'Cormorant SC', serif);
    font-size: var(--fs-h3, 26px);
    line-height: var(--lh-h3, 30px);
    font-weight: var(--fw-h3, 700);
    color: var(--text-title, #456967);
    margin-top: 0;
    margin-bottom: var(--space-heading-bottom, 15px);
    text-transform: none;
}

.sec-office-gallery .office-gallery__desc {
    font-family: var(--ff-body, 'Nunito Sans', sans-serif);
    font-size: var(--fs-body-m, 16px);
    line-height: var(--lh-body-m, 24px);
    color: var(--text-primary, #333333);
    margin-top: 0;
    margin-bottom: 24px;
}

/* Khung Slider tràn 100% màn hình */
.sec-office-gallery .office-gallery__slider-wrapper {
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

.sec-office-gallery .office-gallery__swiper {
    width: 100%;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.sec-office-gallery .office-gallery__swiper:active {
    cursor: grabbing;
}

.sec-office-gallery .office-gallery__slide {
    height: auto;
    box-sizing: border-box;
}

.sec-office-gallery .office-gallery__item {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.sec-office-gallery .office-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    transition: var(--transition-base, all 0.3s ease);
}

.sec-office-gallery .office-gallery__item:hover img {
    transform: scale(1.04);
}

/* Phân trang dạng viên thuốc (Pill Pagination) */
.sec-office-gallery .office-gallery__pagination {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    width: 100% !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    margin-bottom: 10px;
    z-index: 10;
}

.sec-office-gallery .office-gallery__pagination .swiper-pagination-bullet {
    width: 7px;
    height: 7px;
    background-color: var(--color-bg, #DFEBE9);
    opacity: 0.8;
    border-radius: 50%;
    margin: 0 !important;
    cursor: pointer;
    transition: var(--transition-base, all 0.3s ease);
}

.sec-office-gallery .office-gallery__pagination .swiper-pagination-bullet-active {
    width: 28px;
    height: 7px;
    border-radius: 4px;
    background-color: var(--color-primary-second, #5B8C85);
    opacity: 1;
}

/* ==========================================================================
   DẠNG 2: IMAGE GALLERY SECTION - GRID & LIGHTBOX
   ========================================================================== */
.crb-block-fullwidth.block-gallery-feed--grid,
.image-gallery {
    position: relative;
    width: 100%;
    padding: 70px 0 80px 0;
    background-color: var(--color-primary, #FFFFFF);
    box-sizing: border-box;
    overflow: hidden;
    font-family: var(--font-body, 'Nunito Sans', sans-serif);
}

.image-gallery__container {
    max-width: var(--container-max-w, 1200px);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--container-pad-x, 20px);
    box-sizing: border-box;
    text-align: center;
}

/* Tiêu đề & Mô tả */
.image-gallery__title {
    font-family: var(--ff-h2, 'Cormorant SC', serif);
    font-size: var(--fs-h2, 32px);
    line-height: var(--lh-h2, 35px);
    font-weight: var(--fw-h2, 700);
    color: var(--text-title, #456967);
    margin: 0 0 20px 0;
    letter-spacing: 0.8px;
}

.image-gallery__desc {
    font-family: var(--ff-body, 'Nunito Sans', sans-serif);
    font-size: var(--fs-body-m, 16px);
    line-height: var(--lh-body-m, 24px);
    color: var(--text-primary, #333333);
    max-width: 800px;
    margin: 0 auto 35px auto;
}

/* Lưới ảnh tùy biến số cột */
.image-gallery__grid {
    display: grid;
    grid-template-columns: repeat(var(--gallery-cols, 3), 1fr);
    gap: 24px;
    width: 100%;
    margin: 0 auto;
}

.image-gallery__item {
    position: relative;
    cursor: default;
    overflow: hidden;
    border-radius: var(--radius-atom, 12px);
    background-color: var(--color-surface, #F7F2EE);
    transition: var(--transition-base, all 0.3s ease);
}

.image-gallery--has-lightbox .image-gallery__item {
    cursor: pointer;
}

.image-gallery__item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.image-gallery__thumb-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.image-gallery__thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: var(--transition-base, all 0.3s ease);
}

.image-gallery__item:hover .image-gallery__thumb {
    transform: scale(1.05);
}

/* Lớp phủ khi hover */
.image-gallery__overlay {
    position: absolute;
    inset: 0;
    background: rgba(69, 105, 103, 0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition-base, all 0.3s ease);
}

.image-gallery__item:hover .image-gallery__overlay {
    opacity: 1;
}

.image-gallery__zoom-icon {
    color: #FFFFFF;
    font-size: 26px;
    transform: scale(0.8);
    transition: var(--transition-base, all 0.3s ease);
}

.image-gallery__item:hover .image-gallery__zoom-icon {
    transform: scale(1.1);
}

/* ==========================================================================
   LIGHTBOX MODAL PHÓNG TO ẢNH (ZOOM & SWIPE)
   ========================================================================== */
.image-gallery__lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-base, all 0.3s ease);
    user-select: none;
}

.image-gallery__lightbox.is-active {
    opacity: 1;
    visibility: visible;
}

.image-gallery__lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(5px);
    cursor: pointer;
}

.image-gallery__lightbox-container {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 30px;
    box-sizing: border-box;
    pointer-events: none;
}

.image-gallery__lightbox-content {
    position: relative;
    width: 82vw;
    max-width: 1050px;
    height: 80vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.image-gallery__lightbox-img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: calc(100% - 36px);
    object-fit: contain;
    border-radius: var(--radius-atom, 12px);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.65);
    transition: var(--transition-base, all 0.3s ease);
}

.image-gallery__lightbox-counter {
    margin-top: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-body, 'Nunito Sans', sans-serif);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-align: center;
}

/* Các nút điều hướng và đóng modal */
.image-gallery__lightbox-btn {
    position: absolute;
    z-index: 10;
    background: rgba(30, 30, 30, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #FFFFFF;
    font-size: 22px;
    line-height: 1;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-base, all 0.3s ease);
    pointer-events: auto;
}

.image-gallery__lightbox-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.image-gallery__lightbox-close {
    top: 24px;
    right: 24px;
    font-size: 32px;
}

.image-gallery__lightbox-prev {
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
}

.image-gallery__lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.image-gallery__lightbox-next {
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
}

.image-gallery__lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

/* ==========================================================================
   RESPONSIVE TABLET & MOBILE (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
    /* Slider mode */
    .sec-office-gallery {
        padding-top: 35px;
        padding-bottom: 20px;
    }

    .sec-office-gallery .office-gallery__title {
        font-size: var(--fs-h3, 22px);
        margin-bottom: 12px;
    }

    /* Grid mode */
    .image-gallery {
        padding: 45px 0 50px 0;
    }

    .image-gallery__title {
        font-size: var(--fs-h3, 24px);
        margin-bottom: 16px;
    }

    .image-gallery__grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px;
    }

    .image-gallery__thumb-wrapper {
        aspect-ratio: 1 / 1;
    }

    .image-gallery__lightbox-prev {
        left: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
        background: rgba(0, 0, 0, 0.4);
    }

    .image-gallery__lightbox-next {
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
        background: rgba(0, 0, 0, 0.4);
    }

    .image-gallery__lightbox-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 26px;
        background: rgba(0, 0, 0, 0.4);
    }

    .image-gallery__lightbox-content {
        width: 92vw;
        max-width: 100%;
        height: 75vh;
    }

    .image-gallery__lightbox-img {
        max-height: calc(100% - 30px);
    }
}

