/* =====================================================
   TSV - HOME PRODUCTS FRONTEND
   Giao diện ngoài website của module Sản phẩm trang chủ

   File:
   modules/home-products/assets/css/tsv-home-products.css

   Phạm vi:
   - Tiêu đề khu vực sản phẩm.
   - Tabs sản phẩm desktop/mobile.
   - Nút “Xem thêm”.
   - Khối sản phẩm nổi bật và chống giật layout.
   - Không xử lý Banner, H1/mô tả hoặc Header trang chủ.
===================================================== */


/* =====================================================
   01. HOME PRODUCTS VARIABLES
===================================================== */

.tsv-title-normal,
.tsv-home-product-group-bridge,
.tabbed-content.tsv-home-product-tabs {
    --tsv-blue: #082b63;
    --tsv-yellow: #e6a11d;
    --tsv-text: #333333;
    --tsv-line: #6f6f6f;
    --tsv-separator: #8a8a8a;
    --tsv-cut-bg: #ffffff;
    --tsv-red: #ff2b1f;
    --tsv-section-title-size: var(--tsv-h2-size, 22px);
    --tsv-section-title-size-mobile: var(--tsv-h2-size-mobile, 18px);
}


/* =====================================================
   02. TITLE SẢN PHẨM NỔI BẬT
===================================================== */

