*,
::after,
::before {
    box-sizing: border-box !important;
}

body {
    background-color: var(--e-global-color-efa0063, #f8f8f8) !important;
    font-family: "Inter", Sans-serif;
}

.hidden {
    display: none !important;
}

.entry-content {
    padding: 0 5px;
}

.card-empty {
    margin: 56px auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 24px;
    text-align: center;
    max-width: 326px;
}

.cart-message {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0;
    color: var(--e-global-color-9514b49, #222222);
}

.card-empty .back-to-products {
    width: 80%;
    background: linear-gradient(90deg, #5596f7 0%, var(--e-global-color-036d495, #4564ed) 100%) !important;
    border-radius: 9999px;
    height: 48px;
    font-weight: 500;
    line-height: 1.5;
    vertical-align: middle;
    letter-spacing: 0;
    font-size: 16px;
    justify-content: center;
    display: flex;
    align-items: center;
    color: var(--e-global-color-c134cba, #ffffff) !important;
}

.cart-container .cart-title {
    margin: 56px 0 24px 0;
}

.cart-container .cart-title h2 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0;
    vertical-align: middle;
    margin-bottom: 0 !important;
    color: var(--e-global-color-9514b49, #222222);
    font-family: "Inter", Sans-serif;
}

.cart-content {
    display: grid;
    grid-template-columns: 795.2fr 340.8fr;
    gap: 24px;
}

.cart-content .cart-table {
    background: var(--e-global-color-c134cba, #ffffff);
    padding: 24px;
    border-radius: 16px;
    height: fit-content;
}

.cart-content .cart-table table {
    border: none !important;
    line-height: 1.5 !important;
    margin-bottom: 0 !important;
}

.cart-content .cart-table th,
.cart-content .cart-table td {
    border: none !important;
}

.cart-content .cart-table tr th {
    line-height: 1.5;
    font-weight: 400 !important;
}

.cart-content .cart-table tr th:first-child {
    padding: 0 12px 16px 0 !important;
}

.cart-content .cart-table tr th:not(:first-child):not(:last-child) {
    padding: 0 12px 16px !important;
}

.cart-content .cart-table tr th:last-child {
    padding: 0 0 16px 12px !important;
}

.cart-content .cart-table th.check-all {
    line-height: 1;
}

.cart-content .cart-table th.title-select-all {
    font-weight: 700 !important;
    letter-spacing: 0;
    line-height: 1.5;
    color: var(--e-global-color-036d495, #4564ed);
}

.cart-content .cart-table thead>tr,
.cart-content .cart-table tbody>tr:not(:last-child) {
    border-bottom: 1px solid var(--e-global-color-3a07225, #dfdfdf);
    border-left: none !important;
    border-top: none !important;
    border-right: none !important;
}

.cart-content .cart-table tr td {
    font-weight: 400 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
}

.cart-content .cart-table tr td:not(.thumbnail) {
    padding-top: 26px !important;
    padding-bottom: 26px !important;
}

.cart-content .cart-table tr td.thumbnail {
    padding-top: 17px !important;
    padding-bottom: 17px !important;
}

.cart-content .cart-table tr:last-child td:not(.thumbnail) {
    padding-bottom: 9px !important;
}

.cart-content .cart-table tr:last-child td.thumbnail {
    padding-bottom: 0 !important;
}

.cart-content .cart-table tr td:first-child {
    padding-left: 0 !important;
}

.cart-content .cart-table tr td:last-child {
    padding-right: 0 !important;
    text-align: right;
}

.cart-table input[type="checkbox"] {
    position: relative;
    width: 22px;
    height: 22px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    border: 1.75px solid var(--e-global-color-3a07225, #dfdfdf);
    border-radius: 4.67px;
    transition: background-color 0.3s, border-color 0.3s;
}

.cart-table input[type="checkbox"]::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 9px;
    width: 5px;
    height: 11px;
    border: solid white;
    border-width: 0 1.5px 1.5px 0;
    opacity: 0;
    transform: rotate(45deg);
    transition: opacity 0.2s ease;
}

.cart-table input[type="checkbox"]:checked {
    background: linear-gradient(90deg, #5596f7 0%, var(--e-global-color-036d495, #4564ed) 100%) !important;
    border: none;
}

.cart-table input[type="checkbox"]:checked::before {
    opacity: 1;
}

.cart-table tbody tr {
    height: 67px;
}

.cart-table td.thumbnail img {
    height: 67px;
    width: 67px;
    max-width: none;
}

.cart-table td.product-name a {
    font-size: 16px;
    font-weight: 600 !important;
    letter-spacing: 0;
    color: var(--e-global-color-9514b49, #222222) !important;
}

/* SP survey: tên là text trần (không có <a>) -> set weight thẳng trên td, specificity cao để chắc chắn đè rule chung */
.cart-content .cart-table tr td.product-name {
    font-weight: 600 !important;
    color: var(--e-global-color-9514b49, #222222) !important;
}

.cart-table td.product-name a:hover {
    color: var(--e-global-color-9514b49, #222222) !important;
}

.cart-table .price>span {
    text-align: right;
    display: block;
}

.cart-table .price-mobile {
    display: none;
}

.cart-table .regular-price {
    padding: 0 !important;
    font-size: 12px;
    font-weight: 400 !important;
    line-height: 1.5;
    letter-spacing: 0;

    text-decoration: line-through;
    color: #888;
}

.cart-table .sale-price {
    padding: 0 !important;
    font-size: 14px;
    font-weight: 700 !important;
    line-height: 1.5;
    letter-spacing: 0;
    color: var(--e-global-color-036d495, #4564ed);
    margin-bottom: 8px;
}

.cart-table .group-quantity-container-mobile {
    display: none;
}

.cart-table .group-quantity-container {
    vertical-align: middle;
    height: 100%;
}

/* ===== Stepper kiểu 6 + số nền xám (giống Shopee) =====
   Nút +/- để trần (không khung, không nền khi bấm), màu xanh thương hiệu.
   Số nằm trong ô xám VUÔNG bo góc ở giữa cho nổi bật. */
.cart-table .group-quantity {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    padding: 0;
    vertical-align: middle;
}

.group-quantity .quantity-increase,
.group-quantity .quantity-decrease {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 28px !important;
    height: 32px !important;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    color: var(--e-global-color-036d495, #4564ed) !important;
    background: transparent !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 0 !important;
    cursor: pointer;
}

.group-quantity input {
    width: 32px !important;
    height: 32px !important;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--e-global-color-9514b49, #222222) !important;
    background: #f3f4f6 !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 0 !important;
}

/* ===== Desktop: căn thẳng hàng GIÁ / SỐ LƯỢNG / THÙNG RÁC =====
   3 ô này là cột bảng riêng -> ép cùng vertical-align:middle để thẳng hàng.
   (Trên mobile các ô này ẩn nên rule không ảnh hưởng) */
.cart-content .cart-table tbody td.price,
.cart-content .cart-table tbody td.group-quantity-container,
.cart-content .cart-table tbody td.product-delete {
    vertical-align: middle !important;
}

/* Khi sản phẩm chỉ có 1 giá (không có giá gạch), bỏ margin-bottom thừa
   của .sale-price để nó căn giữa đúng ngang nút số lượng */
.cart-table .price .sale-price:last-child {
    margin-bottom: 0 !important;
}

/* Thùng rác desktop: svg là inline -> còn khoảng baseline làm lệch.
   Bọc flex + svg display:block để căn giữa dọc chuẩn, thẳng với giá/số lượng. */
.cart-content .cart-table tbody td.product-delete .remove-item {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 0 !important;
}
.cart-content .cart-table tbody td.product-delete .remove-item svg {
    display: block !important;
}

/* Desktop: căn GIỮA cột Đơn giá & Số lượng (cả tiêu đề lẫn nội dung)
   để tiêu đề nằm chính giữa cột, thẳng với giá / stepper bên dưới. */
.cart-content .cart-table tr th.price,
.cart-content .cart-table tr td.price,
.cart-content .cart-table tr th.group-quantity-container,
.cart-content .cart-table tr td.group-quantity-container {
    text-align: center !important;
}
.cart-table .price > span {
    text-align: center !important;
}

.cart-content .cart-totals {
    background: var(--e-global-color-c134cba, #ffffff);
    padding: 24px 16px;
    border-radius: 16px;
    height: fit-content;
}

.cart-totals h2 {
    text-align: center;
    font-size: 20px;
    line-height: 1.5;
    letter-spacing: 0;
    color: var(--e-global-color-9514b49, #222222) !important;
    font-weight: 700 !important;
    margin-bottom: 24px !important;
    font-family: 'Inter', sans-serif !important;
}

.cart-content .cart-table tr th.price,
.cart-content .cart-table tr th.group-quantity-container {
    color: var(--e-global-color-9514b49, #222222) !important;
}

.cart-totals .total-origin,
.cart-totals .total-discount,
.cart-totals .total-payable {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0;
    margin-bottom: 24px;
    align-items: center;
}

.cart-totals .total-origin,
.cart-totals .total-discount {
    padding-bottom: 24px;
    border-bottom: 1px dashed var(--e-global-color-3a07225, #dfdfdf);
}

.cart-totals .total-origin .amount,
.cart-totals .total-discount .amount {
    font-weight: 700 !important;
}

.cart-totals .total-discount .amount {
    font-weight: 700 !important;
    color: var(--e-global-color-e827b1a, #FF730A);
}

.cart-totals .total-payable--title {
    font-weight: 700;
    color: var(--e-global-color-036d495, #4564ed);
}

.cart-totals .total-payable .amount {
    font-weight: 700;
    font-size: 20px;
    color: var(--e-global-color-036d495, #4564ed);
}

.cart-totals .checkout .checkout-button {
    width: 100%;
    background: linear-gradient(90deg, #5596f7 0%, var(--e-global-color-036d495, #4564ed) 100%) !important;
    border-radius: 9999px;
    height: 48px;
    font-weight: 500;
    line-height: 1.5;
    vertical-align: middle;
    letter-spacing: 0;
    font-size: 16px;
}

.cart-totals .toggle-icon {
    display: none;
}

.cart-totals .total-discount,
.cart-totals .total-origin {
    color: var(--e-global-color-9514b49, #222222);
}

#title_select_all::after {
    content: ' (' attr(data-product_capacity) ')';
}

@media (max-width: 1024px) {
    .content-container {
        margin-top: 24px;
    }

    .content-area {
        padding: 0 !important;
    }

    .entry-content {
        padding: 0 12px;
    }

    .cart-content {
        display: block;
    }

    .cart-content .cart-table {
        padding: 16px;
    }

    .cart-hidden {
        overflow: hidden;
        max-height: 0;
        opacity: 0;
        display: none;
        transition: max-height 0.3s ease, opacity 0.3s ease;
    }

    .cart-totals {
        width: 100%;
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 2;
        border-radius: 0% !important;
        box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
    }

    .cart-totals .total-payable--title {
        color: var(--e-global-color-9514b49, #222222);
    }

    .total-payable--price {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    .cart-totals .toggle-icon {
        display: block;
        color: var(--e-global-color-9514b49, #222222);
        font-size: 16px;
    }

    .cart-totals h2 {
        display: none;
    }

    .cart-totals .total-origin,
    .cart-totals .total-discount,
    .cart-totals .total-payable {
        padding: 0 !important;
        border: none !important;
    }
}

@media (max-width: 768px) {
    .entry-content {
        padding: 0 12px;
    }

    .card-empty {
        margin: 24px auto;
    }

    .cart-message {
        font-size: 14px;
    }

    .card-empty .back-to-products {
        height: 40px;
    }

    .cart-content {
        display: block;
    }

    .cart-content .cart-table {
        padding: 16px 8px;
    }

    .cart-container .cart-title {
        margin: 24px 0 16px 0;
    }

    .cart-container .cart-title h2 {
        font-size: 18px;
    }

    .cart-content .cart-table thead tr {
        /* vạch ngăn dưới "Chọn tất cả" - giống vạch giữa 2 sản phẩm */
        border-bottom: 1px solid var(--e-global-color-3a07225, #dfdfdf) !important;
        border-left: none !important;
        border-top: none !important;
        border-right: none !important;
    }

    /* khoảng thở dưới "Chọn tất cả" trước vạch ngăn */
    .cart-content .cart-table thead th {
        padding-bottom: 16px !important;
    }

    .cart-content .cart-table th.title-select-all {
        font-size: 14px;
    }

    .cart-table td.thumbnail img {
        height: 59px;
        width: 59px;
    }

    .cart-content .cart-table td.product-name,
    .cart-table td.product-name a {
        font-size: 12px !important;
    }

    .cart-content .cart-table tr td,
    .cart-content .cart-table tr th {
        font-size: 14px !important;
    }

    .cart-content .cart-table tr td {
        padding: 16px 8px !important;
    }

    .cart-content .cart-table tr th {
        padding: 0px 8px !important;
    }

    .cart-content tr .price,
    .cart-content tr .group-quantity-container {
        display: none !important;
    }

    .cart-table .price-mobile {
        display: flex;
        gap: 4px;
        align-items: baseline;   /* giá sale & giá gạch thẳng baseline (mọi SP) */
    }

    /* margin-bottom:8px của sale-price chỉ hợp khi xếp dọc (desktop);
       trên mobile price-mobile là hàng ngang -> bỏ để 2 giá thẳng hàng */
    .cart-table .price-mobile .sale-price {
        margin-bottom: 0 !important;
    }

    .cart-content .group-quantity-container-mobile {
        display: flex;
        align-items: center;
        margin-top: 2px;
    }

    .cart-table .group-quantity {
        justify-content: start;
    }

    .group-quantity input {
        font-size: 12px !important;
        width: 28px !important;
        height: 28px !important;
    }

    .group-quantity .quantity-increase,
    .group-quantity .quantity-decrease {
        width: 26px !important;
        height: 28px !important;
        font-size: 18px;
    }

    .cart-content .cart-totals {
        padding: 8px 16px 16px;
    }

    .cart-totals .total-origin,
    .cart-totals .total-discount,
    .cart-totals .total-payable {
        margin-bottom: 16px;
        font-size: 14px;
    }

    .cart-totals .checkout .checkout-button {
        height: 40px;
    }

    .cart-totals .total-payable .amount {
        font-size: 18px;
    }
}

/* ============================================================
   MOBILE: Thùng rác xoá SP
   Cách sạch (sửa kèm template cart.php): đặt 1 thùng rác bản mobile
   ngay cạnh nút +/- (trong .group-quantity-container-mobile), và ẨN cột
   thùng rác gốc trên mobile.
   - Ẩn cột gốc -> bảng tự dồn -> tên SP & "Quà tặng..." chiếm TRỌN box.
   - Thùng rác mobile cùng hàng flex với nút +/- -> thẳng hàng tuyệt đối,
     không cần canh px, không phụ thuộc chiều cao.
   (Desktop: cột gốc hiện bình thường; bản mobile tự ẩn vì nằm trong khối
    .group-quantity-container-mobile vốn display:none ở desktop.)
   ============================================================ */
@media (max-width: 768px) {
    /* ẩn cột thùng rác desktop -> tên SP trải hết box */
    .cart-table td.product-delete {
        display: none !important;
    }

    /* hàng nút số lượng: nút +/- bên trái, thùng rác bên phải */
    .cart-content .group-quantity-container-mobile {
        justify-content: space-between !important;
    }

    .group-quantity-container-mobile .remove-item-mobile {
        display: inline-flex !important;
        align-items: center !important;
        flex: 0 0 auto !important;
        margin-left: 12px !important;
    }
}