/* ─────────────────────────────────────────────────────────────
   Ganapati Super Market — Stylesheet
   ───────────────────────────────────────────────────────────── */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream      : #F5EFE0;
  --cream-dark : #EDE3CC;
  --beige      : #D9C9A8;
  --terra      : #C4845A;
  --terra-dark : #7A3E1F;
  --brown-text : #3D1F0A;
  --white      : #FFFDF8;
  --wa-green   : #25D366;
  --add-green  : #4CAF82;
  --grey-text  : #9e8060;
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--cream);
  min-height: 100vh;
  color: var(--brown-text);
}

/* ── DELIVERY BANNER ─────────────────────────────────────────── */
.delivery-banner {
  padding: 9px 16px;
  text-align: center;
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.1px;
}
.delivery-banner.open   { background: #e8f5ee; color: #1a6b3a; border-bottom: 1px solid #b8dfc8; }
.delivery-banner.closed { background: #fdf0e0; color: #8a4a10; border-bottom: 1px solid #e8cfa0; }

/* ── HEADER ──────────────────────────────────────────────────── */
.header {
  background: var(--terra);
  padding: 14px 16px 10px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 4px 16px rgba(120, 50, 15, 0.28);
}
.header-top {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 10px;
}
.logo-area { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 42px; height: 42px; background: var(--cream);
  border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 22px; flex-shrink: 0;
}
.store-name {
  font-family: 'Poppins', sans-serif;
  font-size: 19px; font-weight: 800;
  color: var(--cream); line-height: 1.1;
}
.store-tagline { color: #f5dfc0; font-size: 11px; font-weight: 500; }

.cart-btn {
  background: rgba(255,255,255,0.22);
  border: 1.5px solid rgba(255,255,255,0.4);
  border-radius: 10px; padding: 8px 14px;
  display: flex; align-items: center; gap: 6px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700; font-size: 13px;
  color: var(--white); cursor: pointer; white-space: nowrap;
}
.cart-count {
  background: var(--white); color: var(--terra-dark);
  border-radius: 50%; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
}

/* ── CATEGORY PILLS ──────────────────────────────────────────── */
.cat-scroll-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  padding: 3px 0;
}
.search-wrap {
  margin: 12px 0 6px;
}
.search-input {
  width: 100%; padding: 12px 16px;
  border-radius: 16px; border: none;
  outline: none; font-size: 14px;
  font-family: 'Nunito', sans-serif;
  color: var(--brown-text);
  background: rgba(255,255,255,0.16);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
}
.search-input::placeholder {
  color: rgba(255,255,255,0.72);
}

.cat-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 4px;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-pill {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  padding: 8px 16px;
  white-space: nowrap;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
  flex-shrink: 0;
  scroll-snap-align: center;
}
.cat-pill:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.28);
}
.cat-pill.active {
  background: var(--white);
  color: var(--terra-dark);
  border-color: transparent;
}
.cat-nav {
  position: absolute;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  color: var(--terra-dark);
  font-size: 20px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
}
.cat-nav:hover { transform: scale(1.03); }
.cat-nav:active { transform: scale(0.98); }
.cat-nav-left { left: 4px; }
.cat-nav-right { right: 4px; }
.cat-nav:focus { outline: 2px solid var(--terra-dark); }
@media (max-width: 640px) {
  .cat-nav { display: none; }
}

/* ── CONTENT ─────────────────────────────────────────────────── */
.content { padding: 12px 12px 110px; }

.section-title {
  font-size: 13px; font-weight: 800;
  color: var(--terra-dark);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin: 16px 0 8px;
  display: flex; align-items: center; gap: 6px;
}
.section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--beige);
}
.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--grey-text); font-size: 14px;
}

/* ── PRODUCT GRID — RESPONSIVE ───────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 600px) {
  .products-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 960px) {
  .products-grid { grid-template-columns: repeat(4, 1fr); }
  .content { padding: 16px 24px 110px; max-width: 1100px; margin: 0 auto; }
}

/* ── PRODUCT CARDS ───────────────────────────────────────────── */
.product-card {
  background: var(--white); border-radius: 12px;
  border: 1px solid #e0d5c4; overflow: hidden;
  transition: border-color 0.15s;
  display: flex; flex-direction: column;
}
.product-card.in-cart    { border-color: var(--terra); }
.product-card.out-of-stock { opacity: 0.55; }

.prod-img-wrap {
  background: #fff; border-bottom: 1px solid #e0d5c4;
  display: flex; align-items: center; justify-content: center;
  padding: 16px 10px; min-height: 110px;
}
.prod-img-wrap img { width: 80px; height: 80px; object-fit: contain; }
.prod-emoji { font-size: 52px; line-height: 1; }

.prod-info {
  padding: 10px 10px 12px;
  flex: 1; display: flex; flex-direction: column;
}
.prod-name {
  font-size: 13px; font-weight: 700;
  color: var(--brown-text); line-height: 1.3; margin-bottom: 3px;
}
.prod-unit { font-size: 12px; color: var(--grey-text); margin-bottom: 10px; font-weight: 600; }
.prod-bottom {
  display: flex; align-items: center;
  justify-content: space-between; margin-top: auto; gap: 6px;
}
.prod-price { font-size: 15px; font-weight: 800; color: var(--brown-text); }

.out-of-stock-label {
  font-size: 11px; font-weight: 700; color: #c0392b;
  background: #fdecea; border: 1px solid #f5c6c3;
  border-radius: 6px; padding: 4px 8px;
}

