/* cart.css */
body {
    margin: 0;
    background: #f8fafc;
    overflow-x: hidden;
}

.cart-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 20px 20px 20px calc(var(--sidebar-width) + 20px);
    background: #f8fafc;
}

/* Header */
.cart-header {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    transition: all 0.3s;
    background: white;
    font-size: 14px;
}

.back-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateX(-5px);
}

.cart-header h1 {
    color: #2d3748;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.cart-header h1 i {
    color: #667eea;
    font-size: 1.5rem;
}

.cart-stats {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.cart-stats span {
    font-weight: 600;
    font-size: 14px;
}

.cart-total {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Cart Content */
.cart-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 992px) {
    .cart-container {
        padding-left: 15px;
        padding-right: 15px;
        padding-bottom: calc(var(--bottom-nav-height) + 16px);
    }
    
    .cart-content {
        grid-template-columns: 1fr;
    }
    
    .cart-header {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
}

/* Cart Items List - Compact Layout */
.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-item {
    background: white;
    border-radius: 12px;
    padding: 15px;
    display: grid;
    grid-template-columns: 60px 1fr 140px;
    gap: 15px;
    align-items: center;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
    transition: all 0.3s;
    border: 1px solid #e2e8f0;
    min-height: 80px;
}

.cart-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.default-item-img {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

/* Item Info - Compact */
.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0; /* Prevents overflow */
}

.item-name-price {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-name {
    color: #2d3748;
    font-size: 14px;
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-price-display {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.unit-price {
    color: #667eea;
    font-weight: 600;
    font-size: 12px;
}

.item-subtotal {
    color: #48bb78;
    font-weight: 600;
    font-size: 14px;
}

.item-unit-compact {
    color: #718096;
    font-size: 12px;
    margin: 0;
}

/* Controls - Compact */
.cart-item-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.order-notes-card {
    grid-template-columns: 60px 1fr;
}

.order-notes-card .cart-item-controls {
    display: none;
}

.order-notes-icon {
    background: #edf2f7;
    color: #667eea;
    font-size: 22px;
}

.order-notes-input {
    width: 100%;
    min-height: 60px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    resize: none;
    outline: none;
    background: #fff;
}

.order-notes-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.remove-item-btn-compact {
    background: none;
    border: none;
    color: #f56565;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-left: auto;
}

.remove-item-btn-compact:hover {
    background: #fed7d7;
    transform: scale(1.1);
}

.quantity-controls-compact {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 2px;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: white;
    color: #667eea;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s;
}

.quantity-btn:hover {
    background: #667eea;
    color: white;
}

.quantity-input-compact {
    width: 40px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    padding: 4px;
}

.quantity-input-compact:focus {
    outline: none;
}

.quantity-label {
    color: #718096;
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}

/* Order Summary - Simplified */
.order-summary {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.summary-header {
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 12px;
    margin-bottom: 15px;
}

.summary-header h3 {
    color: #2d3748;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
}

.summary-content {
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f1f1;
}

.summary-row.subtotal {
    font-size: 14px;
    color: #4a5568;
}

.summary-row.total {
    border-top: 2px solid #e2e8f0;
    margin-top: 10px;
    padding-top: 15px;
    border-bottom: none;
}

.summary-row.total span:first-child {
    color: #2d3748;
    font-size: 1rem;
}

.summary-row.total span:last-child {
    color: #48bb78;
    font-size: 1.2rem;
    font-weight: 700;
}

.checkout-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.checkout-btn, .clear-cart-btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.checkout-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.checkout-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.clear-cart-btn {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #fc8181;
}

.clear-cart-btn:hover {
    background: #feb2b2;
    transform: translateY(-1px);
}

.secure-checkout {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    color: #718096;
    font-size: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.secure-checkout i {
    color: #48bb78;
    font-size: 16px;
}

/* Empty Cart State */
.empty-cart {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    max-width: 500px;
    margin: 0 auto;
}

.empty-cart-icon {
    font-size: 80px;
    color: #cbd5e0;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.empty-cart h2 {
    color: #4a5568;
    margin-bottom: 12px;
    font-size: 1.6rem;
}

.empty-cart p {
    color: #718096;
    margin-bottom: 25px;
    font-size: 1rem;
    max-width: 350px;
    margin-left: auto;
    margin-right: auto;
}

.continue-shopping-btn-large {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s;
}

.continue-shopping-btn-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .cart-container {
        padding: 15px;
    }
    
    .cart-header h1 {
        font-size: 1.3rem;
    }
    
    .cart-stats {
        width: 100%;
        justify-content: center;
    }
    
    
    
    .cart-item-controls {
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .cart-header {
        padding: 12px;
    }
    
    .cart-header h1 {
        font-size: 1.2rem;
    }
    
    .checkout-btn, .clear-cart-btn {
        padding: 10px;
        font-size: 13px;
    }
    
    
    
    .cart-item-image {
        width: 50px;
        height: 50px;
        margin: 0 auto;
    }
    
    .cart-item-controls {
        align-items: center;
        margin-top: 10px;
    }
    
    .quantity-controls-compact {
        order: 1;
    }
    
    .remove-item-btn-compact {
        order: 2;
        margin-left: 0;
    }
    
    .quantity-label {
        order: 3;
        width: 100%;
        text-align: center;
    }
}

/* Loader animation for geolocation */
.bx-spin {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

html[data-theme='dark'] .cart-container {
    background: #0b1220;
}

html[data-theme='dark'] body {
    background: #0b1220;
}

html[data-theme='dark'] .cart-header,
html[data-theme='dark'] .cart-item,
html[data-theme='dark'] .order-summary,
html[data-theme='dark'] .empty-cart,
html[data-theme='dark'] .quantity-controls-compact,
html[data-theme='dark'] .order-notes-card,
html[data-theme='dark'] .cart-item-image {
    background: #111827;
    border-color: #334155;
    box-shadow: 0 12px 30px rgba(2, 6, 23, 0.44);
}

html[data-theme='dark'] .cart-header h1,
html[data-theme='dark'] .item-name,
html[data-theme='dark'] .summary-header h3,
html[data-theme='dark'] .summary-row.total span:first-child,
html[data-theme='dark'] .empty-cart h2,
html[data-theme='dark'] .quantity-input-compact {
    color: #f8fafc;
}

html[data-theme='dark'] .item-unit-compact,
html[data-theme='dark'] .quantity-label,
html[data-theme='dark'] .summary-row.subtotal,
html[data-theme='dark'] .secure-checkout,
html[data-theme='dark'] .empty-cart p {
    color: #94a3b8;
}

html[data-theme='dark'] .back-btn {
    background: #0f172a;
    color: #bfdbfe;
    border-color: #334155;
}

html[data-theme='dark'] .back-btn:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

html[data-theme='dark'] .cart-stats {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    box-shadow: 0 4px 14px rgba(30, 64, 175, 0.38);
}

html[data-theme='dark'] .cart-item:hover {
    border-color: #60a5fa;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

html[data-theme='dark'] .default-item-img {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
}

html[data-theme='dark'] .unit-price,
html[data-theme='dark'] .order-notes-icon {
    color: #93c5fd;
}

html[data-theme='dark'] .item-subtotal,
html[data-theme='dark'] .summary-row.total span:last-child,
html[data-theme='dark'] .secure-checkout i {
    color: #86efac;
}

html[data-theme='dark'] .order-notes-icon {
    background: #1e293b;
}

html[data-theme='dark'] .order-notes-input {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

html[data-theme='dark'] .order-notes-input::placeholder {
    color: #64748b;
}

html[data-theme='dark'] .order-notes-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.24);
}

html[data-theme='dark'] .remove-item-btn-compact:hover {
    background: rgba(127, 29, 29, 0.4);
    color: #fca5a5;
}

html[data-theme='dark'] .quantity-btn {
    background: #0f172a;
    color: #93c5fd;
}

html[data-theme='dark'] .quantity-btn:hover {
    background: #2563eb;
    color: #ffffff;
}

html[data-theme='dark'] .summary-header,
html[data-theme='dark'] .secure-checkout,
html[data-theme='dark'] .summary-row.total {
    border-color: #334155;
}

html[data-theme='dark'] .summary-row {
    border-bottom-color: #1f2937;
}

html[data-theme='dark'] .clear-cart-btn {
    background: rgba(127, 29, 29, 0.34);
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.42);
}

html[data-theme='dark'] .clear-cart-btn:hover {
    background: rgba(127, 29, 29, 0.46);
}

html[data-theme='dark'] .checkout-btn,
html[data-theme='dark'] .continue-shopping-btn-large {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

html[data-theme='dark'] .checkout-btn:hover,
html[data-theme='dark'] .continue-shopping-btn-large:hover {
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.36);
}

html[data-theme='dark'] .empty-cart-icon {
    color: #64748b;
}