/* =======================================================
   FIX LỖI ĐÈ HEADER & BỐ CỤC WRAPPER
======================================================= */
.b2s-wrapper {
    margin-top: -15px;
    background-color: #d4eaff42;
    padding-bottom: 30px;
    min-height: 100vh;
}

html {
    scroll-behavior: smooth;
}
@media (max-width: 1024px) {
    .b2s-wrapper {
        margin-top: 50px;
    }
}

@media (max-width: 991px) {
    .b2s-wrapper {
        margin-top: 120px;
    }
}

@media (max-width: 465px) {
    .b2s-wrapper {
        margin-top: 95px;
    }
}

/* =======================================================
   HERO BANNER CÓ ĐƯỜNG CONG
======================================================= */
.b2s-hero-wrap {
    position: relative;
    width: 100%;
    margin-bottom: 15px;
}

.b2s-hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    aspect-ratio: 1920 / 558;
    background: linear-gradient(to right, #b0d3fd, #95eee8);
    -webkit-mask-image: url('/templates/laptopre/assets/images/bts/nen-background.png');
        mask-image: url('/templates/laptopre/assets/images/bts/nen-background.png');
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

.b2s-hero-content {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.b2s-hero-pc {
    display: none;
    width: 75%;
    max-width: 960px;
    margin: 0 auto;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%), linear-gradient(to bottom, black 0%, black 98%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}

.b2s-hero-mb {
    display: block;
    width: 100%;
    padding: 0 10px;
}

@media (min-width: 768px) {
    .b2s-hero-pc {
        display: block;
        margin: 0 auto;
    }

    .b2s-hero-mb {
        display: none;
    }
}

@media (max-width: 768px) {
    .b2s-hero-bg {
        aspect-ratio: auto;
        height: 280px;
        -webkit-mask-size: cover;
        -webkit-mask-position: bottom center;
    }
}

/* =======================================================
   KHỐI NHÓM HÀNG ƯU ĐÃI (CHIA DÒNG TRÊN MOBILE)
======================================================= */
.b2s-top-nav-block {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
    align-items: center;
    position: relative;
}

.b2s-gift-banner {
    width: 100%;
    max-width: 500px;
}

.b2s-gift-banner img {
    width: 100%;
    height: auto;
    border-radius: 16px;
}

.b2s-category-links {
    width: 100%;
    text-align: center;
}

.b2s-category-title {
    max-width: 350px;
    margin: 0 auto 10px auto;
}

.b2s-category-title img {
    width: 100%;
    height: auto;
}

/* Grid 3 Cột 2 Hàng cho nhóm ưu đãi trên Mobile */
.b2s-category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding-bottom: 10px;
}

.b2s-cat-item {
    display: block;
    transition: transform 0.3s ease;
    border-radius: 12px;
}

.b2s-cat-item img {
    width: 100%;
    height: auto;
    border-radius: 12px;
}

.b2s-cat-item:hover {
    transform: translateY(-3px);
}

@media (min-width: 768px) {
    .b2s-category-grid {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .b2s-cat-item {
        flex: 0 0 calc(33.333% - 10px);
    }
}

@media (min-width: 992px) {
    .b2s-top-nav-block {
        flex-direction: row;
        align-items: flex-start;
    }

    .b2s-gift-banner {
        flex: 0 0 38%;
        max-width: 38%;
    }

    .b2s-category-links {
        flex: 0 0 calc(62% - 15px);
        max-width: calc(62% - 15px);
    }
}

/* =======================================================
   CẤU TRÚC SECTION (GIẤY Ô LY & NESTED BLOCK)
======================================================= */
.b2s-promo-section {
    margin-bottom: 30px;
    border-radius: 20px;
    background: transparent;
    position: relative;
}

.b2s-promo-banner {
    display: block;
    width: 100%;
}

.b2s-promo-banner img {
    width: 100%;
    height: auto;
    display: block;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    object-fit: cover;
}

.b2s-promo-body {
    padding: 15px;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.b2s-inner-box {
    position: relative;
    background-color: #fffff4;
    border-radius: 16px;
    padding: 24px 16px 16px 16px;
    background-image: linear-gradient(to bottom, #e7e7e7 1px, transparent 1px), linear-gradient(to right, #e7e7e7 1px, transparent 1px);
    background-size: 24px 24px;
    z-index: 1;
}

.b2s-deco-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    height: 14px;
    width: calc(100% + 16px);
    border-radius: 20px;
    border: 5px solid #fff;
    z-index: 2;
}

/* THEME */
.theme-flashsale .b2s-promo-body {
    background: linear-gradient(to bottom, #012a71, #0145ba);
}

.theme-flashsale .b2s-deco-line {
    background-color: #e11d48;
}

.theme-flashsale .b2s-filter-btn {
    border-color: rgba(225, 29, 72, 0.4);
    color: #e11d48;
}

.theme-flashsale .b2s-filter-btn:hover,
.theme-flashsale .b2s-filter-btn.active {
    background-color: #e11d48;
    color: #fff;
    border-color: #e11d48;
}

.theme-pink .b2s-promo-body {
    background: linear-gradient(to bottom, #a2e3f6, #69dafe)
}

.theme-pink .b2s-deco-line {
    background-color: #2811c1;
}

.theme-pink .b2s-filter-btn {
    border-color: rgba(33, 41, 184, 0.4);
    color: #2135b8;
}

.theme-pink .b2s-filter-btn:hover,
.theme-pink .b2s-filter-btn.active {
    background-color: #212bb8;
    color: #fff;
    border-color: #212bb8;
}

.theme-blue .b2s-promo-body {
    background: linear-gradient(to bottom, #e0f2fe, #bae6fd);
}

.theme-blue .b2s-deco-line {
    background-color: #0284c7;
}

.theme-blue .b2s-filter-btn {
    border-color: rgba(2, 132, 199, 0.4);
    color: #0284c7;
}

.theme-blue .b2s-filter-btn:hover,
.theme-blue .b2s-filter-btn.active {
    background-color: #0284c7;
    color: #fff;
    border-color: #0284c7;
}

.theme-purple .b2s-promo-body {
    background: linear-gradient(to bottom, #DFE0FF, #C2C4FF);
}

.theme-purple .b2s-deco-line {
    background-color: #1736C8;
}

.theme-purple .b2s-filter-btn {
    border-color: rgba(23, 54, 200, 0.4);
    color: #1736C8;
}

.theme-purple .b2s-filter-btn:hover,
.theme-purple .b2s-filter-btn.active {
    background-color: #1736C8;
    color: #fff;
    border-color: #1736C8;
}

/* HEADER BÊN TRONG */
.b2s-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.b2s-section-title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    text-transform: uppercase;
    display: flex;
    align-items: center;
}

/* Bổ sung Text Ngày cho Countdown */
.b2s-countdown {
    display: flex;
    align-items: center;
    gap: 6px;
}

.b2s-countdown-item {
    background: #d70018;
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 6px;
    min-width: 36px;
    text-align: center;
}

.b2s-countdown-sep {
    color: #d70018;
    font-weight: bold;
    font-size: 18px;
    margin-top: -2px;
}

.b2s-countdown-text {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin: 0 2px;
}

.b2s-filter-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    padding: 0 10px;
    position: relative;
}

.b2s-filter-label {
    font-weight: 700;
    color: #333;
    font-size: 14px;
    margin-right: 5px;
}

.b2s-filter-btn {
    background: #fff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.3s ease;
    border: 1px solid;
    cursor: pointer;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.b2s-filter-btn.brand-btn {
    padding: 4px 12px;
    min-height: 36px;
}

.b2s-filter-btn.brand-btn img {
    height: 18px;
    width: auto;
    max-width: 80px;
    object-fit: contain;
    transition: all 0.3s ease;
}

.theme-pink .b2s-filter-btn.brand-btn.active img,
.theme-blue .b2s-filter-btn.brand-btn.active img,
.theme-flashsale .b2s-filter-btn.brand-btn.active img,
.theme-purple .b2s-filter-btn.brand-btn.active img {
    filter: brightness(0) invert(1);
}

/* KHỐI SẢN PHẨM */
.b2s-product-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.b2s-product-grid .cdt-product {
    display: none;
}

.cdt-product {
    height: 100%;
    flex-direction: column;
    border: 1px solid #eaecf0;
    border-radius: 12px;
    padding: 12px;
    transition: all 0.3s ease;
    background: #fff;
    position: relative;
    z-index: 3;
}

.cdt-product:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-3px);
    cursor: pointer;
}

.cdt-product__img {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    height: 170px;
    width: 100%;
}

.cdt-product__img a {
    display: block;
    width: 100%;
    height: 100%;
}

.cdt-product__img img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.5s ease;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><rect fill="%23f1f5f9" width="300" height="300"/></svg>') center center no-repeat;
    background-size: cover;
    border-radius: 8px;
}

.cdt-product__img img.loaded {
    opacity: 1;
    background: none;
}

.cdt-product__label {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    z-index: 2;
}

.cdt-product__info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.cdt-product__name {
    font-size: 14px;
    font-weight: bold;
    color: #920909;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
    margin-top: 12px;
    line-height: 1.4;
}

.props.wp-num-config {
    font-size: 12px;
    color: #475569;
    margin-bottom: 10px;
    background: #f8fafc;
    padding: 8px;
    border-radius: 6px;
    border: 1px dashed #e2e8f0;
}

.price_flash_sale {
    margin-top: auto;
}

.price_flash_sale strong {
    font-size: 17px;
    color: #d70018;
    display: block;
    font-weight: 800;
}

.price_flash_sale span {
    font-size: 13px;
    color: #94a3b8;
    text-decoration: line-through;
}

.price_flash_sale .save_money {
    color: #059669;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    font-size: 12px;
    margin-top: 3px;
    background: #d1fae5;
    padding: 2px 6px;
    border-radius: 4px;
}

.cdt-product__text-promo {
    font-size: 11px;
    font-weight: 600;
    color: #0159a0;
    background: #e0f2fe;
    padding: 6px;
    border-radius: 6px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Nút Xem Tất Cả */
.b2s-view-all {
    text-align: center;
    margin-top: 20px;
}

.b2s-view-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 30px;
    background: #fff;
    border: 2px solid #ccc;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.theme-pink .b2s-view-all-btn {
    color: #2165b8;
    border-color: #2165b8;
}

.theme-pink .b2s-view-all-btn:hover {
    background: #2165b8;
    color: #fff;
    box-shadow: 0 5px 15px rgba(184, 33, 37, 0.2);
}

.theme-blue .b2s-view-all-btn {
    color: #0284c7;
    border-color: #0284c7;
}

.theme-blue .b2s-view-all-btn:hover {
    background: #0284c7;
    color: #fff;
    box-shadow: 0 5px 15px rgba(2, 132, 199, 0.2);
}

.theme-purple .b2s-view-all-btn {
    color: #1736C8;
    border-color: #1736C8;
}

.theme-purple .b2s-view-all-btn:hover {
    background: #1736C8;
    color: #fff;
    box-shadow: 0 5px 15px rgba(23, 54, 200, 0.2);
}

.theme-flashsale .b2s-view-all-btn {
    color: #d70018;
    border-color: #d70018;
}

.theme-flashsale .b2s-view-all-btn:hover {
    background: #d70018;
    color: #fff;
    box-shadow: 0 5px 15px rgba(215, 0, 24, 0.2);
}

/* BOX BÀI VIẾT FAQ / THỂ LỆ */
.b2s-article-box {
    background: #fff;
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-top: 30px;
    position: relative;
}

.b2s-article-box h3 {
    color: #0159a0;
    font-weight: 800;
    font-size: 22px;
    margin-bottom: 12px;
}

.b2s-article-box p {
    color: #475569;
    font-size: 15px;
    margin-bottom: 15px;
    line-height: 1.6;
}

.btn-readmore-b2s {
    background: linear-gradient(90deg, #d70018 0%, #ff6a00 100%);
    color: #fff;
    font-weight: bold;
    padding: 10px 30px;
    border-radius: 30px;
    border: none;
    outline: none;
    transition: 0.3s;
}

.btn-readmore-b2s:hover {
    opacity: 0.9;
    color: #fff;
    box-shadow: 0 5px 15px rgba(215, 0, 24, 0.3);
}

/* RESPONSIVE MÀN NHỎ */
@media (max-width: 991px) {
    .b2s-product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .b2s-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .b2s-promo-body {
        padding: 10px;
    }

    .b2s-inner-box {
        padding: 20px 10px 10px 10px;
    }

    .b2s-filter-group {
        flex-wrap: wrap;
        justify-content: center;
        overflow: visible;
        padding-bottom: 0;
    }

    .b2s-filter-btn {
        white-space: nowrap;
        padding: 6px 12px;
        font-size: 12px;
    }

    .b2s-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .b2s-section-title {
        font-size: 18px;
    }

    .cdt-product {
        padding: 8px;
    }

    .cdt-product__img {
        height: 140px;
    }
}

/* =======================================================
   LÀM NỔI BẬT TEXT "DEAL CHỚP NHOÁNG"
======================================================= */
.theme-flashsale .b2s-section-title {
    background: linear-gradient(90deg, #d70018, #ff6a00, #d70018, #ffb800);
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shineText 3s linear infinite;
    font-size: 26px;
    text-shadow: 0px 4px 15px rgba(215, 0, 24, 0.2);
}

@keyframes shineText {
    to {
        background-position: 200% center;
    }
}

.theme-flashsale .b2s-section-title i {
    color: #ffb800;
    animation: flashPulse 1s infinite;
    display: inline-block;
    filter: drop-shadow(0 0 5px rgba(255, 184, 0, 0.5));
}

@keyframes flashPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* =======================================================
   BỘ LỌC MỚI: RADIO SWITCH (CHỌN HÃNG HOẶC NGÀNH)
======================================================= */
.b2s-switch-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    position: relative;
    z-index: 5;
}
.b2s-switch-btn {
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    border-radius: 30px;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 700;
    color: #64748b;
    outline: none;
    transition: all 0.3s ease;
    cursor: pointer;
}
.b2s-switch-btn:hover { background: #e2e8f0; }

.theme-pink .b2s-switch-btn.active {
    background: #2621b8;
    color: #fff;
    border-color: #2621b8;
    box-shadow: 0 4px 10px rgba(184, 33, 37, 0.3);
}

/* =======================================================
   BỘ LỌC MỚI: SẮP XẾP (GIÁ, KHUYẾN MÃI)
======================================================= */
.b2s-sort-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    padding-top: 15px;
    border-top: 1px dashed #cbd5e1;
}
.b2s-sort-label {
    font-weight: bold;
    color: #475569;
    font-size: 14px;
    margin-right: 5px;
}
.b2s-sort-btn {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    transition: all 0.3s ease;
    outline: none;
    cursor: pointer;
}
.theme-pink .b2s-sort-btn.active {
    background: #fef2f2;
    color: #2621b8;
    border-color: #2621b8;
}
.theme-pink .b2s-sort-btn i { margin-right: 5px; color: #94a3b8; }
.theme-pink .b2s-sort-btn.active i { color: #2621b8; }
/* ========================================================
   FIX TRẠNG THÁI ACTIVE CHO HỆ THỐNG NÚT B2S-SORT VÀ B2S-FILTER
======================================================== */
.b2s-sort-btn,
.b2s-filter-btn {
    transition: all 0.2s ease-in-out;
    outline: none !important;
}

/* Kích hoạt màu khi nút Sắp Xếp được nhấn active */
.b2s-sort-btn.active {
    background-color: #fff7ed !important;
    border-color: #ff9800 !important;
    color: #c2410c !important;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.15);
}
/* =========================================================
   LƯỚI THÔNG SỐ TỪ $config->beauty_param (RENDER THẲNG HTML GỐC)
   Scope trong .sale-card-specs để không ảnh hưởng CSS .specs-grid
   dùng ở nơi khác trên site (vd trang chi tiết sản phẩm).
   Tự chia đều cột theo số khối thực tế (3 hoặc 4) bằng flexbox,
   không cần biết trước số lượng khối.
========================================================= */
.sale-card-specs {
    padding: 10px 12px 0 12px;
    min-height: 58px;
}

.sale-card-specs .specs-grid {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.sale-card-specs .spec-block {
    display: flex;
    gap: 5px;
    flex: 1 1 0;
    min-width: 0;
    padding: 0 3px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-left: 1px solid var(--sale-border);
}

.sale-card-specs .spec-block:first-child {
    padding-left: 0;
    border-left: none;
}

.sale-card-specs .spec-icon {
    width: 13px;
    height: 13px;
    font-size: 12px;
    color: var(--sale-gray);
    flex-shrink: 0;
    text-align: center;
    margin-top: 1px;
    object-fit: contain;
}

.sale-card-specs .spec-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

/* Ẩn nhãn (CPU/RAM/Card đồ họa/AI), chỉ hiện giá trị */
.sale-card-specs .spec-label {
    display: none;
}

.sale-card-specs .spec-value {
    font-size: 12px;
    color: var(--sale-text);
    font-weight: 800;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 768px) {
    .sale-card-specs .specs-grid {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .sale-card-specs .spec-block {
        flex: 1 1 45%;
        border-left: none;
        padding-left: 0;
    }

    .sale-card-specs .spec-block:nth-child(odd) {
        padding-right: 6px;
    }

    .sale-card-specs .spec-value {
        font-size: 11px;
    }
}