.qty-ctrl {
  display: flex; align-items: center;
  border: 1.5px solid var(--terra); border-radius: 8px; overflow: hidden;
}
.qty-btn {
  width: 28px; height: 30px; border: none; cursor: pointer;
  font-size: 17px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  background: #fff; color: var(--terra); transition: background 0.1s;
}
.qty-btn:active { background: var(--cream); }
.qty-num {
  font-size: 13px; font-weight: 800; color: var(--terra);
  min-width: 22px; text-align: center; background: #fff;
}
.cart-item-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px;
}
.remove-btn {
  background: none; border: none; color: var(--terra); font-size: 12px;
  font-weight: 700; cursor: pointer; padding: 0;
}
.add-btn {
  background: #fff; border: 1.5px solid var(--add-green);
  border-radius: 8px; padding: 5px 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px; font-weight: 800;
  color: var(--add-green); cursor: pointer;
  transition: background 0.15s; letter-spacing: 0.3px;
}
.add-btn:hover { background: #f0fbf5; }

/* ── OVERLAY ─────────────────────────────────────────────────── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(60,20,5,0.45); z-index: 150;
}
.overlay.open { display: block; }

/* ── IMAGE VIEWER MODAL ──────────────────────────────────────── */
.image-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 250;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}
.image-modal.open {
  display: flex;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.image-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-image-display {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.image-modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 28px;
  font-weight: 300;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(4px);
  z-index: 10;
}
.image-modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}
.image-modal-close:active {
  transform: scale(0.95);
}
@media (max-width: 480px) {
  .image-modal-close {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.4);
  }
  .image-modal-close:hover {
    background: rgba(0, 0, 0, 0.6);
  }
  .modal-image-display {
    max-height: 80vh;
  }
}

/* ── CART PANEL ──────────────────────────────────────────────── */
.cart-panel {
  display: none; position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-radius: 20px 20px 0 0;
  padding: 16px 16px 24px;
  z-index: 200; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 -4px 20px rgba(120,50,15,0.18);
}
.cart-panel::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 4px; background: var(--terra); border-radius: 20px 20px 0 0;
}
.cart-panel.open { display: block; }

@media (min-width: 600px) {
  .cart-panel { left: auto; right: 16px; width: 400px; }
  .bottom-bar { left: auto; right: 16px; width: 400px; }
}

.cart-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 12px;
}
.cart-title {
  font-family: 'Poppins', sans-serif;
  font-size: 16px; font-weight: 700; color: var(--terra-dark);
}
.close-btn {
  background: var(--cream-dark); border: none; border-radius: 8px;
  width: 30px; height: 30px; cursor: pointer;
  font-size: 16px; color: var(--terra-dark); font-weight: 700;
}
.cart-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-bottom: 0.5px solid var(--cream-dark);
}
.cart-item-name   { font-size: 13px; font-weight: 700; color: var(--brown-text); }
.cart-item-detail { font-size: 11px; color: var(--grey-text); margin-top: 1px; }
.cart-item-price  { font-size: 14px; font-weight: 800; color: var(--terra-dark); white-space: nowrap; }

.cart-total {
  display: flex; justify-content: space-between; align-items: center;
  margin: 14px 0; padding-top: 12px; border-top: 2px solid var(--beige);
}
.total-label { font-size: 14px; font-weight: 700; color: var(--terra-dark); }
.total-amt   { font-size: 20px; font-weight: 800; color: var(--terra-dark); }
.delivery-info { font-size: 12px; color: var(--brown-text); margin-bottom: 12px; }
.delivery-charge-row { display: flex; justify-content: space-between; margin-top: 6px; }
.delivery-note { margin-top: 8px; color: #6b4b30; line-height: 1.4; }
.grand-total-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(102, 68, 40, 0.15);
  font-weight: 800; color: var(--terra-dark);
}
.grand-total-amt { font-size: 16px; }
.empty-cart  { text-align: center; padding: 24px; color: #b09070; font-size: 13px; }

/* ── CUSTOMER FORM ───────────────────────────────────────────── */
.field-group { margin-bottom: 12px; }
.field-label {
  font-size: 12px; font-weight: 700;
  color: var(--terra-dark); margin-bottom: 4px; display: block;
}
.field-input {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--beige); border-radius: 9px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px; color: var(--brown-text);
  background: var(--cream); outline: none;
}
.field-input:focus { border-color: var(--terra); }

/* ── WHATSAPP BUTTON ─────────────────────────────────────────── */
.wa-btn {
  width: 100%; background: var(--wa-green);
  border: none; border-radius: 12px; padding: 14px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 15px; font-weight: 800; color: #fff; cursor: pointer;
}
.wa-icon { width: 22px; height: 22px; flex-shrink: 0; }

/* ── BOTTOM BAR ──────────────────────────────────────────────── */
.bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--white); border-top: 1.5px solid var(--cream-dark);
  padding: 10px 16px 14px; display: none; z-index: 99;
}
.bottom-bar.visible { display: block; }
.view-cart-btn {
  width: 100%; background: var(--terra);
  border: none; border-radius: 12px; padding: 13px 16px;
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'Nunito', sans-serif; color: #fff; cursor: pointer;
  box-shadow: 0 3px 12px rgba(120,50,15,0.28);
}
.vcb-left { display: flex; align-items: center; gap: 8px; }
.vcb-badge {
  background: rgba(255,255,255,0.2); border-radius: 6px;
  padding: 2px 9px; font-size: 12px; font-weight: 700;
}
.vcb-label { font-size: 14px; font-weight: 700; }
.vcb-total { font-size: 16px; font-weight: 800; }

/* ── FOOTER ──────────────────────────────────────────────────── */
.footer { text-align: center; padding: 12px; font-size: 11px; color: #b09070; }
