﻿/* 🟢 Mặc định: Hiển thị danh sách sản phẩm theo Grid */
.bcom-banner {
    display: grid;
    grid-template-columns: repeat(var(--banner-per-row, 1), 1fr);
}

    .bcom-banner.swiper-container {
        grid-template-columns: repeat(1, 1fr);
        gap: unset;
    }

        /* Nếu `data-banner-per-row="2"` thì ẩn từ banner thứ 3 trở đi */
        .bcom-banner.swiper-container[data-per-row="2"] .swiper-wrapper .swiper-slide:nth-child(n+3) {
            visibility: hidden;
            position: absolute;
            pointer-events: none;
        }

        /* Nếu `data-banner-per-row="3"` thì ẩn từ banner thứ 4 trở đi */
        .bcom-banner.swiper-container[data-per-row="3"] .swiper-wrapper .swiper-slide:nth-child(n+4) {
            visibility: hidden;
            position: absolute;
            pointer-events: none;
        }

        /* Nếu `data-banner-per-row="4"` thì ẩn từ banner thứ 5 trở đi */
        .bcom-banner.swiper-container[data-per-row="4"] .swiper-wrapper .swiper-slide:nth-child(n+5) {
            visibility: hidden;
            position: absolute;
            pointer-events: none;
        }

        .bcom-banner.swiper-container .swiper-wrapper {
            display: grid;
            grid-template-columns: repeat(var(--banner-per-row, 1), 1fr);
            gap: calc(var(--banner-gap, 5) * 1px);
            overflow: hidden;
        }
        /* 🟢 Cấu hình chiều cao nếu có data-two-row="True" */
        .bcom-banner.swiper-container[data-two-row="True"] .swiper-wrapper {
        }

    /* 🔴 Khi Swiper đã khởi tạo (có class `swiper-initialized`) */
    .bcom-banner.swiper-initialized .swiper-wrapper {
        display: flex; /* Swiper cần flex để hoạt động */
        grid-template-columns: unset;
        gap: unset;
        width: 100%; /* Đảm bảo full màn hình */
        min-width: 100%;
    }

        .bcom-banner.swiper-initialized .swiper-wrapper .swiper-slide {
            visibility: visible;
            position: relative;
            pointer-events: auto;
        }

            .bcom-banner.swiper-initialized .swiper-wrapper .swiper-slide img {
                display: block !important;
            }

/* 🟢 Mặc định: Hiển thị danh sách sản phẩm theo Grid */
.pwcom-productlist {
    display: grid;
    grid-template-columns: repeat(var(--product-per-row, 5), 1fr);
    gap: var(--product-gap, 5px);
}

    .pwcom-productlist.swiper-container {
        grid-template-columns: repeat(1, 1fr);
        gap: unset;
    }

        .pwcom-productlist.swiper-container .swiper-wrapper {
            display: grid;
            grid-template-columns: repeat(var(--product-per-row, 5), 1fr);
            gap: var(--product-gap, 5px);
            height: 360px;
            overflow: hidden;
        }
        /* 🟢 Cấu hình chiều cao nếu có data-two-row="True" */
        .pwcom-productlist.swiper-container[data-two-row="True"] .swiper-wrapper {
            height: 720px;
            padding-bottom: 5px;
        }

    /* 🔴 Khi Swiper đã khởi tạo (có class `swiper-initialized`) */
    .pwcom-productlist.swiper-initialized .swiper-wrapper {
        display: flex; /* Swiper cần flex để hoạt động */
        grid-template-columns: unset;
        gap: unset;
        width: 100%; /* Đảm bảo full màn hình */
        min-width: 100%;
    }



/* 🟢 Box sản phẩm */
.pwcom-productlist-box {
    background: #fff;
    padding: 10px;
    border-radius: 0 0 10px 10px;
    margin-bottom: 10px;
}

/* 🟢 Thiết lập số cột theo `data-per-row` */
.pwcom-productlist[data-per-row="6"] {
    --product-per-row: 6;
    --product-gap: 10px;
}

.pwcom-productlist[data-per-row="5"] {
    --product-per-row: 5;
    --product-gap: 10px;
}

