/* ================================================================
   TVA – Frontend Slider & Lightbox Styles
================================================================ */

/* Section */
.tva-section {
    font-family: inherit;
}

.tva-section-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: .03em;
    margin-bottom: 30px;
    color: #1a1a2e;
    text-transform: uppercase;
}

.tva-section-desc {
    font-size: 1em;
    color: #6B7280;
    line-height: 1.6;
}

/* ----------------------------------------------------------------
   Slider wrapper
---------------------------------------------------------------- */
.tva-slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
}

.tva-slider-viewport {
    overflow: hidden;
    flex: 1;
    /* width: 0; */
    /* ← thêm dòng này */
    min-width: 0;
    /* ← thêm dòng này */
}

.tva-slider-track {
    display: flex;
    gap: 30px;
    /* Fix gap to match JS calculation */
    /* Hiệu ứng trượt ngang siêu mượt (easeOutQuart) */
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

/* Each slide – show 1.5 per view */
.tva-slide {
    flex: 0 0 calc((100% - 30px) / 1.5);
    max-width: 780px !important;
    position: relative;
    overflow: hidden;
    background: #111;
    cursor: pointer;
    max-height: 540px;

}

.tva-slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}

.tva-slide:hover .tva-slide-img {
    transform: scale(1.04);
}

.tva-slide-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, .7));
    color: #fff;
    padding: 24px 12px 10px;
    font-size: 13px;
    line-height: 1.4;
}

/* ----------------------------------------------------------------
   Arrows
---------------------------------------------------------------- */
.tva-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;

    background: #fff;
    border: none;
    border-radius: 100px;

    width: 56px;
    height: 56px;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 26px;
    line-height: 1;
    color: #1a1a2e;

    cursor: pointer;
    flex-shrink: 0;
    pointer-events: auto;

    transition: background 0.3s, transform 0.3s;
}

.tva-arrow svg {
    width: 6px !important;
    height: 12px !important;
    min-width: unset !important;
    flex-shrink: 0 !important;
    display: block;
}

.tva-arrow svg path {
    stroke: #000000;
}

.tva-arrow:focus,
.tva-arrow:focus-visible {
    outline: none;
    background: #fff;
}

.tva-arrow:hover {
    background: #0E1623F2;
}

.tva-arrow:hover svg path {
    stroke: #fff;
}


.tva-arrow-prev {
    left: -28px;
}

.tva-arrow-next {
    right: max(0px, calc((100vw - 1212px) / 2)) !important;
}


/* ----------------------------------------------------------------
   Dots
---------------------------------------------------------------- */
.tva-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.tva-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    background: #d1d5db;
    cursor: pointer;
    padding: 0;
    transition: background 0.4s ease, width 0.4s ease, border-radius 0.4s ease, transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.4s ease;
}

.tva-dot:hover {
    transform: scale(1.2);
}

.tva-dot.active {
    background: #111;
    border-radius: 30px;
    width: 30px;
}

/* ----------------------------------------------------------------
   Lightbox
---------------------------------------------------------------- */
/* MỚI */
.tva-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    /* THÊM */
    opacity: 0;
    /* THÊM */
    transition: visibility 0.4s, opacity 0.4s ease;
    /* THÊM */
}

/* THÊM – khi mở */
.tva-lightbox.tva-lb-open {
    visibility: visible;
    opacity: 1;
}

/* THÊM – khi đóng */
.tva-lightbox.tva-lb-closing {
    visibility: visible;
    opacity: 0;
    transition: visibility 0.4s, opacity 0.4s ease;
}

/* THÊM – blur chỉ sau khi animation xong */
.tva-lightbox.tva-lb-ready .tva-lb-overlay {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.tva-lb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .92);
    /* backdrop-filter: blur(4px); */
    cursor: pointer;
}

.tva-lb-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 90vw;
    max-height: 90vh;
    opacity: 0;
    transform: scale(0.5);
    will-change: transform, opacity;
}

/* THÊM 2 class animation */
.tva-lightbox.tva-lb-open .tva-lb-inner {
    animation: tva-scale-up-center 0.7s cubic-bezier(0.390, 0.575, 0.565, 1.000) both;
}

.tva-lightbox.tva-lb-closing .tva-lb-inner {
    animation: tva-scale-down-center 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

.tva-lb-img-wrap {
    position: relative;
    max-width: 80vw;
    max-height: 84vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}


/* THÊM – giống modal video */
@keyframes tva-scale-up-center {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes tva-scale-down-center {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(0.5);
        opacity: 0;
    }
}

/* Animation chuyển ảnh trái/phải: fade-in */
@keyframes tva-fade-in {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

#tva-lb-img {
    max-width: 80vw;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 4px;
    display: block;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .6);
    will-change: transform, opacity;
    /* ← báo browser chuẩn bị GPU trước */
    /* transition: opacity .25s; */
}

