/* Overlay tối */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sidebar giỏ hàng */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    z-index: 999;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.active {
    right: 0;
}

/* Header giỏ hàng */
.cart-header {
    padding: 25px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.cart-title {
    font-size: 22px;
    font-weight: 700;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

/* Thông báo khuyến mãi */
.promo-banner {
    margin: 25px;
    padding: 12px 20px;
    background: #fff0d9;
    border: 1px solid #ffcc80;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    color: #e07b00;
    position: relative;
    overflow: hidden;
    font-size: 14px;
}

/* New style for promo achieved */
.promo-banner.promo-achieved {
    background: #e6ffed;
    border-color: #69f0ae;
    color: #00c853;
}


.promo-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

.progress-bar {
    margin-top: 10px;
    height: 6px;
    background: #ffe0b2;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #ff6b35;
    border-radius: 3px;
    width: 30%;
    transition: width 0.3s ease;
}

.promo-banner.promo-achieved .progress-fill {
    background: #00c853;
}

/* Danh sách sản phẩm */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 0 25px;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.cart-items::-webkit-scrollbar {
    width: 6px;
}

.cart-items::-webkit-scrollbar-track {
    background: transparent;
}

.cart-items::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.item-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    margin-right: 12px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
    overflow: hidden;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.item-details {
    flex: 1;
    margin-right: 15px;
}

.item-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
    line-height: 1.3;
}

.item-name:hover{
    color: #e07b00;
}

.item-price {
    font-size: 16px;
    font-weight: 600;
    color: #ff6b35;
}

.item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: white;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: #f0f0f0;
    color: #ff6b35;
}

.qty-input {
    width: 35px;
    height: 28px;
    text-align: center;
    border: none;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    background: transparent;
    flex-shrink: 0;
}

.remove-item {
    background: none;
    border: none;
    color: #ccc;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.remove-item:hover {
    background: #ffebee;
    color: #f44336;
}

.empty-cart {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-cart-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-cart-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.empty-cart-subtext {
    font-size: 14px;
    opacity: 0.7;
}

/* Footer giỏ hàng */
.cart-footer {
    padding: 25px;
    border-top: 1px solid #f0f0f0;
    background: white;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}

.cart-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 5px;
    color: #666;
    font-size: 13px;
}

.action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 8px;
    border-radius: 8px;
}

.action-item:hover {
    color: #ff6b35;
    background: #fff5f2;
}

.action-icon {
    font-size: 16px;
}

.total-section {
    background: #f8f9fa;
    padding: 13px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.total-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-grow: 1;
}

.total-label {
    font-size: 14px;
    font-weight: 700;
    color: #333;
}

.total-amount {
    font-size: 14px;
    font-weight: 800;
    color: #ff6b35;
}

.discount-note {
    font-size: 12px;
    color: #666;
    font-style: italic;
    text-align: right;
    width: 100%;
    margin-top: 5px;
}

.checkout-btn {
    width: 100%;
    background: linear-gradient(135deg, #ff6b35, #ff8a50);
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.checkout-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.checkout-btn:hover::before {
    left: 100%;
}

.checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.checkout-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Responsive */
@media (max-width: 480px) {
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }

    .cart-header {
        padding: 20px;
    }

    .promo-banner {
        margin: 20px;
        padding: 15px;
    }

    .cart-items {
        padding: 0 20px;
    }

    .cart-footer {
        padding: 20px;
    }
}