.pwcom-productlist[data-per-row="4"] {
    --product-per-row: 4;
    --product-gap: 10px;
}

/* 🟢 Responsive: Mobile dưới 972px */
@media (max-width: 972px) {
    .pwcom-productlist {
        --product-per-row: 4 !important;
    }
}

/* 🟢 Responsive: Mobile dưới 768px (Fix 2 cột) */
@media (max-width: 768px) {
    .pwcom-productlist {
        --product-per-row: 2 !important;
    }
}

/* 🟢 Ảnh sản phẩm giữ nguyên kích thước */
.pwcom-productlist .product-thumbnail {
    width: 100%;
}

    .pwcom-productlist .product-thumbnail a {
        width: 100%;
    }


/* Căn giữa theo chiều ngang */
.pwcom-destination-url {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px auto 0;
    padding: 8px 40px;
    font-size: 16px;
    font-weight: bold;
    color: #C5232B;
    border: 1px solid #e9f0f5;
    border-radius: 6px;
    background-color: #e9f0f5;
    text-decoration: none;
    transition: all 0.3s ease-in-out;
    width: fit-content;
}

    .pwcom-destination-url b {
        font-weight: normal;
    }

    /* Hiệu ứng hover */
    .pwcom-destination-url:hover {
        text-decoration: none;
    }

    /* Căn chỉnh nội dung trong nút */
    .pwcom-destination-url span {
        display: flex;
        align-items: center;
        gap: 4px;
    }

