/* ========================================= */
/*      TỐI ƯU SIDEBAR GIỎ HÀNG (MINI-CART)   */
/* ========================================= */

/* --- Biến màu và cài đặt chung --- */
:root {
    --cart-primary-color: #111;
    --cart-secondary-color: #555;
    --cart-accent-color: #23bccd;
    --cart-border-color: #eaeaea;
    --cart-bg-color: #ffffff;
    --cart-sidebar-width: 450px;
    /* Điều chỉnh chiều rộng sidebar tại đây */
}

/* --- Ngăn cuộn trang nền khi sidebar mở --- */
body.mini-cart-open {
    overflow: hidden;
}

/* --- Lớp mờ Overlay --- */
.mini-cart-overlay.active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 99998;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease;
}

/* --- Khung Sidebar chính --- */
#mini-cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: var(--cart-sidebar-width);
    height: 100%;
    background-color: var(--cart-bg-color);
    box-shadow: -6px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
}

#mini-cart-sidebar.active {
    transform: translateX(0);
}

/* --- Nội dung Sidebar --- */
.mini-cart-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem;
}

/* --- Header của Sidebar --- */
.mini-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 1px solid var(--cart-border-color);
    flex-shrink: 0;
}

.mini-cart-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    font-family: 'Title', sans-serif;
    color: var(--cart-primary-color);
}

/* [SỬA LỖI] Nút Tắt (Close Button) được làm rõ ràng hơn */
.mini-cart-close {
    background: transparent;
    border: none;
    font-family: 'Material Icons';
    /* Sử dụng font icon đã có */
    font-size: 28px;
    cursor: pointer;
    color: var(--cart-secondary-color);
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.mini-cart-close:hover {
    background-color: #f0f0f0;
    color: var(--cart-primary-color);
}

.mini-cart-close::before {
    content: 'close';
    /* Tên icon Material */
}


/* --- Nội dung chính (khu vực cuộn) --- */
.widget_shopping_cart_content {
    flex-grow: 1;
    overflow-y: auto;
}

/* --- Danh sách sản phẩm --- */
ul.woocommerce-mini-cart {
    padding: 0;
    margin: 0;
    list-style: none;
}

/* [SỬA LỖI] Bố cục mỗi sản phẩm và thống kê số lượng rõ ràng hơn */
.woocommerce-mini-cart-item {
    /* display: flex; */
    align-items: flex-start;
    border-bottom: 1px solid #555;
    gap: 15px;
    /* Khoảng cách giữa các thành phần */
    background: #23bccd1f;
    padding: 20px;
}

.woocommerce-mini-cart-item:last-child {
    border-bottom: none;
}

/* Ảnh sản phẩm */
.woocommerce-mini-cart-item img {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid;
    margin-right: 10px;
    display: flex;
}

/* Khối thông tin: Tên và các thuộc tính */
.cart-item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.woocommerce-mini-cart-item a:not(.remove) {
    color: var(--cart-primary-color);
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
    font-family: 'Text', sans-serif;
    text-decoration: none;
    transition: color 0.2s ease;
    display: flex;
    margin: 1rem 0;
}

.woocommerce-mini-cart-item a:not(.remove):hover {
    color: var(--cart-accent-color);
}

/* Các biến thể (size, color...) */
.woocommerce-mini-cart-item .variation {
    font-size: 13px;
    color: var(--cart-secondary-color);
    margin: 0;
    font-family: Title;
    margin-bottom: 10px;
}

.woocommerce-mini-cart-item .variation dt,
.woocommerce-mini-cart-item .variation dd {
    display: inline;
    margin: 0;
}

.woocommerce-mini-cart-item .variation dd p {
    display: inline;
    margin: 0;
}

.woocommerce-mini-cart-item .variation dt {
    font-weight: bold;
}

.woocommerce-mini-cart-item .variation dd::after {
    content: '|';
    white-space: pre;
}

.woocommerce-mini-cart-item .variation dd:last-of-type::after {
    content: '';
}

/* Khối số lượng & giá, được đẩy sang phải */
.cart-item-quantity {
    text-align: right;
    font-size: 14px;
    color: var(--cart-secondary-color);
    white-space: nowrap;
}

/* Nút xóa sản phẩm */
a.remove_from_cart_button {
    width: 24px;
    height: 24px;
    border: 1px solid #333;
    border-radius: 50%;
    color: #333;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 3px;
}

a.remove_from_cart_button:hover {
    background-color: #f83535;
    border-color: #f83535;
    color: #fff !important;
    transform: scale(1.1);
}

/* --- Footer của Sidebar (Tổng tiền và nút) --- */
.mini-cart-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--cart-border-color);
    background-color: #fcfcfc;
    flex-shrink: 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

/* Tổng tiền */
.woocommerce-mini-cart__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: bold;
    color: var(--cart-primary-color);
}

/* Các nút hành động */
.woocommerce-mini-cart__buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.woocommerce-mini-cart__buttons .button {
    display: block;
    width: 100%;
    padding: 13px;
    text-align: center;
    font-size: 14px;
    border-radius: 5px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    border: 2px solid var(--cart-primary-color);
    text-decoration: none;
}

.woocommerce-mini-cart__buttons .button.wc-forward:not(.checkout) {
    background-color: var(--cart-bg-color);
    color: var(--cart-primary-color);
}

.woocommerce-mini-cart__buttons .button.wc-forward:not(.checkout):hover {
    background-color: #f5f5f5;
}

.woocommerce-mini-cart__buttons .button.checkout {
    background-color: var(--cart-primary-color);
    color: var(--cart-bg-color);
}

.woocommerce-mini-cart__buttons .button.checkout:hover {
    background-color: var(--cart-secondary-color);
    border-color: var(--cart-secondary-color);
}

.mini-cart-content .quantity {
    border: none;
    font-weight: 700;
}

.woocommerce-Price-amount.amount {
    margin-left: 5px;
}