/* ===== MODERN CART DESIGN - COMPLETE REDESIGN ===== */

/* Reset và Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    background: #f8fafc !important;
    color: #1e293b !important;
    line-height: 1.6 !important;
}

.container {
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 20px !important;
}

/* Header Cart */
.header-cart {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 30px 0 !important;
    margin-bottom: 30px !important;
    border-radius: 16px !important;
    text-align: center !important;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3) !important;
}

.header-cart h1 {
    font-size: 2.5rem !important;
    font-weight: 700 !important;
    margin: 0 !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* Cart Content Container */
#cart-content-container {
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08) !important;
    overflow: hidden !important;
    margin-bottom: 30px !important;
}

/* Cart Header - Column Titles */
.cart-header {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%) !important;
    padding: 20px 25px !important;
    border-bottom: 2px solid #e2e8f0 !important;
    display: flex !important;
    align-items: center !important;
    font-weight: 600 !important;
    color: #000000 !important; /* Changed to black */
    font-size: 14px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-radius: 0 !important;
    margin-bottom: 0 !important;
    gap: 0 !important;
}

.header-checkbox {
    width: 80px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.header-checkbox input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    cursor: pointer !important;
    accent-color: #3b82f6 !important;
    transform: scale(1.2) !important;
    margin: 0 !important;
}

.header-checkbox label {
    margin-left: 8px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    color: #000000 !important; /* Changed to black */
    white-space: nowrap !important;
}

.header-product {
    flex: 2.5 !important;
    padding-left: 20px !important;
    text-align: left !important;
    justify-content: flex-start !important;
    display: flex !important;
    align-items: center !important;
}

.header-price {
    width: 120px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.header-quantity {
    width: 140px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.header-total {
    width: 120px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.header-actions {
    width: 80px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Shop Section */
.shop-section {
    border-bottom: 1px solid #f1f5f9 !important;
    background: white !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin-bottom: 0 !important;
    overflow: visible !important;
    border: none !important;
}

.shop-header {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
    padding: 16px 25px !important;
    border-bottom: 1px solid #f59e0b !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.shop-checkbox-container {
    display: flex !important;
    align-items: center !important;
}

.shop-checkbox-container input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    cursor: pointer !important;
    accent-color: #f59e0b !important;
    transform: scale(1.1) !important;
    margin: 0 !important;
}

.shop-name {
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #92400e !important;
    display: flex !important;
    align-items: center !important;
}

.shop-name i {
    color: #f59e0b !important;
    font-size: 18px !important;
    margin-right: 8px !important;
}

/* Cart Items */
.cart-items {
    background: white !important;
    padding: 0 !important;
}

.cart-item {
    display: flex !important;
    align-items: center !important;
    padding: 20px 25px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    background: white !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    gap: 0 !important;
}

.cart-item:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    transform: translateX(4px) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05) !important;
}

.cart-item:last-child {
    border-bottom: none !important;
}

/* Checkbox Column */
.item-checkbox-wrapper {
    width: 80px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
}

.item-checkbox {
    width: 20px !important;
    height: 20px !important;
    cursor: pointer !important;
    accent-color: #3b82f6 !important;
    transform: scale(1.2) !important;
    margin: 0 !important;
    position: relative !important;
    z-index: 10 !important;
    opacity: 1 !important;
}

/* Product Column */
.item-product-wrapper {
    flex: 2.5 !important;
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    padding-left: 20px !important;
    min-width: 0 !important;
}

.item-image {
    width: 80px !important;
    height: 80px !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    border: 2px solid #e2e8f0 !important;
    flex-shrink: 0 !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    background: white !important;
}

.item-image:hover {
    border-color: #3b82f6 !important;
    transform: scale(1.05) !important;
}

.item-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    position: relative !important;
    z-index: 2 !important;
    background: white !important;
}

/* Hide no-image placeholder when real image is present */
.item-image:has(img[src]:not([src=""])) .no-image-placeholder {
    display: none !important;
}

.no-image-placeholder {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
    color: #94a3b8 !important;
    font-size: 10px !important;
    text-align: center !important;
    font-weight: 500 !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1 !important;
}

.no-image-placeholder i {
    font-size: 24px !important;
    margin-bottom: 4px !important;
    color: #cbd5e1 !important;
}

.item-details {
    flex: 1 !important;
    min-width: 0 !important;
}

.item-name {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    margin: 0 0 4px 0 !important;
    line-height: 1.4 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
}

