/* Page Header Override */
section.page-header { 
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important; 
    padding: 25px 24px !important; 
    text-align: center !important;
    border-bottom: none !important;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid #e2e8f0;
}
section.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(14, 165, 233, 0.05) 0%, transparent 50%);
}
section.page-header h1 { 
    font-family: 'DM Sans', sans-serif !important; 
    font-weight: 800 !important; 
    font-size: 1.8rem !important; 
    color: #0a0c0f !important; 
    margin-bottom: 6px !important;
    position: relative;
    z-index: 1;
}
section.page-header p { 
    font-size: 1rem !important; 
    color: #64748b !important; 
    font-weight: 500 !important;
    position: relative;
    z-index: 1;
}

/* Coupons Section */
.coupons-section {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #eee;
}

.coupons-section h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.2em;
    margin-bottom: 15px;
}

.coupon-input {
    display: flex;
    margin-bottom: 15px;
}

.coupon-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    outline: none;
}

.coupon-input button {
    padding: 0 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background 0.3s;
}

.coupon-input button:hover {
    background: #45a049;
}

.available-coupons {
    margin-top: 15px;
}

.coupon-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.coupon-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.coupon-item.applied {
    border-left: 4px solid #4CAF50;
    background-color: #f8fff8;
}

.coupon-details h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 1em;
}

.coupon-details p {
    margin: 0 0 5px 0;
    color: #666;
    font-size: 0.9em;
}

.coupon-details small {
    color: #4CAF50;
    font-weight: 500;
}

.btn-apply {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 6px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

.btn-apply:hover {
    background: #45a049;
}

.coupon-item.applied .btn-apply {
    background: #f44336;
}

.coupon-item.applied .btn-apply:hover {
    background: #d32f2f;
}

.no-coupons, .loading-coupons {
    text-align: center;
    color: #666;
    padding: 15px;
    font-style: italic;
}

.error {
    color: #f44336;
    text-align: center;
    padding: 10px;
    background: #ffebee;
    border-radius: 4px;
    margin-top: 10px;
}

.empty-cart-message {
    text-align: center;
    padding: 60px 30px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08), 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    position: relative;
    overflow: hidden;
}
.empty-cart-message::before {
    content: '🛒';
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 3rem;
    opacity: 0.1;
}

.empty-cart-message h2 {
    font-size: 2rem;
    color: #0a0c0f;
    margin-bottom: 12px;
    font-weight: 800;
    position: relative;
    z-index: 1;
}

.empty-cart-message p {
    color: #64748b;
    margin-bottom: 32px;
    font-size: 1.1rem;
    position: relative;
    z-index: 1;
}

.empty-cart-message .btn-primary {
    display: inline-block;
    padding: 14px 32px;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
    position: relative;
    z-index: 1;
}

.empty-cart-message .btn-primary:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.4);
}

/* Removed overzealous sibling selector that hid local cart items permanently */

/* Cart container layout improvements */
.cart-section {
    padding: 15px 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 20vh;
    position: relative;
}
.cart-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.3), transparent);
}

.cart-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .coupon-item {
        flex-direction: column;
        text-align: center;
    }
    
    .btn-apply {
        margin-top: 10px;
        width: 100%;
    }

    /* Make the first coupon Apply button taller on mobile */
    #applyCouponBtn {
        padding: 12px 20px; /* increase vertical padding */
        font-size: 1rem;
        line-height: 1.2;
    }
}

/* Cart Item Table Styling */
.cart-items {
    flex: 2;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.06), 0 2px 12px rgba(0,0,0,0.04);
    padding: 16px;
    overflow-x: auto;
    border: 1px solid rgba(226, 232, 240, 0.6);
    transition: all 0.3s ease;
    position: relative;
}
.cart-items::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0ea5e9, #10b981);
    border-radius: 12px 12px 0 0;
}
.cart-items:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.08), 0 4px 20px rgba(0,0,0,0.06);
}

/* OVERRIDE style2.css generic styles that break table layout */
tr.cart-item {
    display: table-row !important;
    padding: 0 !important;
    border: none !important;
    background: #fff;
}

/* Override image styles from style2.css that might cause misalignment */
tr.cart-item img {
    margin: 0 auto !important; /* Override style2.css margin-right: 15px */
    max-width: 100%;
}

.cart-table {
    width: 100%;
    table-layout: fixed; /* CRITICAL for alignment */
    border-collapse: collapse;
    margin-bottom: 0;
    border-radius: 12px;
    overflow: hidden;
}

.cart-table th {
    text-align: left;
    padding: 18px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: #0a0c0f;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    vertical-align: middle;
    position: relative;
}
.cart-table th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.2), transparent);
}

