/* --- Kiểu dáng cho nút giỏ hàng --- */
.cart-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem; /* Kích thước icon */
    color: #333; /* Màu icon */
    position: relative;
    padding: 0;
}

.cart-item-count {
    position: absolute;
    top: -8px;
    right: -10px;
    background-color: red;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* --- Kiểu dáng cho lớp phủ (overlay) --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Khi giỏ hàng mở, hiện lớp phủ */
body.cart-open .overlay {
    opacity: 1;
    visibility: visible;
}


/* --- Kiểu dáng cho sidebar giỏ hàng --- */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px; /* Chiều rộng tối đa */
    height: 100%;
    background-color: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 999;
    display: flex;
    flex-direction: column;
    
    /* Mặc định ẩn bên ngoài màn hình */
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
}

/* Khi giỏ hàng mở, trượt nó vào trong */
body.cart-open .cart-sidebar {
    transform: translateX(0);
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.cart-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.cart-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #888;
}

.cart-body {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto; /* Thêm thanh cuộn nếu nhiều sản phẩm */
}

.cart-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.item-details {
    flex-grow: 1;
}

.item-details p {
    margin: 0 0 0.5rem 0;
}

.item-name {
    font-weight: bold;
}

.item-price {
    color: #555;
}

.item-quantity input {
    width: 50px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.25rem;
}

.item-remove-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    transition: color 0.2s;
}

.item-remove-btn:hover {
    color: red;
}

.cart-empty-message {
    text-align: center;
    color: #777;
    margin-top: 2rem;
}

.cart-footer {
    padding: 1.5rem;
    border-top: 1px solid #eee;
    background-color: #f9f9f9;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.checkout-btn {
    width: 100%;
    padding: 0.8rem;
    background-color: #333;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    text-transform: uppercase;
    transition: background-color 0.2s;
}

.checkout-btn:hover {
    background-color: #000;
}