/* Wishlist - flat: 1px #E5E7EB borders, 8px cards, 6px controls, no shadows or gradients.
   Phones: one row per item. Wider screens: a grid of cards. */
:root { --wl-line: #E5E7EB; --wl-ink: #111827; --wl-mute: #6B7280; --wl-soft: #F6F7F9; --wl-brand: #E97C43; --wl-brand-dark: #C45A2A; }
body { background: #fff; color: var(--wl-ink); padding-bottom: 80px; }

.wishlist-header { background: #fff; border-bottom: 1px solid var(--wl-line); padding: 14px 0; }
.wishlist-title { font-size: 20px; font-weight: 600; margin: 0; }
.wishlist-header a { font-size: 13.5px; color: var(--wl-mute); }
.wishlist-header a:hover { color: var(--wl-ink); }
main { margin-top: 16px; }

.empty-wishlist { 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(--wl-mute); margin: 0 auto 20px; max-width: 320px; }
.shop-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 20px; background: var(--wl-brand); color: #fff; border: 1px solid var(--wl-brand); border-radius: 6px; text-decoration: none; font-size: 14px; font-weight: 600; cursor: pointer; }
.shop-btn:hover { background: var(--wl-brand-dark); border-color: var(--wl-brand-dark); color: #fff; }

.wishlist-grid { display: flex; flex-direction: column; gap: 10px; margin-top: 0; }
.wishlist-item { background: #fff; border: 1px solid var(--wl-line); border-radius: 8px; overflow: hidden; position: relative; display: flex; flex-direction: row; align-items: flex-start; padding: 12px; gap: 12px; }

.loading-spinner { position: absolute; top: 50%; left: 50%; width: 26px; height: 26px; transform: translate(-50%, -50%); z-index: 11; display: none; }
.loading-spinner::before { content: ''; width: 100%; height: 100%; border: 3px solid var(--wl-line); border-top-color: var(--wl-brand); border-radius: 50%; animation: spin .8s linear infinite; display: block; }
.loading .loading-spinner { display: flex !important; }
@keyframes spin { to { transform: rotate(360deg); } }

.item-image-container { position: relative; width: 84px; height: 84px; flex-shrink: 0; border-radius: 6px; overflow: hidden; background: var(--wl-soft); border: 1px solid var(--wl-line); }
.item-image { width: 100%; height: 100%; object-fit: contain; padding: 4px; font-size: 11px; }
.item-badges { position: absolute; top: 4px; left: 4px; right: 4px; display: flex; justify-content: space-between; z-index: 2; }
.savings-badge { background: #111827; color: #fff; font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 4px; line-height: 1.4; white-space: nowrap; }

.item-details { flex: 1; min-width: 0; }
.item-title { font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--wl-ink); text-decoration: none; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.item-title:hover { color: var(--wl-brand-dark); }
.item-brand, .variant-seller { font-size: 12.5px; color: var(--wl-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.price-section { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin: 4px 0; }
.current-price { font-size: 16px; font-weight: 700; color: var(--wl-ink); }
.mrp-price { font-size: 12.5px; color: #9CA3AF; text-decoration: line-through; }
.stock-status { font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 4px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.in-stock { background: #ECFDF3; color: #166534; }
.low-stock { background: #FFF7E6; color: #92400E; }
.out-stock { background: #FEF2F2; color: #991B1B; }

.action-buttons { display: flex; gap: 8px; margin-top: 8px; }
.btn-move-cart { flex: 1; min-height: 36px; background: var(--wl-brand); color: #fff; border: 1px solid var(--wl-brand); border-radius: 6px; padding: 0 10px; font-size: 13.5px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn-move-cart:hover:not(:disabled) { background: var(--wl-brand-dark); border-color: var(--wl-brand-dark); }
.btn-move-cart.disabled { background: #E5E7EB; border-color: #E5E7EB; color: #6B7280; cursor: not-allowed; }
.btn-remove { min-height: 36px; background: #fff; color: #B91C1C; border: 1px solid #D1D5DB; border-radius: 6px; padding: 0 12px; font-size: 13.5px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.btn-remove:hover { background: #FEF2F2; border-color: #FCA5A5; }
.delivery-link { padding: 8px 0 2px; font-size: 12.5px; color: var(--wl-brand-dark); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.delivery-link:hover { text-decoration: underline; }

@media (min-width: 768px) {
  .wishlist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
  .wishlist-item { display: block; padding: 0; }
  .item-image-container { width: 100%; height: auto; aspect-ratio: 1; border-radius: 0; border: 0; border-bottom: 1px solid var(--wl-line); }
  .item-image { padding: 12px; }
  .item-details { padding: 12px; }
  .item-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .action-buttons { flex-direction: column; gap: 6px; margin-top: 10px; }
}

/* phone bar: count and clear all */
.mobile-bottom-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--wl-line); display: flex; align-items: center; justify-content: space-between; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 1000; }
.wishlist-count { font-size: 14px; color: var(--wl-ink); font-weight: 600; }
.btn-clear-all { min-height: 36px; background: #fff; color: var(--wl-ink); border: 1px solid #D1D5DB; border-radius: 6px; padding: 0 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.btn-clear-all:hover { background: var(--wl-soft); }
@media (min-width: 768px) { .mobile-bottom-bar { display: none; } }
@media (max-width: 991px) { .mobile-bottom-bar { bottom: 60px; } body { padding-bottom: 140px; } }

/* move-to-cart and delivery dialogs: shared dialog look (layout/dialog.css). Phone = bottom sheet over the bottom nav, desktop = centred dialog. */
.modal-overlay { position: fixed; inset: 0; background: var(--dlg-backdrop, rgba(15, 23, 42, .45)); z-index: 10050; display: none; align-items: flex-end; justify-content: center; }
.modal-overlay.active { display: flex; animation: wlFade .15s linear both; }
.modal-content, .delivery-content { background: #fff; border-radius: 12px 12px 0 0; padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px)); width: 100%; box-shadow: var(--dlg-shadow, 0 8px 24px rgba(15, 23, 42, .14)); animation: wlUp .15s cubic-bezier(.2, 0, 0, 1) both; }
.modal-content { max-width: 500px; max-height: 90vh; overflow-y: auto; }
.delivery-content { max-width: 400px; max-height: 90vh; overflow-y: auto; }
@media (min-width: 768px) {
  .modal-overlay { align-items: center; padding: 16px; }
  .modal-content, .delivery-content { border-radius: 8px; padding: 0 20px 20px; animation-name: wlIn; }
}
@keyframes wlFade { from { opacity: 0; } }
@keyframes wlUp { from { transform: translateY(100%); } }
@keyframes wlIn { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .modal-overlay.active, .modal-content, .delivery-content { animation: none; } }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; margin: 0 -16px 12px; min-height: 56px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--wl-line); background: #fff; }
@media (min-width: 768px) { .modal-header { margin-left: -20px; margin-right: -20px; padding-left: 20px; } }
.modal-title { font-size: 16px; font-weight: 600; margin: 0; }
.close-modal { width: 40px; height: 40px; display: grid; place-items: center; background: none; border: 0; border-radius: 6px; font-size: 22px; line-height: 1; cursor: pointer; color: var(--wl-mute); }
.close-modal:hover { background: var(--wl-soft); color: var(--wl-ink); }
.variant-list { margin: 12px 0; max-height: 250px; overflow-y: auto; border: 1px solid var(--wl-line); border-radius: 8px; }
.variant-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-bottom: 1px solid var(--wl-line); cursor: pointer; }
.variant-item:last-child { border-bottom: none; }
.variant-item.selected { background: #FFF3EA; box-shadow: inset 3px 0 0 var(--wl-brand); }
.variant-image { width: 40px; height: 40px; object-fit: contain; border: 1px solid var(--wl-line); border-radius: 6px; background: #fff; }
.variant-info { flex: 1; }
.variant-name { font-weight: 600; font-size: 13.5px; }
.variant-price { font-size: 13.5px; font-weight: 700; }
.variant-stock { font-size: 12px; color: var(--wl-mute); }
.out-of-stock-tag { background: #FEF2F2; color: #991B1B; font-size: 12px; padding: 1px 6px; border-radius: 4px; }
.quantity-selector { display: flex; align-items: center; justify-content: space-between; margin: 16px 0; padding: 12px; border: 1px solid var(--wl-line); border-radius: 8px; }
.qty-btn { width: 36px; height: 36px; border: 1px solid #D1D5DB; background: var(--wl-soft); color: var(--wl-ink); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; border-radius: 6px; padding: 0; }
.qty-btn:hover:not(:disabled) { background: #FFF3EA; border-color: var(--wl-brand); color: var(--wl-brand-dark); }
.qty-btn:disabled { opacity: .4; cursor: not-allowed; }
.qty-input { width: 50px; text-align: center; font-size: 16px; font-weight: 600; border: 0; outline: none; -moz-appearance: textfield; }
.stock-info { font-size: 12.5px; color: var(--wl-mute); margin-top: 8px; text-align: center; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.btn-cancel { flex: 1; min-height: 40px; background: #fff; color: var(--wl-ink); border: 1px solid #D1D5DB; border-radius: 6px; padding: 0 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-cancel:hover { background: var(--wl-soft); }
.btn-add-to-cart, .btn-check-delivery { min-height: 40px; background: var(--wl-brand); color: #fff; border: 1px solid var(--wl-brand); border-radius: 6px; padding: 0 10px; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-add-to-cart { flex: 2; }
.btn-check-delivery { width: 100%; margin-top: 8px; }
.btn-add-to-cart:hover:not(:disabled), .btn-check-delivery:hover:not(:disabled) { background: var(--wl-brand-dark); border-color: var(--wl-brand-dark); }
.btn-add-to-cart:disabled { background: #E5E7EB; border-color: #E5E7EB; color: #6B7280; cursor: not-allowed; }
.pincode-input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid #D1D5DB; border-radius: 6px; font-size: 16px; margin: 12px 0 0; text-align: center; }
.pincode-input:focus { outline: 2px solid color-mix(in srgb, var(--wl-brand) 35%, transparent); border-color: var(--wl-brand); }
.delivery-result { padding: 14px; border-radius: 8px; margin: 12px 0; text-align: center; }
.delivery-available { background: #ECFDF3; border: 1px solid #BBF7D0; }
.delivery-not-available { background: #FEF2F2; border: 1px solid #FECACA; }