.tsv-title-normal .section-title-main,
.tsv-title-normal .section-title span {
    font-family: var(--tsv-font-main, "Montserrat", Arial, sans-serif) !important;
    color: var(--tsv-heading-color, #082b63) !important;
    font-weight: var(--tsv-font-semibold, 600) !important;
    line-height: 1.25 !important;
    letter-spacing: 0 !important;
}

.tsv-title-normal .section-title a {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;

    font-family: var(--tsv-font-main, "Montserrat", Arial, sans-serif) !important;
    font-size: 15px !important;
    font-weight: var(--tsv-font-bold, 700) !important;
    line-height: 1.2 !important;
    color: var(--tsv-blue) !important;

    margin: 0 !important;
    padding: 0 !important;
    text-transform: none !important;
    text-decoration: none !important;
}

.tsv-title-normal .section-title a::after,
.tsv-title-normal .section-title a i,
.tsv-title-normal .section-title a svg {
    font-size: 13px !important;
    line-height: 1 !important;
}

@media only screen and (min-width: 769px) {
    .tsv-title-normal {
        margin-top: 0 !important;
        padding-top: 0 !important;
        margin-bottom: 0 !important;
    }

    .tsv-title-normal .section-title {
        margin-top: 0 !important;
        margin-bottom: 18px !important;
        padding-top: 0 !important;
    }

    .tsv-title-normal .section-title,
    .tsv-title-normal .section-title-main,
    .tsv-title-normal h1,
    .tsv-title-normal h2,
    .tsv-title-normal h3,
    .tsv-title-normal span {
        padding-top: 0 !important;
    }
}

@media only screen and (max-width: 768px) {
    .tsv-title-normal {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    .tsv-title-normal .section-title-main,
    .tsv-title-normal .section-title span {
        font-weight: var(--tsv-font-semibold, 600) !important;
        line-height: 1.3 !important;
    }

    .tsv-title-normal .section-title a {
        font-size: 15px !important;
        font-weight: var(--tsv-font-bold, 700) !important;
    }
}


/* =====================================================
   03. TABS SẢN PHẨM TRANG CHỦ
   Class chính: .tsv-home-product-tabs
===================================================== */

.tabbed-content.tsv-home-product-tabs {
    position: relative !important;
    display: grid !important;
    grid-template-columns: max-content minmax(0, 1fr) !important;
    grid-template-areas:
        "main-title tabs-nav"
        "tabs-panel tabs-panel" !important;
    align-items: end !important;
    column-gap: 34px !important;
    width: 100% !important;
    margin-top: 22px !important;
}

.tabbed-content.tsv-home-product-tabs .tsv-tabs-fixed-title {
    display: none !important;
}

.tabbed-content.tsv-home-product-tabs > h1,
.tabbed-content.tsv-home-product-tabs > h2,
.tabbed-content.tsv-home-product-tabs > h3,
.tabbed-content.tsv-home-product-tabs > h4,
.tabbed-content.tsv-home-product-tabs > h5,
.tabbed-content.tsv-home-product-tabs > h6,
.tabbed-content.tsv-home-product-tabs > .tsv-original-tabs-title {
    grid-area: main-title !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    position: relative !important;

    color: #ffffff !important;
    background: var(--tsv-blue) !important;

    font-family: var(--tsv-font-main, "Montserrat", Arial, sans-serif) !important;
    font-size: 15px !important;
    line-height: 1.15 !important;
    font-weight: var(--tsv-font-semibold, 600) !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;

    padding: 7px 13px 7px 18px !important;
    margin: 0 !important;

    border: none !important;
    border-radius: 0 !important;
    box-shadow: inset 5px 0 0 var(--tsv-red) !important;
    overflow: visible !important;
    z-index: 3 !important;
}

.tabbed-content.tsv-home-product-tabs > h1::after,
.tabbed-content.tsv-home-product-tabs > h2::after,
.tabbed-content.tsv-home-product-tabs > h3::after,
.tabbed-content.tsv-home-product-tabs > h4::after,
.tabbed-content.tsv-home-product-tabs > h5::after,
.tabbed-content.tsv-home-product-tabs > h6::after,
.tabbed-content.tsv-home-product-tabs > .tsv-original-tabs-title::after {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    right: -21px !important;
    width: 20px !important;
    height: 100% !important;
    background: var(--tsv-blue) !important;
    clip-path: polygon(0 0, 100% 50%, 0 100%) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    z-index: 1 !important;
}

.tabbed-content.tsv-home-product-tabs > h1::before,
.tabbed-content.tsv-home-product-tabs > h2::before,
.tabbed-content.tsv-home-product-tabs > h3::before,
.tabbed-content.tsv-home-product-tabs > h4::before,
.tabbed-content.tsv-home-product-tabs > h5::before,
.tabbed-content.tsv-home-product-tabs > h6::before,
.tabbed-content.tsv-home-product-tabs > .tsv-original-tabs-title::before {
    content: none !important;
    display: none !important;
}

.tabbed-content.tsv-home-product-tabs > .nav {
    grid-area: tabs-nav !important;
    display: flex !important;
    align-items: flex-end !important;
    flex-wrap: nowrap !important;
    gap: 0 !important;

    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;

    border-bottom: 1px solid var(--tsv-line) !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;

    scrollbar-width: none !important;
}

.tabbed-content.tsv-home-product-tabs > .nav::-webkit-scrollbar {
    display: none !important;
}

.tabbed-content.tsv-home-product-tabs > .nav::before,
.tabbed-content.tsv-home-product-tabs > .nav::after,
.tabbed-content.tsv-home-product-tabs > .nav li::after,
.tabbed-content.tsv-home-product-tabs > .nav li a::before,
.tabbed-content.tsv-home-product-tabs > .nav li a::after {
    content: none !important;
    display: none !important;
}

.tabbed-content.tsv-home-product-tabs > .nav li {
    position: relative !important;
    flex: 0 0 auto !important;
    margin: 0 20px 0 0 !important;
    padding: 0 !important;

    list-style: none !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.tabbed-content.tsv-home-product-tabs > .nav li:last-child {
    margin-right: 0 !important;
}

.tabbed-content.tsv-home-product-tabs > .nav li + li {
    padding-left: 16px !important;
}

.tabbed-content.tsv-home-product-tabs > .nav li + li::before {
    content: "|" !important;
    position: absolute !important;
    left: 0 !important;
    bottom: 14px !important;
    color: var(--tsv-separator) !important;
    font-size: 14px !important;
    font-weight: var(--tsv-font-medium, 500) !important;
    line-height: 1 !important;
}

.tabbed-content.tsv-home-product-tabs > .nav li a {
    display: inline-block !important;
    position: relative !important;

    font-family: var(--tsv-font-main, "Montserrat", Arial, sans-serif) !important;
    color: var(--tsv-text) !important;
    background: transparent !important;

    font-size: 15px !important;
    font-weight: var(--tsv-font-medium, 500) !important;
    line-height: 1.25 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    text-decoration: none !important;

    padding: 3px 0 8px 0 !important;
    margin: 0 !important;

    border: none !important;
    border-bottom: 3px solid transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.tabbed-content.tsv-home-product-tabs > .nav li a:hover {
    color: #1f78d1 !important;
    border-bottom-color: var(--tsv-yellow) !important;
}

.tabbed-content.tsv-home-product-tabs > .nav li.active a,
.tabbed-content.tsv-home-product-tabs > .nav li.current a {
    color: #333333 !important;
    border-bottom-color: var(--tsv-yellow) !important;
}

.tabbed-content.tsv-home-product-tabs > .tab-panels {
    grid-area: tabs-panel !important;
    padding-top: 18px !important;
    margin-top: 0 !important;
    width: 100% !important;
}

.tabbed-content.tsv-home-product-tabs .panel {
    padding: 0 !important;
    margin: 0 !important;
}

.tsv-tabs-more-link {
    position: absolute !important;
    top: 1px !important;
    right: 0 !important;
    display: inline-flex !important;
    align-items: center !important;

    font-family: var(--tsv-font-main, "Montserrat", Arial, sans-serif) !important;
    color: var(--tsv-blue) !important;
    font-size: 15px !important;
    font-weight: var(--tsv-font-bold, 700) !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
    white-space: nowrap !important;

    z-index: 20 !important;
    transition: color .25s ease, transform .25s ease, text-shadow .25s ease !important;
}

.tsv-tabs-more-link:hover {
    color: #1f78d1 !important;
}

.tsv-tabs-more-link.tsv-more-soft-hover {
    color: #1f78d1 !important;
    transform: translateX(3px) !important;
    text-shadow: 0 0 8px rgba(31, 120, 209, .25) !important;
}


/* =====================================================
   04. TABS SẢN PHẨM - MOBILE
===================================================== */

@media only screen and (max-width: 768px) {
    .tabbed-content.tsv-home-product-tabs {
        display: block !important;
        width: 100% !important;
        overflow: visible !important;
        margin-top: 18px !important;
    }

    .tabbed-content.tsv-home-product-tabs::before,
    .tabbed-content.tsv-home-product-tabs::after {
        content: none !important;
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        animation: none !important;
    }

    .tabbed-content.tsv-home-product-tabs > h1,
    .tabbed-content.tsv-home-product-tabs > h2,
    .tabbed-content.tsv-home-product-tabs > h3,
    .tabbed-content.tsv-home-product-tabs > h4,
    .tabbed-content.tsv-home-product-tabs > h5,
    .tabbed-content.tsv-home-product-tabs > h6,
    .tabbed-content.tsv-home-product-tabs > .tsv-original-tabs-title {
        display: none !important;
    }

    .tabbed-content.tsv-home-product-tabs > .nav {
        display: flex !important;
        align-items: flex-end !important;
        flex-wrap: nowrap !important;
        width: 100% !important;

        overflow-x: auto !important;
        overflow-y: hidden !important;
        white-space: nowrap !important;

        border-bottom: 1px solid var(--tsv-line) !important;
        margin: 0 !important;
        padding: 0 !important;

        scrollbar-width: none !important;
        -webkit-overflow-scrolling: touch !important;
        -webkit-mask-image: linear-gradient(to right, #000 0%, #000 90%, transparent 100%) !important;
        mask-image: linear-gradient(to right, #000 0%, #000 90%, transparent 100%) !important;
    }

    .tabbed-content.tsv-home-product-tabs > .nav::-webkit-scrollbar {
        display: none !important;
    }

    .tabbed-content.tsv-home-product-tabs > .nav .tsv-tabs-fixed-title {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        position: relative !important;
        flex: 0 0 auto !important;

        color: #ffffff !important;
        background: var(--tsv-blue) !important;

        font-family: var(--tsv-font-main, "Montserrat", Arial, sans-serif) !important;
        font-size: 14px !important;
        line-height: 1.15 !important;
        font-weight: var(--tsv-font-semibold, 600) !important;
        text-transform: none !important;
        letter-spacing: 0 !important;
        white-space: nowrap !important;

        padding: 6px 6px 6px 16px !important;
        margin: 0 26px 0 0 !important;

        border: none !important;
        border-radius: 0 !important;
        box-shadow: inset 5px 0 0 var(--tsv-red) !important;
        overflow: visible !important;
        z-index: 3 !important;
    }

    .tabbed-content.tsv-home-product-tabs > .nav .tsv-tabs-fixed-title::after {
        content: "" !important;
        position: absolute !important;
        top: 0 !important;
        right: -16px !important;
        width: 15px !important;
        height: 100% !important;
        background: var(--tsv-blue) !important;
        clip-path: polygon(0 0, 100% 50%, 0 100%) !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        z-index: 1 !important;
    }

    .tabbed-content.tsv-home-product-tabs > .nav .tsv-tabs-fixed-title::before {
        content: none !important;
        display: none !important;
    }

    .tabbed-content.tsv-home-product-tabs > .nav li {
        margin-right: 16px !important;
    }

    .tabbed-content.tsv-home-product-tabs > .nav li + li {
        padding-left: 12px !important;
    }

    .tabbed-content.tsv-home-product-tabs > .nav li + li::before {
        bottom: 7px !important;
        font-size: 13px !important;
    }

    .tabbed-content.tsv-home-product-tabs > .nav li a {
        font-size: 13.5px !important;
        font-weight: var(--tsv-font-medium, 500) !important;
        padding: 2px 0 7px 0 !important;
    }

    .tabbed-content.tsv-home-product-tabs > .tab-panels {
        padding-top: 14px !important;
    }

    .tsv-tabs-more-link {
        position: static !important;
        display: table !important;
        margin: 8px 0 0 auto !important;
        font-size: 13.5px !important;
    }
}


/* =====================================================
   05. HOME PRODUCTS MOBILE HIDE SLIDER ARROWS
   Ẩn mũi tên sản phẩm nổi bật trên mobile
===================================================== */

@media only screen and (max-width: 768px) {
    .home .tsv-home-featured-products .flickity-prev-next-button {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}



/* =====================================================
   06. HOME FEATURED PRODUCTS CLS FIX
   Ổn định khối "Mẫu tranh treo tường nổi bật"

   File: modules/home-products/assets/css/tsv-home-products.css

   Nguyên tắc:
   - Giữ cấu trúc hàng ngang của Flatsome.
   - Số cột desktop / tablet / mobile lấy trực tiếp từ UX Builder.
   - Không ép sản phẩm thành 25% hoặc 50%.
   - Giữ sẵn chiều cao ảnh / tên / sao / giá để giảm giật layout.
   - Chỉ áp dụng cho Products có class: .tsv-home-featured-products.
   - Không ảnh hưởng tabs sản phẩm bên dưới.
===================================================== */

body.home #content .tsv-home-featured-products {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

/* Giữ tiêu đề "Mẫu tranh treo tường nổi bật" ổn định khi tải */
body.home #content .tsv-title-normal .section-title {
    min-height: 38px !important;
    display: flex !important;
    align-items: center !important;
    margin-bottom: 18px !important;
}

/* Desktop / laptop: giữ hàng ngang, số cột lấy từ UX Builder */
@media only screen and (min-width: 769px) {
    body.home #content .tsv-home-featured-products .row,
    body.home #content .tsv-home-featured-products .row-small,
    body.home #content .tsv-home-featured-products .products.row,
    body.home #content .tsv-home-featured-products .row-slider {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: stretch !important;

        width: auto !important;
        min-height: 335px !important;

        margin-left: -7px !important;
        margin-right: -7px !important;
        box-sizing: border-box !important;
    }

    /*
     * Chỉ giữ khoảng cách cột.
     * Không đặt flex-basis, width hoặc max-width để Flatsome
     * tự lấy số cột từ thiết lập UX Builder.
     */
    body.home #content .tsv-home-featured-products .product-small.col,
    body.home #content .tsv-home-featured-products .products.row > .product-small.col,
    body.home #content .tsv-home-featured-products .row > .product-small.col,
    body.home #content .tsv-home-featured-products .row-small > .product-small.col {
        padding-left: 7px !important;
        padding-right: 7px !important;
        padding-bottom: 14px !important;
        box-sizing: border-box !important;
    }

    body.home #content .tsv-home-featured-products .flickity-viewport {
        min-height: 335px !important;
    }

    /*
     * Không ép chiều rộng item của Flickity.
     * Flatsome tự tính theo số cột đang đặt trong UX Builder.
     */
    body.home #content .tsv-home-featured-products .flickity-slider > .product-small.col,
    body.home #content .tsv-home-featured-products .flickity-slider > .col {
        padding-left: 7px !important;
        padding-right: 7px !important;
        padding-bottom: 14px !important;
        box-sizing: border-box !important;
    }

    body.home #content .tsv-home-featured-products .product-small .box,
    body.home #content .tsv-home-featured-products .product-small.box {
        min-height: 315px !important;
        height: 100% !important;
        background: #ffffff !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    body.home #content .tsv-home-featured-products .product-small .box-image,
    body.home #content .tsv-home-featured-products .product-small.box .box-image {
        width: 100% !important;
        aspect-ratio: 1 / 1 !important;
        min-height: 210px !important;
        background: #ffffff !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    body.home #content .tsv-home-featured-products .product-small .box-image img,
    body.home #content .tsv-home-featured-products .product-small.box .box-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        object-position: center center !important;
        display: block !important;
    }

    body.home #content .tsv-home-featured-products .product-small .box-text,
    body.home #content .tsv-home-featured-products .product-small .box-text.box-text-products {
        min-height: 105px !important;
        background: #ffffff !important;
        box-sizing: border-box !important;
    }

    body.home #content .tsv-home-featured-products .product-small .title-wrapper {
        min-height: 28px !important;
    }

    body.home #content .tsv-home-featured-products .product-small .star-rating {
        min-height: 22px !important;
    }

    body.home #content .tsv-home-featured-products .product-small .price-wrapper {
        min-height: 24px !important;
    }
}