/* Định nghĩa layout mặc định là 6 sản phẩm trên 1 hàng */
.product-thumbnail {
    width: calc(100% / var(--product-per-row) - var(--product-gap));
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 10px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out;
    height: 360px;
}

    /* Khi hover, sản phẩm nhảy lên nhẹ */
    .product-thumbnail:hover {
        transform: translateY(-5px);
    }

    .product-thumbnail a:hover {
        text-decoration: none;
    }

    .product-thumbnail .card-img-top {
        display: flex;
        align-items: center;
        justify-content: center;
        width: calc(100% - 20px);
        height: calc(210px - 60px);
        margin: 30px 10px;
        padding-bottom: 50px;
        position: relative;
    }

        .product-thumbnail .card-img-top img {
            max-width: 100%;
            max-height: 100%;
            transition: all 300ms ease-in-out;
            margin-top: 8px;
            -webkit-transition: all 300ms ease-in-out;
            position: absolute;
            z-index: 0;
        }

    .product-thumbnail a:hover .card-img-top img {
        margin-top: 0;
    }

    .product-thumbnail .card-img-top .product-item-coupon {
        display: block;
        position: absolute;
        left: -10px;
        top: -30px;
        z-index: 99;
        background-color: #ed1c24;
        color: #fff;
        padding: 2px 5px;
        border-radius: 3px;
        font-size: 11px;
    }

    .product-thumbnail .product-brand {
        display: none !important;
        position: absolute;
        top: 13px;
        left: 5px;
        height: 19px;
        background-size: contain !important;
        width: 80px;
    }

        .product-thumbnail .product-brand img {
            display: block;
            max-height: 15px;
        }

    .product-thumbnail .product-name {
        color: #007bff;
        font-size: 14px;
        line-height: 21px;
        height: 42px;
        text-overflow: ellipsis;
        overflow: hidden;
        margin-bottom: 8px;
    }

    .product-thumbnail .product-attributes {
        display: inline-block;
        margin: 0 !important;
        max-height: 24px;
        overflow: hidden;
    }

        .product-thumbnail .product-attributes li {
            float: left;
            border: 1px solid #667085;
            border-radius: 2px;
            color: #667085;
            display: inline-block;
            font-size: 12px;
            line-height: 12px;
            margin-right: 5px;
            padding: 4px 6px;
            margin-bottom: 5px;
            white-space: nowrap;
        }

    .product-thumbnail .product-specialtype-box {
        position: relative;
        margin-top: 5px;
        margin-bottom: 5px;
        padding: 0 -10px;
        z-index: 990;
    }

        .product-thumbnail .product-specialtype-box img {
            margin-top: 0 !important;
            -webkit-transition: none !important;
            transition: none !important;
        }

        .product-thumbnail .product-specialtype-box span {
            position: absolute;
            top: 28px;
            right: 5px;
            color: #ff0000;
            font-weight: bold;
            font-size: 23px;
        }

    .product-thumbnail .product-pricetype-special {
        position: relative;
        margin-top: 10px;
    }

        .product-thumbnail .product-pricetype-special span {
            position: absolute;
            top: 6px;
            right: 20px;
            text-decoration: line-through;
            color: #fff;
            font-weight: bold;
            font-size: 15px;
        }

    .product-thumbnail .product-price {
        margin-top: 1px !important;
        margin-bottom: 0 !important;
    }

    .product-thumbnail .card::before {
        content: "";
        box-shadow: 10px 0 5px -2px rgba(0, 0, 0, 0.25);
        z-index: 1;
    }

    .product-thumbnail .card::after {
        box-shadow: -2px 5px 0px 10px rgba(0, 0, 0, 0.25);
    }

    .product-thumbnail .card:hover .product-name {
        color: #288ad6 !important;
    }


    .product-thumbnail .product-promotionshort {
        color: #1d2939;
        font-size: 12px;
    }

        .product-thumbnail .product-promotionshort a, .product-thumbnail .product-promotionshort a * {
            font-size: 12px !important;
            font-weight: bold;
        }

    .product-thumbnail .product-price .product-price-saving,
    .product-thumbnail .product-price .product-price-regular {
    }

    .product-thumbnail .product-price {
        margin-top: 6px;
        margin-bottom: 0;
        color: #C5232B;
        font-weight: bold;
        font-size: 18px;
    }

    .product-thumbnail .product-price-regular {
        margin-top: 6px;
        margin-bottom: 6px;
    }

        .product-thumbnail .product-price-regular span {
            text-decoration: line-through;
            line-height: 21px;
            color: #a4a4a4;
        }

            .product-thumbnail .product-price-regular span.product-price-saving {
                text-decoration: unset;
                font-size: 13px;
                color: #C5232B;
            }

    .product-thumbnail .buttons {
        padding: 9px;
    }

    .product-thumbnail .btn {
        background: #ddd;
        font-size: 18px;
        padding: 5px 10px;
        border: 0;
        color: #18ba9b;
        border-radius: 0;
        margin: -1px;
    }

        .product-thumbnail .btn:hover {
            background: #eee;
        }

    .product-thumbnail .btn-add-cart-style {
        background: #f0f0f0;
        padding: 8px 0px;
        font-size: 14px;
        color: #777;
        text-align: center;
        width: 100%
    }

    .product-thumbnail .card:hover .btn-add-cart-style {
        background: #2cd5b6;
        color: #fff;
    }


/**ProductList Filter*/
.products-filter25 {
    margin: 10px 0 0;
    background-color: #fff;
    padding: 10px;
}

#sort-by-full {
    background-color: #fff;
    padding: 0 10px 10px;
    margin: 0;
}

    #sort-by-full li {
        line-height: 30px;
    }

.box-filter {
}

.box-filter__toggle {
    display: inline-block;
    font-size: 14px;
    line-height: 19px;
    margin-right: 8px;
    position: relative;
    padding-bottom: unset;
    float: left;
    border-radius: 8px;
    cursor: pointer;
    padding: 8px 12px;
    background-color: #fff;
    border: 1px solid #2a83e9;
}

    .box-filter__toggle i {
        background: url(/cdn/images/icons/filter.png) no-repeat center top;
        display: inline-block;
        vertical-align: top;
        width: 20px;
        height: 20px;
        background-size: 100%;
    }

    .box-filter__toggle .arrow {
        display: none;
        width: 27px;
        height: 14px;
        top: 36px;
        left: 25px;
        position: absolute;
        overflow: hidden;
    }

        .box-filter__toggle .arrow::before {
            content: "";
            position: absolute;
            width: 27px;
            height: 27px;
            background: #fff;
            transform: rotate(45deg);
            top: 10px;
            left: 0;
            box-shadow: -2px -2px 5px -4px;
        }