/* Price Column */
.item-price-wrapper {
    width: 120px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    flex: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.item-price {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px !important;
}

.current-price {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #dc2626 !important;
}

.original-price {
    font-size: 14px !important;
    color: #94a3b8 !important;
    text-decoration: line-through !important;
}

/* Quantity Column */
.item-quantity-wrapper {
    width: 140px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    flex: none !important;
}

.item-quantity {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: #f8fafc !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 4px !important;
}

.quantity-btn {
    width: 36px !important;
    height: 36px !important;
    border: none !important;
    background: white !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 600 !important;
    font-size: 18px !important;
    color: #64748b !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
}

.quantity-btn:hover:not(:disabled) {
    background: #3b82f6 !important;
    color: white !important;
    transform: scale(1.1) !important;
}

.quantity-btn:disabled {
    background: #f1f5f9 !important;
    color: #cbd5e1 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.quantity-input {
    width: 50px !important;
    height: 36px !important;
    text-align: center !important;
    border: none !important;
    background: white !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 16px !important;
    color: #1e293b !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
}

.quantity-input:focus {
    outline: 2px solid #3b82f6 !important;
    outline-offset: 2px !important;
}

/* Total Column */
.item-total-wrapper {
    width: 120px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    flex: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.item-total {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #059669 !important;
}

/* Actions Column */
.item-actions-wrapper {
    width: 80px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    flex: none !important;
}

.remove-btn {
    width: 40px !important;
    height: 40px !important;
    background: #fee2e2 !important;
    border: none !important;
    color: #dc2626 !important;
    cursor: pointer !important;
    border-radius: 10px !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
}

.remove-btn:hover {
    background: #fecaca !important;
    transform: scale(1.1) rotate(5deg) !important;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3) !important;
}

/* Cart Summary Section */
#cart-summary-section {
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08) !important;
    overflow: hidden !important;
}

.voucher-section {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
    padding: 20px 25px !important;
    border-bottom: 1px solid #f59e0b !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.voucher-left {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.global-voucher-checkbox {
    width: 18px !important;
    height: 18px !important;
    cursor: pointer !important;
    accent-color: #f59e0b !important;
    transform: scale(1.1) !important;
}

.voucher-right {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
}

.voucher-select {
    padding: 8px 12px !important;
    border: 2px solid #f59e0b !important;
    border-radius: 8px !important;
    background: white !important;
    font-size: 14px !important;
    min-width: 200px !important;
}

.voucher-discount {
    font-weight: 600 !important;
    color: #92400e !important;
}

/* Bottom Summary */
.voucher {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
    padding: 25px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    color: white !important;
}

.left-section {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.left-section .select-all-main {
    width: 18px !important;
    height: 18px !important;
    cursor: pointer !important;
    accent-color: #3b82f6 !important;
    transform: scale(1.1) !important;
}

.left-section span {
    font-size: 16px !important;
    font-weight: 500 !important;
}

.left-section a {
    color: #f87171 !important;
    text-decoration: none !important;
    font-weight: 600 !important;
}

.left-section a:hover {
    color: #fca5a5 !important;
    text-decoration: underline !important;
}

.total {
    text-align: right !important;
}

.total h3 {
    font-size: 18px !important;
    margin: 0 0 8px 0 !important;
    color: #e2e8f0 !important;
}

.total p {
    margin: 4px 0 !important;
    font-size: 14px !important;
    color: #cbd5e1 !important;
}

.final-total {
    font-size: 24px !important;
    font-weight: 700 !important;
    margin: 12px 0 !important;
    color: #10b981 !important;
}

.checkout-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: white !important;
    border: none !important;
    padding: 16px 32px !important;
    border-radius: 12px !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3) !important;
}

.checkout-btn:hover:not(:disabled) {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4) !important;
}

.checkout-btn:disabled {
    background: #9ca3af !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Empty Cart State */
.empty-cart {
    text-align: center !important;
    padding: 80px 20px !important;
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08) !important;
}

.empty-cart-content {
    max-width: 400px !important;
    margin: 0 auto !important;
}

.empty-cart-icon {
    font-size: 4rem !important;
    color: #cbd5e1 !important;
    margin-bottom: 20px !important;
}

.empty-cart h3 {
    font-size: 1.5rem !important;
    color: #64748b !important;
    margin-bottom: 12px !important;
}

.empty-cart p {
    color: #94a3b8 !important;
    margin-bottom: 30px !important;
    line-height: 1.6 !important;
}

.empty-cart .btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    color: white !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.empty-cart .btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3) !important;
}