/* Mobile: giữ hàng ngang, số cột lấy từ thiết lập mobile của UX Builder */
@media only screen and (max-width: 768px) {
    body.home #content .tsv-title-normal .section-title {
        min-height: 32px !important;
        margin-bottom: 12px !important;
    }

    body.home #content .tsv-home-featured-products .row,
    body.home #content .tsv-home-featured-products .row-small,
    body.home #content .tsv-home-featured-products .products.row,
    body.home #content .tsv-home-featured-products .row-slider {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: stretch !important;

        width: auto !important;
        min-height: 300px !important;

        margin-left: -6px !important;
        margin-right: -6px !important;
        box-sizing: border-box !important;
    }

    /*
     * Chỉ giữ khoảng cách cột.
     * Không ép 50%; số cột mobile lấy từ UX Builder.
     */
    body.home #content .tsv-home-featured-products .product-small.col,
    body.home #content .tsv-home-featured-products .products.row > .product-small.col,
    body.home #content .tsv-home-featured-products .row > .product-small.col,
    body.home #content .tsv-home-featured-products .row-small > .product-small.col {
        padding-left: 6px !important;
        padding-right: 6px !important;
        padding-bottom: 14px !important;
        box-sizing: border-box !important;
    }

    body.home #content .tsv-home-featured-products .flickity-viewport {
        min-height: 300px !important;
    }

    body.home #content .tsv-home-featured-products .flickity-slider > .product-small.col,
    body.home #content .tsv-home-featured-products .flickity-slider > .col {
        padding-left: 6px !important;
        padding-right: 6px !important;
        padding-bottom: 14px !important;
        box-sizing: border-box !important;
    }

    body.home #content .tsv-home-featured-products .product-small .box,
    body.home #content .tsv-home-featured-products .product-small.box {
        min-height: 280px !important;
        height: 100% !important;
        background: #ffffff !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    body.home #content .tsv-home-featured-products .product-small .box-image,
    body.home #content .tsv-home-featured-products .product-small.box .box-image {
        width: 100% !important;
        aspect-ratio: 1 / 1 !important;
        min-height: 165px !important;
        background: #ffffff !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    body.home #content .tsv-home-featured-products .product-small .box-image img,
    body.home #content .tsv-home-featured-products .product-small.box .box-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        object-position: center center !important;
        display: block !important;
    }

    body.home #content .tsv-home-featured-products .product-small .box-text,
    body.home #content .tsv-home-featured-products .product-small .box-text.box-text-products {
        min-height: 105px !important;
        background: #ffffff !important;
        box-sizing: border-box !important;
    }

    body.home #content .tsv-home-featured-products .product-small .title-wrapper {
        min-height: 26px !important;
    }

    body.home #content .tsv-home-featured-products .product-small .star-rating {
        min-height: 20px !important;
    }

    body.home #content .tsv-home-featured-products .product-small .price-wrapper {
        min-height: 22px !important;
    }
}
