/* --- BIẾN MÀU SẮC (APPLE PALETTE) --- */
:root {
    --apple-bg: #ffffff;
    --apple-gray-bg: #F5F5F7;
    --apple-text: #1d1d1f;
    --apple-green: #388d45;
    --apple-green-hover: #2e7539;
    --apple-radius: 16px;
    --apple-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

/* --- 1. CẤU TRÚC SIDEBAR (GLASSMORPHISM) --- */
.sidebar-cart {
    position: fixed; top: 0; right: -450px; width: 420px; height: 100vh;
    background: rgba(255, 255, 255, 0.95); /* Nền trắng trong suốt */
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); /* Kính mờ */
    z-index: 999999;
    transition: right 0.5s cubic-bezier(0.16, 1, 0.3, 1); /* Hiệu ứng trượt mượt kiểu iOS */
    box-shadow: -10px 0 40px rgba(0,0,0,0.1);
    display: flex; flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--apple-text);
}
.sidebar-cart.active { right: 0; }

#sidebar-cart-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); z-index: 999998; display: none; 
    backdrop-filter: blur(4px); /* Làm mờ nền web phía sau */
    transition: opacity 0.3s;
}
#sidebar-cart-overlay.active { display: block; }

/* --- 2. HEADER (CLEAN) --- */
.sidebar-cart-header {
    padding: 25px 30px; background: transparent; 
    display: flex; justify-content: space-between; align-items: center;
}
.sidebar-cart-header h3 { 
    margin: 0; font-size: 24px; font-weight: 700; 
    text-transform: none; /* Bỏ viết hoa toàn bộ */
    letter-spacing: -0.5px;
}
.close-sidebar-cart { 
    cursor: pointer; width: 32px; height: 32px; border-radius: 50%; 
    background: #f0f0f0; display: flex; align-items: center; justify-content: center;
    color: #555; transition: all 0.2s; font-size: 16px;
}
.close-sidebar-cart:hover { background: #e5e5e5; transform: scale(1.1); color: #000; }

/* --- 3. THANH FREESHIP (PILL SHAPE) --- */
.fs-component {
    margin: 0 20px 10px; padding: 15px; 
    background: var(--apple-gray-bg); border-radius: var(--apple-radius); 
    border: none; /* Bỏ viền nét đứt cũ */
}
.fs-text { font-size: 13px; margin-bottom: 8px; color: #666; font-weight: 500; }
.fs-text span { color: var(--apple-green); font-weight: 700; }

.fs-progress { 
    height: 8px; width: 100%; background: #e0e0e0; 
    border-radius: 10px; overflow: hidden; 
}
.fs-progress-bar {
    height: 100%; border-radius: 10px;
    background: var(--apple-green); /* Xanh lá phẳng */
    transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 0 10px rgba(56, 141, 69, 0.3); /* Glow nhẹ */
}
.fs-component.success { background: #eafbe7; } /* Xanh nhạt khi thành công */

/* --- 4. BODY LIST (MINIMAL) --- */
.sidebar-cart-body { 
    flex: 1; overflow-y: auto; padding: 10px 20px; 
    scrollbar-width: none; /* Ẩn thanh cuộn */
}
.sidebar-cart-body::-webkit-scrollbar { display: none; }

.sidebar-item { 
    display: flex; margin-bottom: 20px; padding-bottom: 20px; 
    border-bottom: 1px solid #f0f0f0; /* Viền mờ hơn */
    align-items: center;
}
.sidebar-item img { 
    width: 80px; height: 80px; object-fit: contain; 
    background: #fff; border: 1px solid #f5f5f5; 
    border-radius: 12px; /* Bo góc ảnh */
    margin-right: 15px; 
}
.sidebar-item-info { flex: 1; }
.sidebar-item-title a { 
    font-weight: 600; color: #1d1d1f; font-size: 14px; 
    line-height: 1.4; margin-bottom: 6px; 
}
.sidebar-item-variant { 
    font-size: 11px; color: #666; background: #f5f5f7; 
    padding: 3px 8px; border-radius: 6px; margin-bottom: 6px; 
}
.sidebar-item-price { 
    color: var(--apple-text); font-weight: 700; font-size: 15px; 
}
.sidebar-item-qty { 
    font-size: 12px; color: #86868b; float: right; 
    background: #f5f5f7; padding: 4px 10px; border-radius: 12px; font-weight: 600;
}

/* --- 5. QUÀ TẶNG (SOFT UI) --- */
.cart-gift-box {
    margin: 0 20px 10px; padding: 12px; 
    background: #fff8e1; border: 1px solid #ffe082; /* Màu vàng nhạt */
    border-radius: 12px; display: flex; align-items: center; 
}
.gift-icon { font-size: 16px; margin-right: 10px; color: #f57f17; }
.gift-text { font-size: 13px; color: #f57f17; font-weight: 600; }

/* --- 6. FOOTER (MODERN BUTTONS) --- */
.sidebar-cart-footer { 
    padding: 25px; background: #fff; 
    border-top: 1px solid #f0f0f0;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.03); 
}
.total-price { 
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; font-size: 18px; font-weight: 700; 
}
.total-price span:first-child { color: #86868b; font-size: 15px; font-weight: 500; }
.total-price span:last-child { color: var(--apple-green); font-size: 20px; }

.cart-actions { display: flex; gap: 12px; }
.cart-btn {
    flex: 1; padding: 0; height: 50px; 
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px; /* Bo góc nút */
    font-weight: 600; text-transform: none; /* Chữ thường */
    font-size: 15px; cursor: pointer; transition: all 0.2s ease;
}

/* Nút Xem giỏ: Trắng viền Xám */
.btn-view-cart { 
    background: #fff; color: #1d1d1f; border: 1px solid #d2d2d7; 
}
.btn-view-cart:hover { background: #f5f5f7; border-color: #b0b0b5; }

/* Nút Thanh toán: Xanh Apple */
.btn-checkout { 
    background: var(--apple-green); color: #fff; border: none; 
    box-shadow: 0 4px 12px rgba(56, 141, 69, 0.3);
}
.btn-checkout:hover { 
    background: var(--apple-green-hover); 
    transform: translateY(-2px); 
    box-shadow: 0 6px 16px rgba(56, 141, 69, 0.4);
}

/* Mobile */
@media (max-width: 480px) { 
    .sidebar-cart { width: 100%; right: -100%; border-radius: 0; } 
    .sidebar-cart-header h3 { font-size: 20px; }
}