/* === Nâng cấp: CSS cho tiêu đề chính === */
.my-full-cart-container .cart-page-title {
    font-size: 18px !important;
    font-weight: 600 !important;
    margin-bottom: 25px;
}

/* === Giai đoạn 1: CSS cho bố cục cơ bản === */
.my-full-cart-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
}
.my-full-cart__body {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}
.my-full-cart__products-column {
    flex: 2;
    min-width: 300px;
}
.my-full-cart__summary-column {
    flex: 1;
    min-width: 280px;
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 20px; /* Tạo khoảng cách giữa các box */
}

/* === Giai đoạn 2: CSS cho danh sách sản phẩm chi tiết === */
.my-full-cart-container .cart-items-wrapper {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.my-full-cart-container .cart-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}
.my-full-cart-container .cart-item:last-child {
    border-bottom: none;
}

.my-full-cart-container .cart-item__image {
    flex-shrink: 0;
}
.my-full-cart-container .cart-item__image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.my-full-cart-container .cart-item__details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0; /* Cần thiết để text-overflow hoạt động đúng */
}

.my-full-cart-container a.cart-item__name {
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    color: #222;
    /* === FIX: Rút gọn tên sản phẩm thành 1 dòng === */
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* ============================================= */
}
.my-full-cart-container a.cart-item__name:hover {
    color: #d90429;
}

.my-full-cart-container .cart-item__sku {
    font-size: 13px;
    color: #777;
    padding-top: 0;
}

.my-full-cart-container .cart-item__short-desc {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    margin-top: 0;
}
.my-full-cart-container .cart-item__short-desc p {
    margin: 0;
}