/* Loading State */
#cart-loading {
    text-align: center !important;
    padding: 60px 20px !important;
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08) !important;
}

#cart-loading i {
    font-size: 2rem !important;
    color: #3b82f6 !important;
    animation: spin 1s linear infinite !important;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#cart-loading p {
    margin-top: 15px !important;
    color: #64748b !important;
    font-size: 16px !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px !important;
    }

    .header-cart h1 {
        font-size: 2rem !important;
    }

    .cart-header {
        display: none !important;
    }

    .cart-item {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px !important;
        padding: 20px 15px !important;
    }

    .item-checkbox-wrapper,
    .item-product-wrapper,
    .item-price-wrapper,
    .item-quantity-wrapper,
    .item-total-wrapper,
    .item-actions-wrapper {
        width: 100% !important;
        flex: none !important;
    }

    .item-product-wrapper {
        order: 1 !important;
    }

    .item-checkbox-wrapper {
        order: 0 !important;
        justify-content: flex-start !important;
    }

    .item-price-wrapper,
    .item-quantity-wrapper,
    .item-total-wrapper {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .item-price-wrapper::before {
        content: "Đơn giá:" !important;
        font-weight: 600 !important;
        color: #64748b !important;
    }

    .item-quantity-wrapper::before {
        content: "Số lượng:" !important;
        font-weight: 600 !important;
        color: #64748b !important;
    }

    .item-total-wrapper::before {
        content: "Thành tiền:" !important;
        font-weight: 600 !important;
        color: #64748b !important;
    }

    .voucher {
        flex-direction: column !important;
        gap: 20px !important;
        text-align: center !important;
    }

    .checkout-btn {
        width: 100% !important;
    }
}

/* ===== FIX FOR IMAGE AND NO-IMAGE PLACEHOLDER ISSUES ===== */

/* Ensure real product images completely hide the no-image placeholder */
.item-image {
    position: relative !important;
    overflow: hidden !important;
}

/* Style for when there's a real image */
.item-image img[src]:not([src=""]):not([src*="no-image"]):not([src*="placeholder"]) {
    position: relative !important;
    z-index: 10 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    background: white !important;
    display: block !important;
}

/* Hide no-image placeholder when real image exists */
.item-image:has(img[src]:not([src=""]):not([src*="no-image"]):not([src*="placeholder"])) .no-image-placeholder {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Alternative approach for browsers that don't support :has() */
.item-image img[src]:not([src=""]):not([src*="no-image"]):not([src*="placeholder"]) + .no-image-placeholder,
.item-image img[src]:not([src=""]):not([src*="no-image"]):not([src*="placeholder"]) ~ .no-image-placeholder {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Ensure no-image placeholder is behind real images */
.no-image-placeholder {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1 !important;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    color: #94a3b8 !important;
    font-size: 10px !important;
    text-align: center !important;
    font-weight: 500 !important;
}

/* Force hide any text or elements that might show "NO IMAGE" */
.item-image *[class*="no-image"],
.item-image *[class*="NO-IMAGE"],
.item-image *[class*="placeholder"]:not(.no-image-placeholder) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* ===== ADDITIONAL COLUMN ALIGNMENT FIXES ===== */

/* Force exact alignment between header and items */
.cart-header,
.cart-item {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Ensure all columns have exact same widths */
.cart-header .header-checkbox,
.cart-item .item-checkbox-wrapper {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    flex: 0 0 80px !important;
}

.cart-header .header-product,
.cart-item .item-product-wrapper {
    flex: 2.5 !important;
    min-width: 280px !important;
}

.cart-header .header-price,
.cart-item .item-price-wrapper {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    flex: 0 0 120px !important;
}

.cart-header .header-quantity,
.cart-item .item-quantity-wrapper {
    width: 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
    flex: 0 0 140px !important;
}

.cart-header .header-total,
.cart-item .item-total-wrapper {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    flex: 0 0 120px !important;
}

.cart-header .header-actions,
.cart-item .item-actions-wrapper {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    flex: 0 0 80px !important;
}

/* Ensure all columns are properly centered */
.cart-header > div,
.cart-item > div {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}

/* Exception for product column - left align */
.cart-header .header-product,
.cart-item .item-product-wrapper {
    justify-content: flex-start !important;
    text-align: left !important;
}

/* ===== RESPONSIVE FIXES ===== */
@media (max-width: 768px) {
    /* On mobile, ensure proper stacking */
    .cart-item {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .cart-item > div {
        width: 100% !important;
        flex: none !important;
        min-width: auto !important;
        max-width: none !important;
    }
}