/* Khi chuyển ảnh trái/phải */
#tva-lb-img.tva-anim-change {
    animation: tva-fade-in 1.2s ease-out both;
}

.tva-lb-caption {
    color: rgba(255, 255, 255, .8);
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
    min-height: 18px;
}

.tva-lb-counter {
    position: absolute;
    top: -32px;
    right: 55px;
    color: rgba(255, 255, 255, .55);
    font-size: 12px;
}

/* Lightbox buttons */
.tva-lb-prev,
.tva-lb-next {
    background: rgba(245, 245, 245, 0.75);
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    /* ← tăng lên, mặc định đang là 32px */
    line-height: 1;
    color: #1a1a2e;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    transition: background 0.3s, transform 0.3s;
}

.tva-lb-prev:hover,
.tva-lb-next:hover {
    background: rgba(255, 255, 255, .25);
}

.tva-lb-prev:is(:focus, :focus-visible),
.tva-lb-next:is(:focus, :focus-visible) {
    outline: none !important;
    background: rgba(245, 245, 245, 0.75) !important;
}

.tva-lb-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, .15);
    border: none;
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    width: 36px !important;
    height: 36px !important;

    min-width: 36px !important;
    max-width: 36px !important;

    padding: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.tva-lb-close:hover {
    background: rgba(255, 255, 255, .3);
}

/* ----------------------------------------------------------------
   Responsive
---------------------------------------------------------------- */
@media (max-width: 921px) {

    .tva-section-title {
        font-size: 28px;
    }
}

@media (max-width: 768px) {

    /* ==========================================
       1. CẤU TRÚC SLIDER CUỘN TỰ NHIÊN (GIỐNG VM-SLIDER)
       ========================================== */

    .tva-slider-wrapper {
        overflow: visible !important;
        margin-right: 0 !important;
    }

    .tva-slider-viewport {
        overflow: hidden !important;
        scrollbar-width: none;
        width: 100% !important;
    }

    .tva-slider-viewport::-webkit-scrollbar {
        display: none;
    }

    .tva-slider-track {
        display: flex !important;
        gap: 10px !important;
        width: max-content !important;
    }

    .tva-slide {
        flex: 0 0 calc(100vw - 40px) !important;
        scroll-snap-align: start !important;
    }

    .tva-arrow,
    .tva-arrow-prev,
    .tva-arrow-next {
        display: none !important;
        /* Ẩn toàn bộ nút mũi tên slider bản v1 trên mobile */
    }


    /* ==========================================
       2. CẤU TRÚC LIGHTBOX PHÓNG TO ẢNH (ĐÃ CÂN GIỮA)
       ========================================== */
    .tva-lightbox {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .tva-lb-inner {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100% !important;
        max-width: 100vw !important;
        padding: 0 40px;
        /* Chừa khoảng cách hai bên cho mũi tên */
        box-sizing: border-box;
        gap: 0;
    }

    .tva-lb-img-wrap {
        max-width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #tva-lb-img {
        max-width: 100% !important;
        max-height: 70vh !important;
        object-fit: contain;
    }

    /* Mũi tên điều hướng của Lightbox */
    .tva-lb-prev,
    .tva-lb-next {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        background: rgba(255, 255, 255, .15);
        border-radius: 50%;
        width: 36px;
        height: 36px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        color: #fff !important;
    }

    .tva-lb-prev {
        left: 0 !important;
    }

    .tva-lb-next {
        right: 0 !important;
    }
}

@media (max-width: 544px) {

    .tva-section-title {
        font-size: 24px;
    }
}

/* Error */
.tva-error {
    border: 1px solid #f5a5a5;
    background: #fff5f5;
    color: #c0392b;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 14px;
}

/* Đảm bảo lightbox hiển thị đúng */
.tva-lightbox[style*="flex"] {
    display: flex !important;
}

.tva-slide {
    cursor: zoom-in;
    /* ← thay cursor: pointer */
}

.tva-lightbox {
    z-index: 999999 !important;
}

/* ================================================================
   TVA v2 – full width, peek layout, title dưới ảnh, không lightbox
================================================================ */
.tva-section.tva-section--v2 {
    width: 100%;
    box-sizing: border-box;
    /* Tránh padding âm trên màn hình nhỏ bằng hàm max() */
    padding-left: max(20px, calc((100vw - 1212px) / 2));
    padding-right: 0;
    display: flex;
    justify-content: start;
    gap: 30px;
}

.tva-section--v2 .tva-section-header {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 10px;
}

.tva-section--v2 .tva-section-title {
    margin-bottom: 0 !important;
}

.tva-section--v2 .tva-section-desc {
    margin-bottom: 0 !important;
}

.tva-section--v2 .tva-slider-viewport {
    overflow: hidden;
}

.tva-section--v2 .tva-slide-col {
    flex: 0 0 calc((1212px - 4px) / 3);
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-radius: 8px;
    height: fit-content;
}

.tva-section--v2 .tva-slide {
    flex: none;
    width: 100%;
    cursor: default;
    border-radius: 8px !important;
    /* Chuyển aspect-ratio lên thẻ cha div để div co lại đúng bằng img */
    overflow: hidden;
}

.tva-section--v2 .tva-section-header {
    padding-top: 80px;
    max-width: 488px;
    display: flex;
    flex-direction: column;
    align-items: start;
    flex: 0 0 auto;
    width: 100%;
}

.tva-section--v2 .tva-slide-title {
    margin-bottom: 0;
    font-size: 24px;
    font-weight: 600;
    color: #1A1A1A;
    line-height: 1.2;
    margin-left: 5px;
}

.tva-section--v2 .tva-slide-title p {
    margin-bottom: 0 !important
}

.tva-section--v2 .tva-slide-title a {
    color: inherit;
    text-decoration: none;
}

.tva-section--v2 .tva-slide-title a:hover {
    color: #cc0000;
}

.tva-section--v2 .tva-arrow {
    position: static;
    top: auto;
    transform: none;
    z-index: auto;
    overflow: visible !important;
    box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.1) !important;
    border-radius: 50% !important;
}

