/* ============================================================
   Design tokens
   Palette: fresh-market green + turmeric yellow + tomato red
   (deliberately NOT the generic cream/terracotta AI palette)
   ============================================================ */
:root {
  --bg: #F5F8F1;
  --surface: #FFFFFF;
  --ink: #17261B;
  --muted: #66786A;
  --border: #E1E8DA;

  --primary: #1F6B45;
  --primary-dark: #144A2F;
  --primary-tint: #E7F2EB;

  --accent: #F3A93C;      /* turmeric — CTAs, badges */
  --accent-dark: #D98F1F;

  --sale: #D8483A;        /* tomato — discount tags */

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-card: 0 2px 10px rgba(23, 38, 27, 0.07);
  --shadow-float: 0 8px 24px rgba(20, 74, 47, 0.28);

  --font-display: 'Baloo 2', 'Noto Sans Devanagari', sans-serif;
  --font-body: 'Inter', 'Noto Sans Devanagari', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: 78px; /* room for sticky cart bar on mobile */
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------------- Top bar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  max-width: 1100px;
  margin: 0 auto;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  color: var(--primary);
  white-space: nowrap;
}
.brand span { color: var(--accent-dark); }

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 9px 14px;
  gap: 8px;
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 14px;
  color: var(--ink);
}
.search-box i { color: var(--muted); font-size: 15px; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.icon-btn {
  position: relative;
  font-size: 20px;
  color: var(--primary-dark);
}
.icon-btn i { vertical-align: middle; }
.icon-btn .badge {
  position: absolute;
  top: -6px;
  right: -10px;
  background: var(--sale);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
}

/* ---------------- Category chip strip (signature element) ---------------- */
.category-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px 16px 6px;
  scrollbar-width: none;
}
.category-strip::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 74px;
}
.chip-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--primary-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--primary-dark);
  border: 2px solid transparent;
  transition: border-color .15s ease, transform .15s ease;
}
.chip.active .chip-icon,
.chip:hover .chip-icon {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.chip-label {
  font-size: 11.5px;
  text-align: center;
  color: var(--muted);
  line-height: 1.2;
}
.chip.active .chip-label { color: var(--primary-dark); font-weight: 600; }

/* ---------------- Section heading ---------------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 22px 0 12px;
}
.section-head h2 { font-size: 19px; }
.section-head a { font-size: 13px; color: var(--primary); font-weight: 600; }

/* ---------------- Product grid & card ---------------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 640px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 960px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); }
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.product-thumb {
  aspect-ratio: 1 / 1;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }

.discount-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--sale);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
}

.product-body {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.product-unit { font-size: 11.5px; color: var(--muted); }
.product-name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  min-height: 34px;
}
.price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 2px;
}
.price-now { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.price-mrp { font-size: 12px; color: var(--muted); text-decoration: line-through; }

.add-btn-row { margin-top: 6px; }

.btn-add {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  padding: 7px 0;
  border-radius: var(--radius-sm);
  transition: background .15s ease, color .15s ease;
}
.btn-add:hover { background: var(--primary); color: #fff; }

.qty-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.qty-stepper button {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  width: 30px;
  height: 28px;
}
.qty-stepper .qty-val {
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

/* ---------------- Buttons (general) ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14.5px;
  border: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--ink); }

/* ---------------- Sticky bottom cart bar (mobile signature) ---------------- */
.cart-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 50;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
  padding: 12px 16px;
  display: none;
  align-items: center;
  justify-content: space-between;
  transition: transform .2s ease;
}
.cart-bar.show { display: flex; animation: bar-pop .25s ease; }
@keyframes bar-pop {
  0% { transform: translateY(12px) scale(.97); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
.cart-bar-info { display: flex; flex-direction: column; }
.cart-bar-count { font-size: 12px; opacity: .85; }
.cart-bar-total { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.cart-bar-cta {
  background: var(--accent);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------------- Cart page ---------------- */
.cart-line {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-card);
}
.cart-line-thumb {
  width: 60px; height: 60px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
  flex-shrink: 0;
}
.cart-line-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-line-info { flex: 1; }
.cart-line-name { font-weight: 600; font-size: 14px; }
.cart-line-unit { font-size: 11.5px; color: var(--muted); }
.cart-line-price { font-family: var(--font-display); font-weight: 700; font-size: 14px; margin-top: 2px; }
.cart-line-remove { color: var(--sale); font-size: 12px; font-weight: 600; margin-top: 4px; }

.bill-summary {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.bill-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 6px 0;
  color: var(--muted);
}
.bill-row.total {
  color: var(--ink);
  font-weight: 700;
  font-size: 16px;
  border-top: 1px dashed var(--border);
  margin-top: 6px;
  padding-top: 10px;
}

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--primary); outline: none; }

/* ---------------- Payment / QR block ---------------- */
.qr-box {
  background: var(--surface);
  border: 1.5px dashed var(--primary);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}
.qr-box img { width: 200px; height: 200px; margin: 0 auto 12px; border-radius: var(--radius-sm); }
.qr-amount {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  color: var(--primary-dark);
  margin-bottom: 4px;
}
.qr-upi { font-size: 13px; color: var(--muted); word-break: break-all; }

/* ---------------- Order status badges ---------------- */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.badge-pending   { background: #FCF1DC; color: var(--accent-dark); }
.badge-confirmed { background: var(--primary-tint); color: var(--primary-dark); }
.badge-packed    { background: #E4ECF7; color: #2C5AA0; }
.badge-out_for_delivery { background: #E9E4F7; color: #5A3FA0; }
.badge-delivered { background: var(--primary-tint); color: var(--primary-dark); }
.badge-cancelled { background: #FBEAE8; color: var(--sale); }
.badge-paid       { background: var(--primary-tint); color: var(--primary-dark); }
.badge-submitted  { background: #FCF1DC; color: var(--accent-dark); }
.badge-failed     { background: #FBEAE8; color: var(--sale); }

/* ---------------- Empty state ---------------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 10px; }

/* ---------------- Footer ---------------- */
.site-footer {
  margin-top: 40px;
  padding: 24px 16px 90px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------------- Utility ---------------- */
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.hidden { display: none !important; }
