/* ==========================================================================
   HÌNH ẢNH & VIDEO SECTION (FIGMA NODES 280-3026 & 316-98)
   Website: Bao Bì Đức Trọng
   ========================================================================== */

.hav-section-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* 1. THANH TABS LỌC DANH MỤC (PILLS) */
.hav-filter-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
    padding: 0 10px;
    box-sizing: border-box;
}

.hav-filter-btn {
    background: transparent;
    border: 0.5px solid #585858;
    color: #585858;
    border-radius: 50px;
    padding: 10px 28px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    outline: none;
    white-space: nowrap;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.hav-filter-btn:hover {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #ffffff;
}

.hav-filter-btn.is-active {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 3px 8px rgba(46, 125, 50, 0.25);
}

/* 2. LƯỚI BÀI VIẾT (GRID) CHUẨN FIGMA */
.hav-grid-container {
    width: 100%;
    box-sizing: border-box;
}

.hav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px 16px;
    width: 100%;
    box-sizing: border-box;
}

/* 3. CARD COMPONENT (FIGMA NODE 316-98) */
.hav-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    height: 274px;
    cursor: pointer;
    background-color: #0b2210;
    box-sizing: border-box;
    transition: transform 0.35s ease, box-shadow 0.35s ease, opacity 0.3s ease;
    user-select: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.hav-card:hover {
    box-shadow: 0 12px 30px rgba(0, 76, 14, 0.3);
    transform: translateY(-3px);
}

/* Bố cục so le chuẩn Figma trên Desktop (>1024px) */
@media (min-width: 1025px) {
    .hav-card.hav-layout-large {
        grid-column: span 2;
        height: 353px;
    }

    .hav-card.hav-layout-medium {
        grid-column: span 1;
        height: 353px;
    }

    .hav-card.hav-layout-standard {
        grid-column: span 1;
        height: 274px;
    }
}