.tva-section--v2 .tva-slider-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 30px;
    width: 100%;
    overflow: visible !important;
}

.tva-section--v2 .buttons {
    display: flex;
    justify-content: start;
    gap: 20px;
}

.tva-section--v2 .tva-slider-track {
    gap: 30px;
}

/* Tùy chỉnh ảnh để không bị méo/vỡ trên bản v2 */
.tva-section--v2 .tva-slide-img {
    height: 100%;
    /* Fill kín div cha */
    width: 100%;
    object-fit: cover;
}

@media (max-width: 1212px) {
    .tva-section--v2 .tva-slider-wrapper {
        padding-left: 0;
    }
}

@media (max-width: 992px) {

    /* Đẩy layout dọc (column) thay vì ngang trên tablet/mobile */
    .tva-section.tva-section--v2 {
        flex-direction: column;
        padding-left: 20px;
        padding-right: 0;
        /* Để trống lề phải tạo hiệu ứng vuốt tràn viền (peek) */
        gap: 20px;
    }

    .tva-section--v2 .tva-section-header {
        padding-top: 0;
        padding-right: 20px;
        /* Văn bản vẫn phải cách lề phải */
        max-width: 100%;
    }

    .tva-section--v2 .tva-slide-col {
        flex: 0 0 calc((100vw - 60px) / 2);
    }
}

@media (max-width: 768px) {
    .tva-section--v2 .tva-slider-wrapper {
        overflow: visible !important;
    }

    /* Hiệu ứng 1 slide + 1 góc slide tiếp theo */
    .tva-section--v2 .tva-slide-col {
        flex: 0 0 85vw;
        /* Chiếm 85% chiều rộng màn hình, dư 15% cho hình tiếp theo lộ ra */
        scroll-snap-align: start !important;
        /* Dừng cuộn chuẩn xác tại mí viền */
    }

    .tva-section--v2 .tva-slider-track {
        gap: 15px;
        /* Khoảng cách giữa các slide nhỏ lại cho đẹp trên mobile */
    }

    /* Hiển thị lại 2 nút bấm chuyển slide cho bản v2 trên mobile */
    .tva-section--v2 .tva-arrow {
        display: flex !important;
        pointer-events: auto !important;
    }

    .tva-section--v2 .tva-slider-wrapper {
        gap: 20px !important;
    }

    /* .tva-section--v2 .buttons {
        justify-content: center;
        margin-top: 10px;
        z-index: 100;
        position: relative;
        overflow: visible !important;
    } */
}

@media (max-width: 480px) {
    .tva-section--v2 .tva-slide-img {
        aspect-ratio: 4 / 3;
        /* Giữ ảnh luôn chuẩn tỷ lệ, không bị kéo giãn */
    }
}

.tva-section--single-dots .tva-slide,
.tva-section--single-dots .tva-slide-img {
    border-radius: 8px;
    overflow: hidden;
}

.tva-section--single-dots .tva-slide {
    cursor: default;
}

.tva-section--single-dots .tva-slide:hover .tva-slide-img {
    transform: none;
}

/* ================================================================
   Swap Indicator (mobile/tablet guide)
   ================================================================ */
.tva-swap-indicator-container {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
}

@media (max-width: 768px) {
    .tva-swap-indicator-container {
        display: block !important;
    }
}

.tva-hand-icon {
    animation: tva-hand-swipe 1.6s ease-in-out infinite;
}

@keyframes tva-hand-swipe {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    50% {
        transform: translateX(0);
    }

    75% {
        transform: translateX(6px);
    }

    100% {
        transform: translateX(0);
    }
}