/* Explicit Column Widths - Equal Distribution (16.66% each for 6 columns) */
.cart-table th, .cart-table td {
    width: 16.66%;
}

.cart-table th:nth-child(1), .cart-table td:nth-child(1) { 
    text-align: center; 
} 

.cart-table th:nth-child(2), .cart-table td:nth-child(2) { 
    text-align: left; 
} 

.cart-table th:nth-child(3), .cart-table td:nth-child(3) { 
    text-align: left;
} 

/* Brand Column */
.cart-table th:nth-child(4), .cart-table td:nth-child(4) { 
    text-align: left;
} 

/* Quantity Column */
.cart-table th:nth-child(5), .cart-table td:nth-child(5) { 
    text-align: left;
    padding-left: 8px; /* slight left nudge */
} 

/* Unit Price Column */
.cart-table th:nth-child(6), .cart-table td:nth-child(6) { 
    text-align: left; 
    padding-left: 8px; /* slight left nudge */
} 

.cart-table td {
    padding: 20px 16px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

.cart-table tr:hover td {
    background: rgba(248, 250, 252, 0.5);
}

.cart-item:last-child td {
    border-bottom: none;
}

.cart-image img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 12px;
    border: 2px solid rgba(226, 232, 240, 0.8);
    padding: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    display: block;
    margin: 0 auto;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.cart-image img:hover {
    transform: scale(1.05);
    border-color: rgba(14, 165, 233, 0.3);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.cart-details h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.4;
}

.cart-model {
    color: #666;
    font-size: 0.95rem;
    font-weight: 500;
}


.qty-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* move controls slightly to the left */
    gap: 6px; /* tighter spacing */
    margin-bottom: 10px;
}

.cart-item-qty {
    width: 55px;
    padding: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
    height: 40px;
    box-sizing: border-box;
    background: white;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #0a0c0f;
}
.cart-item-qty:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.btn-refresh {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.btn-refresh i {
    color: #fff !important;
}

.btn-refresh:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.4);
}

.remove-btn-table {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    min-width: 38px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    font-weight: 600;
}

.remove-btn-table:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.cart-price {
    font-weight: 700;
    font-size: 1.1rem;
    color: #2c3e50;
    text-align: left; /* move price to the left */
    white-space: nowrap;
    position: relative; /* for absolute remove icon */
    padding-right: 52px; /* space for the remove icon on right */
}
/* Align remove icon to the far right so all rows line up */
.cart-price .remove-btn-table {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0; /* no inline gap needed now */
}

/* Responsive: stack layout and improve table on mobile */
@media (max-width: 992px) {
  .cart-section { flex-direction: column; align-items: stretch; padding: 20px 12px; }
  .cart-container { flex-direction: column; gap: 16px; padding: 0 12px; }
  .cart-items { padding: 14px; }
  .cart-summary { position: static; top: auto; width: 100%; margin-top: 12px; }
}