/* ẢNH ĐẠI DIỆN CARD */
.hav-card__media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.hav-card__img {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    object-position: center;
    display: block;
    border-radius: 8px;
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hav-card:hover .hav-card__img {
    transform: scale(1.06);
}

/* LỚP PHỦ GRADIENT ĐÁY (NODE 316-98) */
.hav-card__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 130px;
    background: linear-gradient(0deg, #004c0e 0%, rgba(0, 178, 34, 0) 100%);
    border-radius: 0 0 8px 8px;
    display: flex;
    align-items: flex-end;
    padding: 20px 28px;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 2;
    transition: background 0.35s ease;
}

.hav-card:hover .hav-card__overlay {
    background: linear-gradient(0deg, #00360a 0%, rgba(0, 178, 34, 0.15) 100%);
}

/* CHUYỂN ĐỘNG NỘI DUNG: CHỮ CĂN TRÁI & MŨI TÊN TRƯỢT VÀO (FRAME 402 -> FRAME 401) */
.hav-card__content {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 28px;
}

.hav-card__title {
    font-family: 'Google Sans Flex', 'Google Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 700;
    font-size: 19px;
    line-height: 1.35;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    text-align: center;
    width: 100%;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.hav-card__arrow {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) translateX(-15px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.hav-card__arrow svg {
    display: block;
    width: 38px;
    height: 13px;
    max-width: none;
}

/* KHI HOVER VÀO CARD */
.hav-card:hover .hav-card__title {
    text-align: left;
    padding-right: 48px;
}

.hav-card:hover .hav-card__arrow {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

/* 4. MODAL LIGHTBOX TOÀN MÀN HÌNH (FIGMA NODE 344-3645) */
.hav-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), visibility 0.35s ease;
    padding: 24px 20px;
    box-sizing: border-box;
}

.hav-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.hav-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
}

.hav-lightbox__container {
    position: relative;
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
    z-index: 2;
    box-sizing: border-box;
    animation: havLightboxFadeIn 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes havLightboxFadeIn {
    from {
        opacity: 0;
        transform: scale(0.97);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* NÚT ĐÓNG (LUCIDE X 36x36px - NODE 344:3640) */
.hav-lightbox__close {
    position: relative;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, opacity 0.25s ease;
    outline: none;
    opacity: 0.9;
    z-index: 10;
}

.hav-lightbox__close:hover {
    transform: rotate(90deg);
    opacity: 1;
}

.hav-lightbox__close svg {
    width: 36px;
    height: 36px;
    display: block;
}

/* KHUNG MEDIA CHÍNH (COMPONENT 4 - 1615px - NODE 344:3637) */
.hav-lightbox__stage {
    position: relative;
    width: 100%;
    height: calc(100vh - 210px);
    max-height: 794px;
    min-height: 320px;
    border-radius: 4px;
    overflow: hidden;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.hav-lightbox__media-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hav-lightbox__media-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    transition: opacity 0.25s ease;
}

.hav-lightbox__media-wrap iframe,
.hav-lightbox__media-wrap video {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
    object-fit: contain;
}

/* NÚT ĐIỀU HƯỚNG PREV / NEXT */
.hav-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    z-index: 5;
    outline: none;
}

.hav-lightbox__nav:hover {
    background: #e35300;
    border-color: #e35300;
    transform: translateY(-50%) scale(1.08);
}

.hav-lightbox__nav.prev {
    left: 18px;
}

.hav-lightbox__nav.next {
    right: 18px;
}

/* THANH THUMBNAILS (FRAME 463: 110x110px, GAP 16px - NODE 352:5051) */
.hav-lightbox__thumbs-wrapper {
    width: 100%;
    height: 110px;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

.hav-lightbox__thumbs {
    display: flex;
    align-items: center;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding-bottom: 2px;
}

.hav-lightbox__thumbs::-webkit-scrollbar {
    height: 5px;
}

.hav-lightbox__thumbs::-webkit-scrollbar-track {
    background: transparent;
}

.hav-lightbox__thumbs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.hav-lightbox__thumb {
    position: relative;
    width: 110px;
    height: 110px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    box-sizing: border-box;
    background: #1a1a1a;
    transition: transform 0.25s ease, opacity 0.25s ease, border-color 0.25s ease;
    opacity: 0.65;
    border: 2px solid transparent;
}

.hav-lightbox__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.hav-lightbox__thumb:hover {
    opacity: 0.95;
    transform: translateY(-2px);
}

.hav-lightbox__thumb.is-active {
    opacity: 1;
    border-color: #e35300;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(227, 83, 0, 0.4);
}

/* 5. RESPONSIVE BREAKPOINTS (TABLET & MOBILE) */
@media (max-width: 1200px) {
    .hav-card__title {
        font-size: 17px;
    }

    .hav-card.hav-layout-large,
    .hav-card.hav-layout-medium {
        height: 310px;
    }

    .hav-card.hav-layout-standard {
        height: 250px;
    }
}

@media (max-width: 991px) {
    .hav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .hav-card.hav-layout-large,
    .hav-card.hav-layout-medium,
    .hav-card.hav-layout-standard {
        grid-column: span 1 !important;
        height: 270px;
    }

    .hav-card:first-child {
        grid-column: span 2 !important;
        height: 320px;
    }

    .hav-filter-btn {
        padding: 8px 22px;
        font-size: 16px;
    }

    .hav-lightbox__stage {
        height: calc(100vh - 180px);
        max-height: 550px;
    }

    .hav-lightbox__thumbs-wrapper {
        height: 90px;
    }

    .hav-lightbox__thumb {
        width: 90px;
        height: 90px;
    }

    .hav-lightbox__thumbs {
        gap: 12px;
    }

    .hav-lightbox__nav {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 640px) {
    .hav-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .hav-card,
    .hav-card:first-child,
    .hav-card.hav-layout-large,
    .hav-card.hav-layout-medium,
    .hav-card.hav-layout-standard {
        grid-column: span 1 !important;
        height: 240px;
    }

    .hav-card__overlay {
        padding: 16px 20px;
        height: 110px;
    }

    .hav-card__title {
        font-size: 15px;
        letter-spacing: 0.3px;
    }

    .hav-card__arrow svg {
        width: 30px;
        height: 11px;
    }

    .hav-card:hover .hav-card__title {
        padding-right: 36px;
    }

    .hav-filter-wrapper {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
        margin-bottom: 30px;
    }

    .hav-filter-wrapper::-webkit-scrollbar {
        height: 4px;
    }

    .hav-filter-wrapper::-webkit-scrollbar-thumb {
        background: rgba(46, 125, 50, 0.3);
        border-radius: 4px;
    }

    .hav-filter-btn {
        padding: 6px 18px;
        font-size: 14px;
    }

    .hav-lightbox {
        padding: 14px 10px;
    }

    .hav-lightbox__container {
        gap: 10px;
    }

    .hav-lightbox__close {
        width: 30px;
        height: 30px;
    }

    .hav-lightbox__close svg {
        width: 30px;
        height: 30px;
    }

    .hav-lightbox__stage {
        height: 48vh;
        min-height: 220px;
    }

    .hav-lightbox__thumbs-wrapper {
        height: 72px;
    }

    .hav-lightbox__thumb {
        width: 72px;
        height: 72px;
    }

    .hav-lightbox__thumbs {
        gap: 8px;
    }

    .hav-lightbox__nav {
        width: 34px;
        height: 34px;
    }

    .hav-lightbox__nav svg {
        width: 20px;
        height: 20px;
    }

    .hav-lightbox__nav.prev {
        left: 8px;
    }

    .hav-lightbox__nav.next {
        right: 8px;
    }

    .hav-load-more-wrapper {
        margin-top: 32px;
    }

    .hav-load-more-btn {
        width: 100%;
        height: 52px;
        font-size: 16px;
    }
}

/* 6. NÚT "XEM THÊM" (FIGMA NODE 280-2414) */
.hav-load-more-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 48px;
    margin-bottom: 24px;
    width: 100%;
    clear: both;
}

.hav-load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 280px;
    max-width: 100%;
    height: 58px;
    padding: 16px 24px;
    background-color: #ffffff;
    border: 1px solid #e35300;
    border-radius: 8px;
    color: #e35300;
    font-family: 'Roboto', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.5px;
    line-height: 1;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    outline: none;
    user-select: none;
    position: relative;
    text-decoration: none;
}

.hav-load-more-btn:hover {
    background-color: #e35300;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(227, 83, 0, 0.28);
    transform: translateY(-2px);
}

.hav-load-more-btn:active {
    transform: scale(0.98);
}

.hav-load-more-btn.is-loading {
    pointer-events: none;
    opacity: 0.88;
    background-color: #fff6f0;
}

.hav-load-more-spinner {
    display: none;
    width: 18px;
    height: 18px;
    margin-left: 10px;
    border: 2.5px solid rgba(227, 83, 0, 0.25);
    border-top-color: #e35300;
    border-radius: 50%;
    animation: havSpin 0.75s linear infinite;
    vertical-align: middle;
}

.hav-load-more-btn:hover .hav-load-more-spinner {
    border-color: rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
}

.hav-load-more-btn.is-loading .hav-load-more-spinner {
    display: inline-block;
}

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