.box-filter__item.box-filter__item__highlight {
    margin: 0;
    padding: 0;
}

    .box-filter__item.box-filter__item__highlight li a {
        padding: 9px;
    }


.blurred::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Màu tối với độ mờ 0.5 */
    z-index: 999;
}

.blurred .box-filter__toggle {
    z-index: 1000;
}

    .blurred .box-filter__toggle .arrow {
        display: inline-block;
    }

.box-filter__body {
    position: absolute;
    top: 70px;
    left: 10px;
    width: 80%;
    max-height: 70vh;
    background: white;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    display: none;
    z-index: 1000;
    border-radius: 5px;
}

.box-filter__body--scroll::-webkit-scrollbar {
    width: 6px;
}

.box-filter__body--scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.box-filter__body--scroll::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

    .box-filter__body--scroll::-webkit-scrollbar-thumb:hover {
        background: #555;
    }

.box-filter__selected {
    display: none;
    flex-wrap: wrap; /* Cho phép xuống dòng nếu không đủ chỗ */
    align-items: center;
    gap: 8px; /* Khoảng cách giữa các phần tử */
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f9f9f9;
}

    .box-filter__selected[data-filter="True"] {
        display: flex;
    }

    .box-filter__selected span {
        font-weight: bold;
        white-space: nowrap; /* Giữ "Đã chọn:" trên một dòng */
    }

.box-filter__selected-remove {
    display: flex;
    flex-wrap: wrap; /* Xuống dòng khi không đủ chỗ */
    gap: 8px; /* Khoảng cách giữa các item */
}

.box-filter__selected .box-filter__itema {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: background 0.3s;
}

.filter__selected--removeAll {
    white-space: nowrap;
    text-decoration: none;
    padding: 0 12px;
    line-height: 38px;
}

    .filter__selected--removeAll:hover {
        color: red;
    }


.box-filter__item {
    padding: 8px 10px;
}

.box-filter__itemtype a {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #333;
    font-size: 13px;
    padding: 4px 8px;
    transition: all 0.3s ease;
}

    .box-filter__itemtype a::before {
        content: "";
        display: inline-block;
        width: 14px;
        height: 14px;
        border: 2px solid #888;
        border-radius: 3px;
        transition: border-color 0.2s ease;
    }

    .box-filter__itemtype a[data-filter="True"]::before {
        background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>') no-repeat center;
        background-size: 10px;
        border-color: #333;
    }

    .box-filter__itemtype a:hover {
        color: #007bff;
    }

        .box-filter__itemtype a:hover::before {
            border-color: #007bff;
        }

.box-filter__itemtype p,
.box-filter__itembrand p {
    font-weight: bold;
    margin-bottom: 5px;
}

.box-filter__itemtype ul,
.box-filter__itembrand ul {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    overflow-x: auto;
    padding: 0;
    list-style: none;
    margin: 0;
}

    .box-filter__itemtype ul::-webkit-scrollbar,
    .box-filter__itembrand ul::-webkit-scrollbar {
        display: none;
    }

.box-filter__itemtype li,
.box-filter__itembrand li {
    margin: 0;
}

    .box-filter__itembrand li a {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 6px;
        border: 1px solid #ccc;
        border-radius: 5px;
        transition: all 0.3s ease;
    }

        .box-filter__itembrand li a img {
            height: 18px;
        }

        .box-filter__itembrand li a[data-filter="True"] {
            border: 1px solid #007bff;
        }