.my-full-cart-container .cart-item__short-desc.two-lines {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.my-full-cart-container .cart-item__quantity {
    flex-shrink: 0;
}
.my-full-cart-container .cart-item__quantity .input-text.qty {
    width: 60px;
    padding: 8px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.my-full-cart-container .cart-item__price {
    font-weight: 600;
    font-size: 16px;
    text-align: right;
    min-width: 100px;
}

.my-full-cart-container .cart-item__actions {
    margin-top: 5px; /* Điều chỉnh lại margin top cho desktop */
}
.my-full-cart-container .cart-item__actions a.cart-item__remove {
    font-size: 13px;
    color: #0073aa;
    text-decoration: underline;
    cursor: pointer;
}
.my-full-cart-container .cart-item__actions a.cart-item__remove:hover {
    color: #d90429;
}


.my-full-cart-container .cart-actions {
    margin-top: 20px;
    text-align: right;
}
.my-full-cart-container .cart-actions .button {
    background-color: #cc0000 !important;
    color: white !important;
    font-weight: normal !important;
    padding: 10px 20px !important;
    border: none !important;
    border-radius: 50px !important;
    cursor: pointer;
    font-size: 15px !important;
    transition: background-color 0.3s ease;
    line-height: normal !important;
    height: auto !important;
}
.my-full-cart-container .cart-actions .button:hover {
    background-color: #b30000 !important;
}

.my-full-cart-container .cart-empty {
    padding: 20px;
    text-align: center;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}
.my-full-cart-container .cart-empty p {
    font-size: 1.2em;
    margin-bottom: 20px;
}
.my-full-cart-container .cart-empty .button {
     background-color: #d90429;
     color: white;
     text-decoration: none;
     padding: 12px 25px;
     border-radius: 4px;
     display: inline-block;
}

/* === CSS cho Cột Tóm Tắt Đơn Hàng === */
.my-full-cart-container .my-cart-summary-box,
.my-full-cart-container .my-cart-coupon-box,
.my-full-cart-container .my-cart-member-benefits-box {
    border: 1px solid #e0e0e0;
    padding: 25px;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.my-full-cart-container .summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.my-full-cart-container .summary-line--total {
     margin-bottom: 15px;
}

.my-full-cart-container .summary-line--total .summary-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.my-full-cart-container .summary-line--total .summary-value {
    font-size: 20px;
    font-weight: 700;
}
.my-full-cart-container .summary-line--total .summary-value .woocommerce-Price-amount {
     color: #333;
}

.my-full-cart-container .summary-actions {
    margin-top: 20px;
}

.my-full-cart-container .summary-actions .checkout-button {
    display: block !important;
    width: 100% !important;
    background-color: #cc0000 !important;
    color: #fff !important;
    text-align: center !important;
    font-size: 16px !important;
    font-weight: bold !important;
    padding: 12px 20px !important;
    text-decoration: none !important;
    border: none !important;
    border-radius: 50px !important;
    cursor: pointer;
    transition: background-color 0.3s ease;
    line-height: normal !important;
    height: auto !important;
}

.my-full-cart-container .summary-actions .checkout-button:hover {
    background-color: #b30000 !important;
}

/* === CSS Bổ sung cho Loader === */
.my-full-cart-form {
    position: relative;
}

.my-full-cart-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.my-full-cart-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-left-color: #cc0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* === CSS cho các khối nội dung tùy chỉnh trong Summary Box === */
.my-cart-summary__custom-blocks {
    border-top: 1px dashed #e0e0e0;
    padding-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-custom-block {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #666;
    text-decoration: none;
    line-height: 1.5;
}

a.summary-custom-block:hover .summary-custom-block__text {
    color: #d90429;
}

.summary-custom-block__icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.summary-custom-block__text {
    transition: color 0.2s ease;
}

/* === CSS cho khu vực mã khuyến mãi === */
.my-full-cart__coupon-section {
    padding-top: 0; /* Bỏ padding top vì box cha đã có */
}

.coupon-promo-link {
    font-size: 14px;
    color: #0073aa;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 15px;
}
.coupon-promo-link:hover {
    color: #d90429;
}

.coupon-form {
    display: flex;
    gap: 10px;
}

.coupon-form .input-text {
    flex-grow: 1;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.coupon-form .button {
    background-color: #000 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 50px !important;
    padding: 10px 20px !important;
    font-weight: bold !important;
    cursor: pointer;
    transition: background-color 0.3s ease;
    line-height: normal !important;
    height: auto !important;
    font-size: 14px !important;
}

.coupon-form .button:hover {
    background-color: #333 !important;
}

/* === CSS CHO KHỐI LỢI ÍCH THÀNH VIÊN === */
.my-cart-member-benefits-box {
    display: flex;
    flex-direction: column;
}

.member-benefits__title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: #333;
}

.member-benefits__tier {
    font-size: 14px;
    color: #555;
    margin: 0 0 2px 0;
}

.member-benefits__points {
    font-size: 14px;
    color: #555;
    margin: 0 0 15px 0;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.member-benefits__items-wrapper {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.member-benefits__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    padding: 5px 0;
}

.member-benefits__item:hover .member-benefits__item-text {
    color: #d90429;
}

.member-benefits__item-text {
    transition: color 0.2s ease;
}

.member-benefits__item-arrow {
    font-size: 24px;
    font-weight: bold;
    color: #777;
}

/* === CSS CHO CÁC DÒNG TÓM TẮT MỚI (BẢN CẬP NHẬT ĐÁNG TIN CẬY) === */

/* 1. Trạng thái mặc định (không có giảm giá) */
.my-cart-summary-box .summary-line--subtotal {
    padding-bottom: 15px;
    border-bottom: none;
}

.my-cart-summary-box .my-cart-summary__discounts {
    display: none; /* Ẩn khu vực giảm giá */
}

.my-cart-summary-box .summary-line--total {
    margin-bottom: 0;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0; /* Đây là dòng kẻ hợp nhất */
}

/* 2. Ghi đè khi có mã giảm giá (dựa vào class .summary--has-discounts) */
.my-cart-summary-box.summary--has-discounts .my-cart-summary__discounts {
    display: block; /* Hiện lại khu vực giảm giá */
    padding: 15px 0;
    border-top: 1px solid #e0e0e0;    /* Thêm dòng kẻ trên */
    border-bottom: 1px solid #e0e0e0; /* Thêm dòng kẻ dưới */
}

.my-cart-summary-box.summary--has-discounts .summary-line--total {
    border-top: none; /* Xóa dòng kẻ hợp nhất để tránh lặp */
}

/* Các style cho nội dung dòng giảm giá (giữ nguyên) */
.summary-line--discount .summary-label {
    font-size: 14px;
    color: #333;
}
.summary-line--discount .summary-value {
    font-size: 14px;
    color: #d90429;
    font-weight: 600;
}

/* === CSS CHO THÔNG BÁO COUPON === */
#coupon-notice-wrapper {
    margin-bottom: 10px;
}
.coupon-notice {
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
}
.coupon-notice.notice-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}
.coupon-notice.notice-error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* Responsive cho màn hình nhỏ */
@media (max-width: 768px) {
    /* === FIX: Thêm padding cho container chính trên mobile === */
    .my-full-cart-container {
        padding-left: 15px;
        padding-right: 15px;
        box-sizing: border-box; /* Đảm bảo padding không làm tăng chiều rộng tổng */
    }
    /* ========================================================= */

    .my-full-cart__summary-column {
        gap: 20px;
    }
    .my-full-cart-container .cart-item {
        flex-wrap: wrap;
        position: relative;
        padding-bottom: 60px; /* Thêm khoảng trống ở dưới cho nút số lượng và giá */
    }
    .my-full-cart-container .cart-item__image {
        position: absolute;
        left: 20px;
        top: 20px;
    }
    .my-full-cart-container .cart-item__details {
        flex-basis: 100%;
        margin-left: 95px; /* Tạo khoảng trống cho ảnh */
    }
    .my-full-cart-container .cart-item__quantity {
        position: absolute;
        bottom: 20px;
        left: 20px;
    }
    .my-full-cart-container .cart-item__price {
        position: absolute;
        bottom: 20px;
        right: 20px;
        font-size: 18px;
    }
    
    /* === FIX: Di chuyển nút "Xóa sản phẩm" xuống dưới mô tả ngắn === */
    .my-full-cart-container .cart-item__actions {
       position: static; /* Hủy bỏ định vị tuyệt đối */
       margin-top: 10px; /* Tạo khoảng cách với phần tử bên trên */
    }
    /* =============================================================== */

    /* === FIX: Hiển thị mũi tên tăng/giảm số lượng trên mobile === */
    .my-full-cart-container .cart-item__quantity .input-text.qty::-webkit-outer-spin-button,
    .my-full-cart-container .cart-item__quantity .input-text.qty::-webkit-inner-spin-button {
        -webkit-appearance: auto;
        opacity: 1;
        margin: 0;
    }

    .my-full-cart-container .cart-item__quantity .input-text.qty {
        -moz-appearance: textfield;
    }
     /* =============================================================== */
}
/* === TÍCH HỢP LOYALTY: Bắt đầu === */

/* Style cho box đổi điểm */
.my-full-cart-container .my-cart-loyalty-box {
    border: 1px solid #e0e0e0;
    padding: 25px;
    border-radius: 8px;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.my-cart-loyalty-box .loyalty-box__title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #333;
}

.my-cart-loyalty-box .loyalty-box__balance {
    font-size: 14px;
    color: #555;
    margin: 0;
}

.my-cart-loyalty-box .loyalty-form {
    display: flex;
    gap: 10px;
}

.my-cart-loyalty-box .loyalty-form .input-text {
    flex-grow: 1;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.my-cart-loyalty-box .loyalty-form .button {
    background-color: #000 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 50px !important;
    padding: 10px 20px !important;
    font-weight: bold !important;
    cursor: pointer;
    transition: background-color 0.3s ease;
    line-height: normal !important;
    height: auto !important;
    font-size: 14px !important;
}

.my-cart-loyalty-box .loyalty-form .button:hover {
    background-color: #333 !important;
}

.my-cart-loyalty-box #bce-loyalty-messages {
    font-size: 13px;
    color: #c62828;
    margin-top: 5px;
}

/* Style cho dòng phí trong bảng tóm tắt */
.my-cart-summary-box .my-cart-summary__fees {
    /* Thiết lập tương tự khu vực giảm giá */
    padding: 0;
    border-top: none;
    border-bottom: none;
    display: flex;
    flex-direction: column;
    gap: 8px; /* Khoảng cách giữa các dòng phí */
}

/* Chỉ thêm border khi có cả phí và coupon */
.my-cart-summary-box.summary--has-discounts .my-cart-summary__fees {
     padding-top: 15px;
}

.my-cart-summary__fees:not(:empty) {
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}
.my-cart-summary-box.summary--has-discounts .my-cart-summary__fees:not(:empty) {
    border-bottom: none;
}


.summary-line--fee .summary-label {
    font-size: 14px;
    color: #333;
}

.summary-line--fee .summary-value {
    font-size: 14px;
    color: #d90429;
    font-weight: 600;
}

/* === TÍCH HỢP LOYALTY: Kết thúc === */


/* ================================================================== */
/* === GIAI ĐOẠN 1: STICKY CART FOOTER (NÂNG CẤP) === */
/* ================================================================== */

:root {
    /* === NÂNG CẤP: Đã sửa chiều cao sau khi bỏ 2 nút === */
    --mmc-sticky-footer-height: 65px; 
    
    /* Lấy lại biến của MMBM để dùng */
    --my-mbm-height: 60px; 
    --my-mbm-safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

.my-full-cart__sticky-footer {
    position: fixed;
    left: 0;
    right: 0;
    /* QUAN TRỌNG: Định vị nó nằm trên MMBM */
    bottom: calc(var(--my-mbm-height) + var(--my-mbm-safe-area-bottom));
    
    width: 100%;
    max-width: 100vw;
    z-index: 2147483646; /* Thấp hơn MMBM (3647) 1 bậc */
    
    display: none; /* Ẩn trên desktop */
    flex-direction: column;
    background-color: #ffffff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    
    /* Hiệu ứng ẩn/hiện */
    visibility: hidden;
    transform: translate3d(0, 100%, 0);
    -webkit-transform: translate3d(0, 100%, 0);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1), visibility 0.3s;
}

/* Lớp điều khiển hiển thị (sẽ được JS thêm vào) */
.my-full-cart__sticky-footer.is-visible {
    visibility: visible;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
}

/* Giao diện thanh chính (màu đỏ) */
.sticky-footer__main-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: #d90429; /* Màu đỏ như ảnh */
    color: #ffffff;
    /* === NÂNG CẤP: Thêm border-top để tách biệt rõ ràng === */
    border-top: 1px solid #e0e0e0;
}

.sticky-footer__info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.sticky-footer__total-label {
    font-size: 13px;
    font-weight: 500;
}

.sticky-footer__total-amount {
    font-size: 16px;
    font-weight: 700;
}
.sticky-footer__total-amount .woocommerce-Price-amount {
    color: #ffffff;
}

.sticky-checkout-button {
    background-color: #ffffff !important;
    color: #d90429 !important;
    border: none !important;
    border-radius: 50px !important;
    padding: 10px 24px !important;
    font-size: 15px !important;
    font-weight: bold !important;
    flex-shrink: 0;
    height: auto !important;
    line-height: normal !important;
}

/* === SỬA LỖI: Bỏ viền/outline khi click vào nút Thanh toán === */
.sticky-checkout-button:focus,
.sticky-checkout-button:active {
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
}


/* === NÂNG CẤP: ĐÃ XÓA CSS CHO CÁC NÚT THANH TOÁN PHỤ === */


/* Chỉ áp dụng trên mobile */
@media (max-width: 767px) {
    .my-full-cart__sticky-footer {
        display: flex; /* Hiển thị thanh sticky trên mobile */
    }

    /* * Ghi đè padding của MMBM, cộng thêm chiều cao của thanh mới
     * Chúng ta dùng `padding-bottom` trên `my-full-cart-container`
     * thay vì `body` để tránh ảnh hưởng đến các trang khác.
     */
    .my-full-cart-container {
        padding-bottom: calc(var(--mmc-sticky-footer-height) + var(--my-mbm-height) + var(--my-mbm-safe-area-bottom));
    }
}

/* ================================================================== */
/* === GIAI ĐOẠN 3: TÍCH HỢP ẨN/HIỆN (SUPPRESSION API) === */
/* ================================================================== */

/* * TỰ ĐỘNG TÍCH HỢP VỚI MY MOBILE BOTTOM MENU
 * Khi MMBM bị ẩn (do popup khác mở), nó thêm class 'my-mbm-suppressed' vào body.
 * Chúng ta dùng class này để ẩn luôn thanh sticky của mình.
 */
body.my-mbm-suppressed .my-full-cart__sticky-footer {
    transform: translate3d(0, 200%, 0) !important;
    -webkit-transform: translate3d(0, 200%, 0) !important;
    visibility: hidden !important;
}