/** Quick View Modal – always on viewport (loaded globally when cart active) **/
#quick-view-modal.qv-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#quick-view-modal.qv-modal.active {
    display: flex !important;
    opacity: 1;
    pointer-events: auto;
}

#quick-view-modal .qv-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

#quick-view-modal .qv-modal-content {
    position: relative;
    background: #fff;
    width: 95%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 12px;
    overflow-y: auto;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

#quick-view-modal.qv-modal.active .qv-modal-content {
    transform: translateY(0);
}

#quick-view-modal .qv-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    border: none;
    background: #f5f5f5;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

#quick-view-modal .qv-modal-close:hover {
    background: #eee;
    color: #ff6600;
}

/* 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;
}

/* Web Component wrapper fix */
cnt-cart-sidebar {
    display: contents;
}

/* 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;
}
/* Cart Empty State */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #888;
    font-size: 16px;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 20px 0;
}
.cart-empty .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
/* 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;
}

.out-of-stock-item {
    opacity: 0.6;
    background-color: #f9f9f9;
}

.out-of-stock-item .quantity-controls,
.out-of-stock-item .item-image,
.out-of-stock-item .item-details {
    pointer-events: none;
}

.out-of-stock-item .remove-item {
    pointer-events: auto;
    opacity: 1;
    cursor: pointer;
}

.stock-warning {
    font-size: 12px;
    color: red;
    margin-top: 4px;
    font-weight: bold;
}

@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 a {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 0px;
    line-height: 1.3;
    text-decoration: none;
}

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

.item-sale-price {
    font-size: 15px;
    font-weight: 550;
    color: #ff6b35;
}

.item-price {
    font-size: 14px;
    font-weight: 400;
    color: #666;
    text-decoration: line-through;
}

.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-btn:disabled {
    cursor: not-allowed;
    color: #ccc;
}

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

.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input[type=number] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.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;
    }
}