.box-filter__itemattribute {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start; /* Căn tất cả các ul lên trên cùng */
}

    .box-filter__itemattribute ul {
        width: calc(33.33% - 10px); /* Chia đều 3 cột */
        list-style: none;
        padding: 0;
        margin: 0;
        border-top: 1px solid #ccc;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: flex-start; /* Đảm bảo các li không bị kéo dài */
    }

        /* Tiêu đề (b) full 1 hàng */
        .box-filter__itemattribute ul li:first-child {
            width: 100%;
            margin: 8px 0;
        }

        /* Các mục còn lại không bị kéo dài */
        .box-filter__itemattribute ul li:not(:first-child) {
            flex: 0 1 auto; /* Không tự kéo dài, chỉ vừa với nội dung */
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* Style cho thẻ a */
        .box-filter__itemattribute ul li a {
            display: block;
            text-decoration: none;
            color: #333;
            padding: 6px;
            border: 1px solid #ccc;
            border-radius: 4px;
            transition: all 0.3s ease;
            text-align: center;
        }

            /* Hover hoặc được chọn thì viền xanh */
            .box-filter__itemattribute ul li a:hover,
            .box-filter__itemattribute ul li a[data-filter="True"] {
                border-color: #007bff;
                color: #007bff;
            }


.box-filter__close {
    position: absolute;
    top: 6px;
    right: 6px;
    background: white;
    border: 1px solid #ccc;
    padding: 5px 12px;
    border-radius: 4px;
    display: inline-flex; /* Chỉ vừa đủ nội dung */
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    width: auto; /* Đảm bảo không full hàng */
    max-width: fit-content; /* Chỉ chiếm đúng nội dung */
    white-space: nowrap; /* Ngăn xuống dòng */
    background-clip: padding-box; /* Tránh bị che bởi nền */
    z-index: 10; /* Đảm bảo luôn hiển thị trên các phần tử khác */
}

    .box-filter__close i {
        display: inline-block;
        width: 12px;
        height: 12px;
        border-radius: 50%;
        position: relative;
    }

        .box-filter__close i::before,
        .box-filter__close i::after {
            content: "";
            position: absolute;
            top: 50%;
            left: 50%;
            width: 8px;
            height: 2px;
            background: #333;
            transform-origin: center;
        }

        .box-filter__close i::before {
            transform: translate(-50%, -50%) rotate(45deg);
        }

        .box-filter__close i::after {
            transform: translate(-50%, -50%) rotate(-45deg);
        }

    /* Hover effect */
    .box-filter__close:hover {
        background: #f8f8f8;
        border-color: #999;
    }

.box-filter__item__btn {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%; /* Chiếm toàn bộ chiều rộng của popup nhưng không full hàng */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px; /* Khoảng cách giữa hai nút */
    background: white;
    padding: 6px 0;
    box-shadow: 0px -2px 5px rgba(0, 0, 0, 0.1); /* Viền trên để phân cách */
}

    /* Style chung cho cả 2 nút */
    .box-filter__item__btn a {
        padding: 6px 16px;
        font-size: 13px;
        font-weight: bold;
        border-radius: 5px;
        text-decoration: none;
        white-space: nowrap;
    }

    /* Nút "Bỏ chọn" */
    .box-filter__item__btn .btn-filter-close {
        background: white;
        color: black;
        border: 1px solid #ddd;
    }

        .box-filter__item__btn .btn-filter-close:hover {
            background: #f0f0f0;
        }

    /* Nút "Xem kết quả" */
    .box-filter__item__btn .btn-filter-readmore {
        background: #007bff;
        color: white;
    }

        .box-filter__item__btn .btn-filter-readmore:hover {
            background: #0056b3;
        }

        /* Style cho số kết quả */
        .box-filter__item__btn .btn-filter-readmore b.total-reloading {
            font-weight: bold;
            margin-left: 5px;
        }


.btn-filter-readmore.disabled {
    background: #ccc !important;
    color: #666 !important;
    cursor: not-allowed;
}



.loadingOverlay {
    position:relative;
    pointer-events: none; /* Không cho tương tác khi đang loading */
    opacity:0.6;
}

    /* Nền mờ toàn phần */
    .loadingOverlay::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255, 255, 255, 0.6); /* nền mờ trắng, bạn có thể đổi màu */
        z-index: 10;
    }

    /* Spinner ở giữa */
    .loadingOverlay::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 30px;
        height: 30px;
        border: 3px solid #ccc;
        border-top: 4px solid #3498db;
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
        transform: translate(-50%, -50%);
        z-index: 11;
    }

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}
