/* Page Header Override */
section.page-header { 
    background: linear-gradient(135deg, #ffffff 0%, #fff8f0 100%) !important; 
    padding: 25px 24px !important; 
    text-align: center !important;
    border-bottom: none !important;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid #ffe0b2;
}
section.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(255, 140, 0, 0.08) 0%, transparent 50%);
}
section.page-header h1 { 
    font-family: 'DM Sans', sans-serif !important; 
    font-weight: 800 !important; 
    font-size: 1.8rem !important; 
    color: #1a1a1a !important; 
    margin-bottom: 6px !important;
    position: relative;
    z-index: 1;
}
section.page-header p { 
    font-size: 1rem !important; 
    color: #8d6e63 !important; 
    font-weight: 500 !important;
    position: relative;
    z-index: 1;
}

/* Coupons Section */
.coupons-section {
    margin-top: 30px;
    padding: 20px;
    background: #fff8f0;
    border-radius: 8px;
    border: 1px solid #ffe0b2;
}

.coupons-section h3 {
    margin-top: 0;
    color: #1a1a1a;
    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 #ffe0b2;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    outline: none;
}

.coupon-input button {
    padding: 0 20px;
    background: linear-gradient(135deg, #ff8c00, #ff6600);
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background 0.3s;
}

.coupon-input button:hover {
    background: linear-gradient(135deg, #e67e00, #cc7000);
}

.coupon-input .remove-coupon {
    background: #f44336;
    white-space: nowrap;
}

.coupon-input .remove-coupon:hover {
    background: #d32f2f;
}

.coupon-input input[readonly] {
    background: #fff3e0;
    color: #c2410c;
    font-weight: 600;
}

.coupon-item.applied .coupon-details h4::after {
    content: ' ✓ Applied';
    font-size: 0.75em;
    color: #ff8c00;
    font-weight: 600;
}

.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 #ffe0b2;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.coupon-item:hover {
    box-shadow: 0 2px 8px rgba(255,140,0,0.1);
    transform: translateY(-2px);
}

.coupon-item.applied {
    border-left: 4px solid #ff8c00;
    background-color: #fff3e0;
}

.coupon-details h4 {
    margin: 0 0 5px 0;
    color: #1a1a1a;
    font-size: 1em;
}

.coupon-details p {
    margin: 0 0 5px 0;
    color: #8d6e63;
    font-size: 0.9em;
}

.coupon-details small {
    color: #ff8c00;
    font-weight: 500;
}

.btn-apply {
    background: linear-gradient(135deg, #ff8c00, #ff6600);
    color: white;
    border: none;
    padding: 6px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

.btn-apply:hover {
    background: linear-gradient(135deg, #e67e00, #cc7000);
}

.coupon-item.applied .btn-apply {
    background: #f44336;
}

.coupon-item.applied .btn-apply:hover {
    background: #d32f2f;
}

.no-coupons, .loading-coupons {
    text-align: center;
    color: #8d6e63;
    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%, #fff8f0 100%);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(255,140,0,0.08), 0 2px 10px rgba(255,140,0,0.04);
    margin-bottom: 20px;
    border: 1px solid rgba(255, 224, 178, 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: #1a1a1a;
    margin-bottom: 12px;
    font-weight: 800;
    position: relative;
    z-index: 1;
}

.empty-cart-message p {
    color: #8d6e63;
    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, #ff8c00 0%, #ff6600 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 140, 0, 0.3);
    position: relative;
    z-index: 1;
}

.empty-cart-message .btn-primary:hover {
    background: linear-gradient(135deg, #e67e00 0%, #cc7000 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 140, 0, 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, #fff8f0 0%, #fff3e0 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(255, 140, 0, 0.4), 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(255,140,0,0.06), 0 2px 12px rgba(255,140,0,0.04);
    padding: 16px;
    overflow-x: auto;
    border: 1px solid rgba(255, 224, 178, 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, #ff8c00, #ff6600);
    border-radius: 12px 12px 0 0;
}
.cart-items:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(255,140,0,0.08), 0 4px 20px rgba(255,140,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, #fff8f0 0%, #fff3e0 100%);
    color: #1a1a1a;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #ffe0b2;
    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(255, 140, 0, 0.3), 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(255, 224, 178, 0.6);
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

.cart-table tr:hover td {
    background: rgba(255, 248, 240, 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(255, 224, 178, 0.8);
    padding: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #fff8f0 100%);
    display: block;
    margin: 0 auto;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255,140,0,0.08);
}
.cart-image img:hover {
    transform: scale(1.05);
    border-color: rgba(255, 140, 0, 0.4);
    box-shadow: 0 4px 15px rgba(255,140,0,0.15);
}

.cart-details h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
}

.cart-model {
    color: #8d6e63;
    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 #ffe0b2;
    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: #1a1a1a;
}
.cart-item-qty:focus {
    outline: none;
    border-color: #ff8c00;
    box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.15);
}

.btn-refresh {
    background: linear-gradient(135deg, #ff8c00 0%, #e67e00 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(255, 140, 0, 0.3);
}

.btn-refresh i {
    color: #fff !important;
}

.btn-refresh:hover {
    background: linear-gradient(135deg, #e67e00 0%, #cc7000 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 140, 0, 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: 768px) {
  /* Make cart container full width with minimal padding */
  .cart-section { padding: 10px 8px !important; }
  .cart-container { padding: 0 !important; gap: 10px !important; }
  .cart-items { 
    padding: 0 !important; 
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  /* Reset table into card layout */
  .cart-table thead { display: none !important; }
  .cart-table, .cart-table tbody, .cart-table tr, .cart-table td, .cart-table th { 
    display: block !important; 
    width: 100% !important; 
  }
  .cart-table { 
    width: 100% !important; 
    border-collapse: separate !important; 
    table-layout: fixed !important; 
  }
  tr.cart-item { 
    display: flex !important;
    flex-direction: column !important;
    background: #fff !important; 
    border: 1px solid #ffe0b2 !important; 
    border-radius: 12px !important; 
    margin-bottom: 10px !important; 
    box-shadow: 0 2px 8px rgba(255,140,0,0.08) !important; 
    padding: 10px !important;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* First row: Image + Details Container */
  .cart-item-top-row {
    display: flex !important;
    gap: 12px !important;
    margin-bottom: 10px !important;
    width: 100% !important;
    align-items: flex-start !important;
  }
  .cart-item .cart-image {
    width: 100px !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
  }
  .cart-image img { 
    width: 100px !important; 
    height: 100px !important; 
    object-fit: contain !important; 
    border-radius: 10px !important; 
    background: linear-gradient(135deg, #ffffff 0%, #fff8f0 100%) !important; 
    padding: 8px !important; 
    border: 2px solid rgba(255, 224, 178, 0.8) !important;
  }
  
  /* Details Container (Name + Stock + Model + Brand) */
  .cart-details-container {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    margin-top: 4px !important; /* Push down a little */
  }
  
  .cart-item .cart-details {
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
  }
  .cart-details h3 { 
    margin: 0 !important; 
    font-size: 1rem !important; 
    line-height: 1.3 !important; 
    white-space: normal !important; 
    color: #1a1a1a !important;
    font-weight: 600 !important;
    word-wrap: break-word !important;
  }
  .stock-badge { 
    margin: 0 !important; 
    padding: 4px 10px !important; 
    font-size: 0.75rem !important; 
    align-self: flex-start !important;
  }
  
  /* Model & Brand cells */
  .cart-table td.cart-model,
  .cart-table td.cart-brand {
    padding: 0 !important;
    border: none !important;
    width: auto !important;
    display: block !important;
  }
  .cart-table td.cart-model::before,
  .cart-table td.cart-brand::before {
    content: none !important;
  }
  .cart-model, .cart-brand {
    font-size: 0.85rem !important;
    color: #8d6e63 !important;
    font-weight: 500 !important;
  }
  .cart-label {
    font-size: 0.78rem !important;
    color: #6b5a4f !important;
    font-weight: 600 !important;
  }
  

  /* Bottom row: Qty + Price + Delete */
  .cart-item-bottom-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important; /* Reduced space between elements */
    width: 100% !important;
  }
  .cart-table td.cart-qty-col {
    padding: 0 !important;
    border: none !important;
    width: auto !important;
  }
  .cart-table td.cart-qty-col::before {
    content: none !important;
  }
  .cart-qty-col .qty-wrapper {
    margin: 0 !important;
  }
  .cart-item-qty {
    width: 55px !important;
    height: 38px !important;
    font-size: 1rem !important;
  }

  .cart-table td.cart-price {
    padding: 0 !important;
    border: none !important;
    width: auto !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: #1a1a1a !important;
  }
  .cart-table td.cart-price::before {
    content: none !important;
  }
  .cart-price .remove-btn-table,
  .cart-item-bottom-row .remove-btn-table {
    position: static !important;
    transform: none !important;
    margin: 0 !important;
    padding: 10px !important;
    min-width: 40px !important;
    height: 40px !important;
    font-size: 1.1rem !important;
  }

  /* Cart summary mobile styles */
  .cart-summary { 
    padding: 16px !important;
    margin-top: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 12px !important;
  }
  .cart-summary h2 { font-size: 1.1rem !important; }
  .summary-row { font-size: 0.95rem !important; }
  .summary-row.total { font-size: 1.1rem !important; }
  .checkout-btn { font-size: 1rem !important; padding: 14px 20px !important; }
}

.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, #ff8c00, #f97316);
    -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;
}