@media (max-width: 480px) {
  /* Reset table into card layout */
  .cart-table thead { display: none; }
  .cart-table, .cart-table tbody, .cart-table tr, .cart-table td, .cart-table th { display: block; }
  .cart-table { width: 100%; border-collapse: separate; table-layout: fixed; }
  .cart-table tr.cart-item { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: 12px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }

  /* Top row: image left, product name right */
  .cart-item .cart-image, .cart-item .cart-details { display: inline-block; width: 50%; vertical-align: top; padding: 10px 12px; }
  .cart-item .cart-image::before, .cart-item .cart-details::before { content: none; }
  .cart-item .cart-image { text-align: center; }
  .cart-image img { max-width: 90px; width: 100%; height: auto; object-fit: contain; border-radius: 8px; background: #f8fafc; padding: 6px; }
  .cart-details h3 { margin: 0; font-size: 1rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Labels */
  .cart-table td.cart-model::before { content: "Model"; font-weight: 600; color: #475569; display: inline-block; width: auto; margin-bottom: 4px; }
  .cart-table td.cart-brand::before { content: "Brand"; font-weight: 600; color: #475569; display: inline-block; width: auto; margin-bottom: 4px; }
  .cart-table td.cart-qty-col::before { content: "Quantity"; font-weight: 600; color: #475569; display: inline; margin-right: 6px; }
  .cart-table td.cart-price::before { content: "Unit Price"; font-weight: 600; color: #475569; display: inline; margin-right: 6px; }
  .cart-table td.cart-model, .cart-table td.cart-brand, .cart-table td.cart-qty-col, .cart-table td.cart-price { padding: 10px 12px; border-top: 1px solid #eef2f7; }

  /* Model and Brand below stock badge, full width */
  .cart-table td.cart-model,
  .cart-table td.cart-brand { display: inline-block !important; width: 50% !important; vertical-align: top !important; padding: 10px 8px !important; }

  /* Quantity and Unit Price side-by-side under Model/Brand */
  .cart-table td.cart-qty-col,
  .cart-table td.cart-price { display: inline-block; width: 50%; vertical-align: top; border-top: none; padding: 10px 8px; }
  .cart-table td.cart-price { text-align: left; }
  /* Mobile: show delete inline and compact controls */
  .cart-price .remove-btn-table { position: static; transform: none; margin-left: 8px; display: inline-flex; vertical-align: middle; }
  .cart-table td.cart-qty-col .qty-wrapper { justify-content: flex-start; gap: 6px; }
  .cart-table td.cart-qty-col input[type="number"] { width: 48px; height: 32px; font-size: 0.95rem; }
  .cart-table td.cart-qty-col button { min-width: 30px; padding: 6px; }
  .qty-wrapper { gap: 6px; }
  .cart-item-qty { width: 48px; height: 34px; font-size: 0.95rem; }
  .btn-refresh { width: 34px; height: 34px; font-size: 1rem; }
  .cart-price { font-weight: 600; }
}
@media (max-width: 820px) {
  .cart-details h3 { font-size: clamp(16px, 3.6vw, 18px); }
  .cart-image img { max-width: 80px; }
  .cart-table td.cart-qty-col .qty-wrapper { gap: 8px; }
  .cart-table td.cart-qty-col .cart-item-qty { width: 56px; height: 40px; font-size: 16px; }
  .cart-table td.cart-qty-col .btn-refresh { width: 40px; height: 40px; border-radius: 8px; background: #0d6efd; color: #fff; border: none; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
  .cart-table td.cart-qty-col .btn-refresh i { color: #fff !important; }
  .remove-btn-table { background: #fff; color: #ef4444; border: 1px solid #fecaca; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
}
@media (max-width: 820px) {
  /* Card padding for cleaner look */
  tr.cart-item { padding: 12px 12px 10px; }

  /* Slightly smaller image for compact cards */
  .cart-image img { max-width: 85px; }

  /* Mobile: Model and Brand full width; Quantity and Unit Price side-by-side */
  .cart-table td.cart-model,
  .cart-table td.cart-brand { display: inline-block; width: 50%; vertical-align: top; padding: 10px 8px; }
  .cart-table td.cart-qty-col,
  .cart-table td.cart-price { display: inline-block; width: 50%; vertical-align: top; padding: 10px 8px; }
  .cart-table td.cart-qty-col::before { display: inline; margin-right: 6px; }
  .cart-table td.cart-price::before { display: inline; margin-right: 6px; }
  .cart-table td.cart-price { text-align: left; }

  /* Label + value clarity */
  .cart-table td.cart-model::before,
  .cart-table td.cart-brand::before,
  .cart-table td.cart-qty-col::before,
  .cart-table td.cart-price::before { color: #6b7280; font-weight: 600; font-size: 0.82rem; }
  .cart-table td.cart-model,
  .cart-table td.cart-brand,
  .cart-table td.cart-price { font-size: 0.95rem; color: #111827; }

  /* Quantity controls alignment */
  .cart-table td.cart-qty-col .qty-wrapper { align-items: center; gap: 6px; }
  .cart-table td.cart-qty-col input[type="number"] { width: 54px; height: 34px; }
  .cart-table td.cart-qty-col button { min-width: 32px; height: 34px; }

  /* Space between top row and detail grid */
  .cart-item .cart-details { padding-bottom: 6px; }
}
.cart-summary {
    flex: 1;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.06), 0 2px 12px rgba(0,0,0,0.04);
    padding: 24px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    position: sticky;
    top: 20px;
    transition: all 0.3s ease;
}
.cart-summary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.08), 0 4px 20px rgba(0,0,0,0.06);
}

.cart-summary h2 {
    font-size: 1.25rem;
    margin: 0 0 16px 0;
    background: linear-gradient(135deg, #0ea5e9, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1rem;
}

.summary-row.total {
    font-weight: 700;
    border-top: 1px solid #ddd;
    padding-top: 12px;
}

.note {
    color: #666;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 8px;
}

.stock-badge {
    display: inline-block;
    font-size: 0.78rem;
    padding: 4px 8px;
    border-radius: 999px;
    margin-top: 8px;
    margin-bottom: 6px;
}

.stock-badge.in {
    background: #e9f7ef;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.stock-badge.out {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}


