.cms-promotions .block-products-list .product-items,
.cms-promotions .block-new-products .product-items {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 24px !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.cms-promotions .block-products-list .product-item,
.cms-promotions .block-new-products .product-item {
    width: auto !important;
    min-width: 0 !important;
    border: 2px solid #0095ff !important;
    border-radius: 18px !important;
    padding: 16px !important;
    background: #fff !important;
    box-shadow: 0 4px 12px rgba(0, 149, 255, 0.06) !important;
    box-sizing: border-box !important;
    aspect-ratio: auto !important;
}

.cms-promotions .block-products-list .product-photo-container,
.cms-promotions .block-new-products .product-photo-container,
.cms-promotions .block-products-list .product-item-photo,
.cms-promotions .block-new-products .product-item-photo {
    display: block !important;
    width: 100% !important;
    aspect-ratio: 2 / 3 !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    background: #f8fafc !important;
}

.cms-promotions .block-products-list .product-photo-container img,
.cms-promotions .block-new-products .product-photo-container img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

.cms-promotions .section-header h2:after {
    background: #0095ff !important;
}

.cms-promotions .login-required-tooltip {
    position: relative;
    display: block;
    width: 100%;
}

.cms-promotions .login-required-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    width: max-content;
    max-width: min(280px, 90vw);
    padding: 8px 10px;
    border-radius: 6px;
    background: #1e293b;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    z-index: 20;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.cms-promotions .login-required-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

.cms-promotions .action.tocart.is-login-required,
.cms-promotions .action.tocart.is-login-required:hover {
    background: #cbd5e1 !important;
    color: #64748b !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    transform: none !important;
}

@media (max-width: 1100px) {
    .cms-promotions .block-products-list .product-items,
    .cms-promotions .block-new-products .product-items {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 560px) {
    .cms-promotions .block-products-list .product-items,
    .cms-promotions .block-new-products .product-items {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
   CĂN CHỈNH LẠI CẤU TRÚC 2 CỘT (SIDEBAR VÀ LƯỚI SẢN PHẨM) VÀ XÓA KHOẢNG TRẮNG
   ========================================================================== */

/* Ép container chính thu hẹp khoảng cách với Hero banner */
.cms-promotions .page-main {
    padding-top: 0 !important;
    margin-top: 10px !important;
}

/* Biến container thành Flexbox giúp Sidebar và Content nằm ngang hàng */
.cms-promotions .catalog-search-container.theme-orange {
    display: flex !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    gap: 24px !important;
    align-items: flex-start !important;
    padding-top: 10px !important;
}

/* Định dạng độ rộng Sidebar bộ lọc bên trái */
.cms-promotions .catalog-search-container.theme-orange .sidebar-main {
    width: 23% !important;
    flex: 0 0 23% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* Định dạng phần Lưới kết quả bên phải chiếm phần còn lại */
.cms-promotions .catalog-search-container.theme-orange .search-results-content {
    width: 77% !important;
    flex: 0 0 77% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* Đảm bảo khối widget lồng bên trong kéo giãn 100% */
.cms-promotions .search-results-content .block-products-list,
.cms-promotions .search-results-content .block-new-products {
    width: 100% !important;
    margin: 0 !important;
}

/* Responsive cho Mobile & Tablet */
@media (max-width: 992px) {
    .cms-promotions .catalog-search-container.theme-orange {
        flex-direction: column !important;
        padding: 0 16px !important;
    }
    .cms-promotions .catalog-search-container.theme-orange .sidebar-main,
    .cms-promotions .catalog-search-container.theme-orange .search-results-content {
        width: 100% !important;
        flex: 0 0 100% !important;
    }
}

/* Fix khoảng trắng do .columns mặc định nằm giữa hero và danh sách sản phẩm. */
body.cms-promotions #maincontent > .bookstore-listing-hero + #contentarea + .columns,
body.cms-promotions #maincontent > .bookstore-cms-hero + #contentarea + .columns {
    display: contents !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.cms-promotions #maincontent > .bookstore-listing-hero + #contentarea + .columns > .column.main,
body.cms-promotions #maincontent > .bookstore-cms-hero + #contentarea + .columns > .column.main {
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

body.cms-promotions #maincontent > .catalog-search-container {
    margin-top: 18px !important;
}

@media (max-width: 820px) {
    body.cms-promotions .catalog-search-container.theme-orange {
        display: flex !important;
        flex-direction: column !important;
        gap: 18px !important;
        padding: 0 16px !important;
    }

    body.cms-promotions .catalog-search-container.theme-orange .sidebar.sidebar-main {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
    }

    body.cms-promotions .catalog-search-container.theme-orange .search-results-content {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
    }

    body.cms-promotions .catalog-search-container.theme-orange .product-items,
    body.cms-promotions .catalog-search-container.theme-orange .products-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 16px !important;
    }

    body.cms-promotions .catalog-search-container.theme-orange .product-item {
        width: 100% !important;
        min-width: 0 !important;
        padding: 14px !important;
        box-sizing: border-box !important;
    }

    body.cms-promotions .catalog-search-container.theme-orange .product-image-photo,
    body.cms-promotions .catalog-search-container.theme-orange .product-image-container,
    body.cms-promotions .catalog-search-container.theme-orange .product-photo-container {
        max-width: 100% !important;
    }

    body.cms-promotions .catalog-search-container.theme-orange .product-photo-container,
    body.cms-promotions .catalog-search-container.theme-orange .product-item-photo,
    body.cms-promotions .catalog-search-container.theme-orange .product-image-container,
    body.cms-promotions .catalog-search-container.theme-orange .product-image-wrapper {
        aspect-ratio: 1 / 1.12 !important;
        max-height: 260px !important;
    }
}

@media (max-width: 360px) {
    body.cms-promotions .catalog-search-container.theme-orange .product-items,
    body.cms-promotions .catalog-search-container.theme-orange .products-grid {
        grid-template-columns: 1fr !important;
    }
}
