/* CSS hoàn chỉnh cho giao diện lưới và slider */
.fbt-section-container {
    margin-top: 30px;
}

.fbt-section-title {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 23px;
    color: #000;
}

.fbt-main-wrapper {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* === PHẦN GIAO DIỆN SẢN PHẨM === */
.fbt-products-visual {
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

/* Kiểu dáng chung cho thẻ sản phẩm */
.fbt-product-card {
    display: flex;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    height: 100%;
}

.fbt-card-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    padding: 15px;
    gap: 15px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.3s ease;
    height: 100%;
}
.fbt-product-card:hover .fbt-card-link {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.fbt-card-image {
    width: 80px;
    flex-shrink: 0;
}
.fbt-card-image img {
    max-width: 100%;
    height: auto;
}

.fbt-card-details {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

.fbt-details-main {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
    justify-content: flex-start;
}

.fbt-card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: #000;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fbt-card-description {
    font-size: 11px;
    line-height: 1.5;
    color: #000;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    flex-grow: 1;
}

.fbt-card-price {
    font-size: 11px;
    font-weight: 600;
    color: #d90429;
    margin-top: auto;
    padding-top: 5px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.fbt-card-price .woocommerce-Price-amount {
    display: inline;
    line-height: 1.3;
}
.fbt-card-price del {
    opacity: 1;
    color: #000;
    order: 1;
}
.fbt-card-price ins {
    order: 2;
    text-decoration: none;
}


/* === ĐỊNH DẠNG CHO SLIDER === */
.fbt-slider.swiper {
    padding: 5px 0;
}
.swiper-slide {
    height: auto;
    display: flex;
}
.swiper-slide .fbt-product-card {
    width: 100%;
}

/* === NÚT ĐIỀU HƯỚNG === */
.fbt-products-visual .swiper-button-next,
.fbt-products-visual .swiper-button-prev {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    color: #000;
    transition: all 0.2s ease-out;
    top: 50%;
    transform: translateY(-50%);
}

.fbt-products-visual .swiper-button-prev {
    left: 10px;
}

.fbt-products-visual .swiper-button-next {
    right: 10px;
}

.fbt-products-visual .swiper-button-next:after,
.fbt-products-visual .swiper-button-prev:after {
    font-family: Arial, sans-serif !important;
    font-size: 26px !important;
    font-weight: 300 !important;
    line-height: 1 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-variant: normal !important;
    color: #000 !important;
}
.fbt-products-visual .swiper-button-prev:after {
    content: '‹' !important;
    padding-right: 2px !important;
}
.fbt-products-visual .swiper-button-next:after {
    content: '›' !important;
    padding-left: 2px !important;
}

.fbt-products-visual .swiper-button-next:hover,
.fbt-products-visual .swiper-button-prev:hover {
    background-color: #f8f8f8;
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.fbt-products-visual .swiper-button-next.swiper-button-disabled,
.fbt-products-visual .swiper-button-prev.swiper-button-disabled {
    opacity: 0.35;
    pointer-events: none;
}


/* === PHẦN CHECKLIST VÀ THÊM VÀO GIỎ HÀNG === */
.fbt-products-selection {
    width: 100%;
    border: 1px solid #f0f0f0;
    background-color: #fafafa;
    padding: 20px;
    border-radius: 8px;
}
.fbt-checklist-item { padding: 5px 0; }

.fbt-checklist-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #000;
}

/* Chuyển màu nút tích đã chọn sang màu đỏ */
.fbt-product-checkbox,
.fbt-checklist-item input[type="checkbox"] {
    accent-color: #d90429;
}

.fbt-summary { padding-top: 15px; border-top: 1px dashed #e0e0e0; }

.fbt-total-price {
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: bold;
    color: #000;
}

/* Định dạng lại nút thêm vào giỏ hàng */
.fbt-add-to-cart-button {
    background-color: #d90429 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 30px !important; /* [THAY ĐỔI] Tăng giá trị để bo tròn nhiều hơn */
    width: 100%;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    transition: background-color 0.3s ease !important;
}

.fbt-add-to-cart-button:hover {
    background-color: #b80021 !important;
}


.fbt-add-to-cart .button.loading::after { content: ""; display: block; width: 1em; height: 1em; border: 2px solid rgba(255,255,255,0.5); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; position: absolute; top: 50%; left: 50%; margin-top: -0.5em; margin-left: -0.5em; }
@keyframes spin { to { transform: rotate(360deg); } }
.fbt-message { margin-top: 10px; font-size: 14px; padding: 8px 12px; border-radius: 4px; display: inline-block; }
.fbt-message.success { color: #2e7d32; background-color: #e8f5e9; border: 1px solid #a5d6a7; }
.fbt-message.error { color: #c62828; background-color: #ffebee; border: 1px solid #ef9a9a; }


/* === [SỬA LỖI] Bổ sung responsive cho di động === */
@media screen and (max-width: 768px) {
    .fbt-section-container {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* === [BỔ SUNG] Tối ưu hiển thị tên sản phẩm trên di động === */
@media screen and (max-width: 767px) {
    /* Áp dụng cho tên sản phẩm trong danh sách checklist */
    .fbt-checklist-item label {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%; /* Đảm bảo label chiếm đủ không gian để tính toán overflow */
    }

    /* Quy tắc cho tên sản phẩm trong slider đã có sẵn ở trên, 
       nhưng chúng ta thêm lại ở đây để đảm bảo nó được áp dụng chắc chắn trên mobile. */
    .fbt-card-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ========================================================== */
/* BỔ SUNG: GIAO DIỆN CAROUSEL COMBO (TÁI SỬ DỤNG BCE STYLES) */
/* ========================================================== */
.myfbt-all-combos-wrapper {
    position: relative;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.myfbt-all-combos-wrapper .swiper-slide {
    height: auto;
    padding: 15px 0;
    overflow: visible !important;
}

.promo-card {
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    height: 100%;
    background-color: #ffffff;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin: 0 5px;
}

.promo-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.15);
}

.promo-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.myfbt-all-combos-wrapper .promo-image-wrapper img, 
.myfbt-all-combos-wrapper .promo-image-wrapper > div.myfbt-fallback-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.promo-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.promo-content h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: bold;
    color: #222;
}

.promo-description {
    font-size: 14px;
    color: #555;
    flex-grow: 1;
    line-height: 1.5;
}

.promo-actions {
    padding: 20px 15px;
    text-align: center;
    flex-shrink: 0;
    border-top: 1px solid #f0f0f0;
}

.myfbt-all-combos-wrapper .myfbt-promo-toggle-btn {
    display: inline-block !important;
    padding: 6px 18px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #000000 !important;
    background-color: #ffffff !important;
    border: 1px solid #000000 !important;
    border-radius: 50px !important;
    cursor: pointer;
    text-align: center;
    text-decoration: none !important;
    line-height: normal !important;
    min-height: auto !important;
    transition: all 0.2s ease-in-out !important;
}

.myfbt-all-combos-wrapper .myfbt-promo-toggle-btn:hover {
    background-color: #f5f5f5 !important;
    color: #000000 !important;
    border-color: #000000 !important;
}

/* Nút điều hướng Carousel ngoài */
.myfbt-all-combos-wrapper .swiper-button-next,
.myfbt-all-combos-wrapper .swiper-button-prev {
    background-color: rgba(52, 58, 64, 0.7) !important;
    color: #fff !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    transition: background-color 0.2s ease-in-out !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin-top: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.myfbt-all-combos-wrapper .swiper-button-next:after,
.myfbt-all-combos-wrapper .swiper-button-prev:after {
    content: "" !important;
    font-size: 0 !important;
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    color: transparent !important;
    font-family: transparent !important;
}

.myfbt-all-combos-wrapper .swiper-button-next:after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E") !important;
    margin-left: 2px !important;
}

.myfbt-all-combos-wrapper .swiper-button-prev:after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'%3E%3C/polyline%3E%3C/svg%3E") !important;
    margin-right: 2px !important;
}

.myfbt-all-combos-wrapper .swiper-button-next:hover,
.myfbt-all-combos-wrapper .swiper-button-prev:hover {
    background-color: rgba(52, 58, 64, 0.9) !important;
    color: #fff !important;
}

/* ========================================================== */
/* BỔ SUNG: POPUP MODAL COMBO CHI TIẾT                        */
/* ========================================================== */
.myfbt-modal {
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.myfbt-modal-content {
    background-color: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: myfbtFadeIn 0.3s ease-out;
}

.myfbt-modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}

.myfbt-modal-close:hover {
    color: #000;
}

#myfbt-modal-body .fbt-section-container {
    margin-top: 0; /* Reset margin top inside modal */
}

@keyframes myfbtFadeIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media screen and (max-width: 768px) {
    .myfbt-modal-content {
        width: 95%;
        padding: 15px;
    }
    
    .myfbt-all-combos-wrapper {
        padding-bottom: 30px;
    }
    
    .myfbt-all-combos-wrapper .swiper-wrapper {
        align-items: stretch;
    }
    
    .myfbt-all-combos-wrapper .swiper-slide {
        display: flex;
        height: auto;
    }
    
    .promo-card {
        height: 100%;
        width: 100%;
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    
    .promo-content h3 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .promo-description {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;  
        overflow: hidden;
    }
}

/* =================================================================== */
/* == CSS CHO LƯỚI / BỐ CỤC ELEMENTOR (BẢN SAO TỪ BCE PROMOTIONS)    == */
/* =================================================================== */

.bce-promotions-grid-wrapper {
    display: grid;
    gap: 20px 15px;
}
.bce-promotions-grid-wrapper:not(.horizontal-layout) { grid-template-columns: repeat(4, 1fr); }
.bce-promotions-grid-wrapper.horizontal-layout { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1024px) {
    .bce-promotions-grid-wrapper:not(.horizontal-layout) { grid-template-columns: repeat(2, 1fr); }
    .bce-promotions-grid-wrapper.horizontal-layout { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
    .bce-promotions-grid-wrapper:not(.horizontal-layout),
    .bce-promotions-grid-wrapper.horizontal-layout { grid-template-columns: 1fr; gap: 20px; }
}

/* --- THEO DẠNG NGANG (HORIZONTAL) --- */
.horizontal-layout .swiper-slide { height: auto; }
.horizontal-layout .promo-card-horizontal {
    display: flex; flex-direction: row; align-items: center;
    border: 1px solid #e0e0e0; border-radius: 8px; height: 100%;
    max-height: 150px; background-color: #ffffff; overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease; margin: 0 5px;
}
.horizontal-layout .promo-card-horizontal:hover {
    transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
.horizontal-layout .promo-image-wrapper-horizontal {
    flex: 0 0 150px; height: 150px; position: relative;
}
.horizontal-layout .promo-image-wrapper-horizontal img {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover;
}
.horizontal-layout .promo-content-wrapper-horizontal {
    flex: 1; display: flex; flex-direction: column; padding: 15px 20px; justify-content: space-between; height: 100%;
}
.horizontal-layout .myfbt-promo-toggle-btn {
    padding: 6px 20px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
}
.horizontal-layout .promo-content { padding: 0; flex-grow: 1; }
.horizontal-layout .promo-content h3 { font-size: 15px; font-weight: 600; margin: 0 0 5px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.horizontal-layout .promo-description {
    font-size: 13px; color: #666; line-height: 1.4; margin-bottom: 10px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.horizontal-layout .promo-actions { padding: 0; border-top: none; text-align: left; flex-shrink: 0; }

@media (max-width: 767px) {
    .horizontal-layout .promo-card-horizontal { max-height: none; height: auto; min-height: 120px; }
    .horizontal-layout .promo-image-wrapper-horizontal { flex: 0 0 120px; height: 100%; min-height: 120px; }
    .horizontal-layout .promo-content-wrapper-horizontal { padding: 10px 15px; }
    .horizontal-layout .myfbt-promo-toggle-btn {
        padding: 5px 15px !important;
        font-size: 12px !important;
    }
    .horizontal-layout .promo-content h3 { 
        font-size: 14px; 
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .horizontal-layout .promo-description { 
        font-size: 12px; 
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;  
        overflow: hidden;
    }
}

/* --- THEO DẠNG GỌN GÀNG (CLEAN) --- */
.clean-layout .promo-card { border: none; background-color: transparent; }
.clean-layout .promo-card:hover { transform: none; box-shadow: none; }
.clean-layout .promo-image-wrapper { border-radius: 0; }
.clean-layout .myfbt-promo-toggle-btn,
.clean-layout .myfbt-promo-custom-link-btn,
.clean-layout .myfbt-promo-claim-points-btn,
.clean-layout .myfbt-promo-toggle-shipping-btn {
    padding: 5px 14px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
}
.clean-layout .promo-content { padding-left: 0; padding-right: 0; padding-bottom: 5px; }
.clean-layout .promo-actions { text-align: left; padding-left: 0; padding-right: 0; border-top: none; padding-top: 10px; }