/* Cart page - flat: 1px #E5E7EB borders, 8px cards, 6px controls, no shadows or gradients. */
:root {
  --primary: #E97C43;
  --primary-dark: #C45A2A;
  --primary-light: #FFF3EA;
  --cart-line: #E5E7EB;
  --cart-ink: #111827;
  --cart-mute: #6B7280;
  --cart-soft: #F6F7F9;
  --cart-ok: #15803D;
  --cart-bad: #B91C1C;
}

body { background: #fff; color: var(--cart-ink); }

/* ---- page header ---- */
.cart-header { background: #fff; border-bottom: 1px solid var(--cart-line); padding: 14px 0; }
.cart-title { font-size: 20px; font-weight: 600; margin: 0; }
.cart-header a { font-size: 13.5px; color: var(--cart-mute); }
.cart-header a:hover { color: var(--cart-ink); }

.cart-container { margin-top: 16px; }

/* ---- notices ---- */
.cart-free { display: flex; align-items: center; gap: 10px; margin: 16px 0 0; padding: 10px 14px; border: 1px solid #BBF7D0; border-radius: 8px; background: #F0FDF4; color: #166534; font-size: 13.5px; }
.cart-free i { font-size: 16px; }
.cart-free b { font-weight: 600; }
.cart-free span { color: #15803D; }

.container.address-change-btn { margin-top: 12px; margin-bottom: 12px; }
.address-change-btn .btn { background: #fff; border: 1px solid var(--primary); color: var(--primary-dark); font-size: 13.5px; font-weight: 600; min-height: 36px; padding: 0 14px; border-radius: 6px; display: inline-flex; align-items: center; gap: 8px; }
.address-change-btn .btn:hover { background: var(--primary-light); color: var(--primary-dark); }

.out-of-stock-warning, .delivery-issue-warning { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; margin-bottom: 12px; border-radius: 8px; font-size: 13px; line-height: 1.45; }
.out-of-stock-warning { background: #FEF2F2; border: 1px solid #FECACA; color: var(--cart-bad); }
.delivery-issue-warning { background: #FFF7E6; border: 1px solid #FDE2A8; color: #92400E; }
.warning-icon, .delivery-icon { font-size: 16px; line-height: 1.45; flex: none; }
.warning-text, .delivery-text { font-size: 13px; font-weight: 400; }
.warning-text strong, .delivery-text strong { font-weight: 600; }

/* ---- empty / login-required state ---- */
.empty-cart { text-align: center; padding: 32px 16px; }
.empty-icon { font-size: 44px; color: #9CA3AF; margin-bottom: 12px; line-height: 1; }
.empty-title { font-size: 18px; font-weight: 600; margin: 0 0 6px; }
.empty-subtitle { color: var(--cart-mute); margin: 0 auto 20px; max-width: 400px; }
.shop-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 20px; background: var(--primary); color: #fff; border: 1px solid var(--primary); border-radius: 6px; text-decoration: none; font-size: 14px; font-weight: 600; cursor: pointer; }
.shop-btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

/* ---- items ---- */
.seller-items { display: flex; flex-direction: column; gap: 12px; }
.cart-item { display: grid; grid-template-columns: 96px 1fr auto; gap: 16px; padding: 16px; border: 1px solid var(--cart-line); border-radius: 8px; background: #fff; position: relative; }
.item-image-container { position: relative; }
.item-image { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--cart-soft); border: 1px solid var(--cart-line); border-radius: 6px; padding: 4px; font-size: 11px; overflow: hidden; }
.item-badge { position: absolute; top: 6px; left: 6px; background: #111827; color: #fff; font-size: 12px; font-weight: 600; line-height: 1.3; padding: 1px 6px; border-radius: 4px; z-index: 1; white-space: nowrap; }
.item-details { min-width: 0; }
.item-title { font-size: 14px; font-weight: 600; line-height: 1.4; margin-bottom: 2px; color: var(--cart-ink); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-title:hover { color: var(--primary-dark); }
.item-brand { font-size: 12.5px; color: var(--cart-mute); margin-bottom: 6px; }
.item-details .text-muted { font-size: 12.5px; }

.meta-tag { font-size: 12px; font-weight: 500; line-height: 1.3; padding: 2px 8px; border-radius: 4px; display: inline-flex; align-items: center; gap: 5px; margin: 4px 6px 0 0; }
.meta-tag i { font-size: 12px; }
.mt-variant { background: #F3F4F6; color: #374151; }
.mt-bad { background: #FEF2F2; color: var(--cart-bad); }
.mt-ok { background: #ECFDF3; color: var(--cart-ok); }
.mt-warn { background: #FFF7E6; color: #B45309; }

.delivery-info-tag { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.delivery-info-tag .meta-tag { margin-top: 0; align-self: flex-start; }
.delivery-date, .shipping-charge { font-size: 12.5px; color: #374151; display: flex; align-items: center; gap: 6px; }
.free-shipping { color: var(--cart-ok); font-weight: 600; }

.item-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; min-width: 150px; }
.price-container { text-align: right; }
.current-price { font-size: 16px; font-weight: 700; color: var(--cart-ink); line-height: 1.25; }
.mrp-price { font-size: 12.5px; color: #9CA3AF; text-decoration: line-through; }
.save-badge { font-size: 12.5px; color: var(--cart-ok); font-weight: 600; }

.quantity-control { display: inline-flex; align-items: center; border: 1px solid #D1D5DB; border-radius: 6px; overflow: hidden; background: #fff; height: 36px; }
.qty-btn { width: 34px; height: 100%; border: 0; background: var(--cart-soft); color: var(--cart-ink); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 15px; padding: 0; }
.qty-btn:hover:not(:disabled) { background: var(--primary-light); color: var(--primary-dark); }
.qty-btn:disabled { opacity: .4; cursor: not-allowed; }
.qty-input { width: 40px; height: 100%; border: 0; border-left: 1px solid var(--cart-line); border-right: 1px solid var(--cart-line); border-radius: 0; text-align: center; font-size: 14px; font-weight: 600; color: var(--cart-ink); background: #fff; outline: none; padding: 0; -moz-appearance: textfield; }
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.remove-btn { color: var(--cart-bad); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; padding: 6px 2px; cursor: pointer; }
.remove-btn:hover { text-decoration: underline; }

/* ---- order summary (desktop column) ---- */
.summary-card { background: #fff; border: 1px solid var(--cart-line); border-radius: 8px; padding: 16px; position: sticky; top: 100px; }
@media (max-width: 991px) { .summary-card { display: none; } }
.summary-header { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--cart-line); }
.summary-title { font-size: 15px; font-weight: 600; margin: 0; }
.breakdown-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; font-size: 14px; }
.breakdown-label { color: var(--cart-mute); font-size: 14px; }
.breakdown-value { color: var(--cart-ink); font-weight: 500; font-size: 14px; }
.breakdown-item .text-success, .breakdown-item.text-success { color: var(--cart-ok) !important; }
.breakdown-item .fw-bold { font-weight: 600 !important; }
.breakdown-total { padding: 12px 0 0; border-top: 1px solid var(--cart-line); margin-top: 8px; }
.total-label { font-size: 15px; font-weight: 600; color: var(--cart-ink); }
.total-value { font-size: 20px; font-weight: 700; color: var(--cart-ink); }
.tax-note { font-size: 12.5px; color: var(--cart-mute); text-align: center; margin-top: 6px; }

.checkout-btn { width: 100%; min-height: 44px; padding: 0 16px; background: var(--primary); color: #fff; border: 1px solid var(--primary); border-radius: 6px; font-size: 14px; font-weight: 600; letter-spacing: .02em; text-align: center; text-decoration: none; margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.checkout-btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.checkout-btn.disabled { background: #E5E7EB; border-color: #E5E7EB; color: #6B7280; cursor: not-allowed; pointer-events: none; }
.checkout-btn.checkout-btn-select-address { background: var(--primary); border-color: var(--primary); color: #fff; cursor: pointer; pointer-events: auto; }
.checkout-btn.checkout-btn-select-address:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* coupon box in the summary */
.cart-coupon { margin: 0 0 8px; }
.cart-coupon form { display: flex; gap: 8px; }
.cart-coupon input { flex: 1; min-width: 0; height: 40px; border: 1px solid #D1D5DB; border-radius: 6px; padding: 0 12px; font-size: 14px; font-weight: 500; letter-spacing: .02em; background: #fff; }
.cart-coupon input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 400; }
.cart-coupon input:focus { outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }
.cart-coupon button[type=submit] { border: 1px solid #111827; border-radius: 6px; background: #111827; color: #fff; font-size: 13.5px; font-weight: 600; padding: 0 16px; height: 40px; }
.cc-msg { margin-top: 6px; font-size: 12.5px; color: #166534; min-height: 1em; }
.cc-msg.bad { color: var(--cart-bad); }
.cc-on { display: flex; gap: 10px; align-items: center; background: #F0FDF4; border: 1px solid #BBF7D0; border-radius: 6px; padding: 8px 12px; }
.cc-on > i { font-size: 16px; color: var(--cart-ok); }
.cc-on div { flex: 1; display: grid; font-size: 13.5px; }
.cc-on small { color: #166534; font-size: 12px; }
.cc-on button { border: 0; background: none; color: var(--cart-bad); font-weight: 600; font-size: 13px; }

/* ---- address picker (full screen on phones, centred panel on desktop) ---- */
/* address picker: shared dialog look (layout/dialog.css). Phone = bottom sheet over the bottom nav, desktop = centred 520px dialog. The flat shadow ring is the backdrop. */
.address-popup { position: fixed; inset: 8vh 0 0 0; background: #fff; z-index: 10050; display: flex; flex-direction: column; border-radius: 12px 12px 0 0; box-shadow: 0 0 0 100vmax var(--dlg-backdrop, rgba(15, 23, 42, .45)); transform: translateY(100%); visibility: hidden; transition: transform .15s cubic-bezier(.2, 0, 0, 1), visibility 0s linear .15s; }
.address-popup.active { transform: translateY(0); visibility: visible; transition: transform .15s cubic-bezier(.2, 0, 0, 1); }
@media (min-width: 768px) {
  .address-popup { inset: 5vh auto 5vh 50%; width: 520px; margin-left: -260px; border-radius: 8px; opacity: 0; transform: translateY(8px); transition: opacity .15s linear, transform .15s cubic-bezier(.2, 0, 0, 1), visibility 0s linear .15s; }
  .address-popup.active { opacity: 1; transform: none; transition: opacity .15s linear, transform .15s cubic-bezier(.2, 0, 0, 1); }
}
@media (prefers-reduced-motion: reduce) { .address-popup, .address-popup.active { transition: none; } }
.popup-header { min-height: 56px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--cart-line); display: flex; align-items: center; justify-content: space-between; background: #fff; position: sticky; top: 0; z-index: 2; }
.popup-title { font-size: 16px; font-weight: 600; margin: 0; }
.back-btn, .close-popup { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; border-radius: 6px; color: var(--cart-ink); font-size: 18px; padding: 0; cursor: pointer; }
.back-btn:hover, .close-popup:hover { background: var(--cart-soft); }
.popup-body { flex: 1; overflow-y: auto; padding: 16px; }
.address-list { display: flex; padding-bottom: 8px; flex-direction: column; gap: 10px; }
.address-card { border: 1px solid var(--cart-line); border-radius: 8px; padding: 12px 14px; cursor: pointer; position: relative; }
.address-card:hover { border-color: #9CA3AF; }
.address-card.selected { border-color: var(--primary); background: var(--primary-light); }
.address-card-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.address-type-badge, .default-badge { font-size: 12px; font-weight: 600; line-height: 1.3; padding: 1px 8px; border-radius: 4px; }
.address-type-badge { background: #F3F4F6; color: #374151; }
.default-badge { background: #ECFDF3; color: var(--cart-ok); }
.address-card-body h6 { font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.address-card-body p { font-size: 13px; color: #374151; }
.popup-footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--cart-line); display: flex; flex-direction: column; gap: 8px; }
.btn-add-address { background: #fff; border: 1px solid #D1D5DB; border-radius: 6px; min-height: 40px; padding: 0 14px; text-align: center; color: var(--cart-ink); font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.btn-add-address:hover { background: var(--cart-soft); }
.btn-deliver-here { background: var(--primary); border: 1px solid var(--primary); border-radius: 6px; min-height: 42px; padding: 0 16px; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-deliver-here:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-deliver-here:disabled { background: #E5E7EB; border-color: #E5E7EB; color: #6B7280; cursor: not-allowed; }
#inlineAddAddressForm { margin-bottom: 8px; font-size: 14px; }
#inlineAddAddressForm .form-control, #inlineAddAddressForm .form-select { min-height: 40px; border: 1px solid #D1D5DB; border-radius: 6px; font-size: 14px; box-shadow: none; }

/* ---- loading overlay on a line while its quantity updates ---- */
.loading { position: relative; pointer-events: none; user-select: none; }
.loading-spinner { position: absolute; top: 50%; left: 50%; width: 26px; height: 26px; transform: translate(-50%, -50%); z-index: 11; display: none; align-items: center; justify-content: center; }
.loading-spinner::before { content: ''; width: 100%; height: 100%; border: 3px solid var(--cart-line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; display: block; }
.loading .loading-spinner { display: flex !important; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- phones ---- */
@media (max-width: 767px) {
  .cart-header { padding: 12px 0; }
  .cart-free { margin-top: 12px; padding: 8px 12px; font-size: 13px; }
  .cart-item { grid-template-columns: 76px 1fr; gap: 12px; padding: 12px; }
  .item-actions { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; width: 100%; min-width: 0; padding-top: 10px; border-top: 1px solid var(--cart-line); gap: 10px; }
  .price-container { text-align: left; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; }
  .current-price { font-size: 16px; }
  .address-popup .form-control, .address-popup .form-select { font-size: 16px; }
  .cart-coupon input { font-size: 16px; }
}

/* ---- phone checkout bar (sits right above the tab bar) ---- */
.cart-checkout-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--cart-line); display: none; z-index: 1000; padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 991px) { .cart-checkout-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; } }
.mobile-total-section { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.mobile-total-label { font-size: 12.5px; color: var(--cart-mute); display: flex; align-items: center; gap: 6px; }
.summary-info-icon { font-size: 14px; color: var(--cart-mute); cursor: pointer; }
.mobile-total-amount { font-size: 18px; font-weight: 700; color: var(--cart-ink); line-height: 1.2; }
.mobile-checkout-btn { background: var(--primary); color: #fff; border: 1px solid var(--primary); border-radius: 6px; min-height: 44px; padding: 0 20px; font-weight: 600; font-size: 14px; text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 140px; cursor: pointer; white-space: nowrap; }
.mobile-checkout-btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.mobile-checkout-btn.disabled { background: #E5E7EB; border-color: #E5E7EB; color: #6B7280; cursor: not-allowed; pointer-events: none; }
.mobile-checkout-btn.checkout-btn-select-address { background: var(--primary); color: #fff; cursor: pointer; pointer-events: auto; }

/* ---- order summary bottom sheet (phones) ---- */
.order-summary-sheet { position: fixed; inset: 0; z-index: 2500; display: none; }
.order-summary-sheet.active { display: block; }
.order-summary-sheet .sheet-overlay { position: absolute; inset: 0; background: var(--dlg-backdrop, rgba(15, 23, 42, .45)); }
.order-summary-sheet .sheet-container { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 12px 12px 0 0; max-height: 85vh; display: flex; flex-direction: column; transform: translateY(100%); animation: slideUpSheet .15s cubic-bezier(.2, 0, 0, 1) forwards; }
@keyframes slideUpSheet { to { transform: translateY(0); } }
.sheet-handle { display: none; }
.sheet-header { display: flex; justify-content: space-between; align-items: center; min-height: 56px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--cart-line); }
.sheet-header h5 { margin: 0; font-size: 16px; font-weight: 600; }
.sheet-header button { width: 40px; height: 40px; border: 0; background: none; font-size: 16px; border-radius: 6px; cursor: pointer; }
.sheet-body { padding: 8px 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; }
.sheet-body hr { margin: 8px 0; color: var(--cart-line); opacity: 1; }
.sheet-body .breakdown-total { display: flex; justify-content: space-between; font-size: 15px; margin-top: 0; padding-top: 0; border-top: 0; }
@media (min-width: 992px) { .order-summary-sheet { display: none !important; } }
