:root {
  --green-900: #1b5e20;
  --green-700: #2e7d32;
  --green-500: #43a047;
  --green-050: #e8f5e9;
  --ink: #1c2520;
  --ink-soft: #5a6b60;
  --paper: #fafdf9;
  --card: #ffffff;
  --line: #e2eae3;
  --danger: #c62828;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(27, 94, 32, 0.08);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--green-900);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}
.brand-icon { font-size: 22px; }
.brand-ca {
  font-size: 11px;
  font-weight: 600;
  color: #c8e6c9;
  display: block;
  text-align: left;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.search-wrap { flex: 1; min-width: 0; }
.search-wrap input {
  width: 100%;
  padding: 9px 14px;
  border-radius: 999px;
  border: 0;
  background: rgba(255,255,255,0.94);
  outline: none;
}
.lang-button {
  background: rgba(255,255,255,0.14);
  border: 0;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 12px;
  border-radius: 12px;
  white-space: nowrap;
}
.cart-button {
  position: relative;
  background: rgba(255,255,255,0.14);
  border: 0;
  color: #fff;
  font-size: 20px;
  padding: 8px 12px;
  border-radius: 12px;
}
.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ffb300;
  color: #4e2f00;
  font-size: 12px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ---------- names preference strip ---------- */
.names-pref {
  max-width: 960px;
  margin: 10px auto -6px;
  padding: 0 14px;
}
.names-pref .checkbox-line {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}

/* ---------- layout ---------- */
main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 18px 14px 60px; }
.view h1 { font-size: 24px; margin-bottom: 4px; }
.view h2 { font-size: 18px; margin: 18px 0 10px; }
.muted { color: var(--ink-soft); font-size: 14px; }

.hero {
  background: linear-gradient(135deg, var(--green-900), var(--green-500));
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 20px;
}
.hero h1 { font-size: 24px; margin-bottom: 6px; }
.hero p { color: #e2f3e4; font-size: 14px; max-width: 520px; }

/* ---------- store cards ---------- */
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.store-card {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.store-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(27,94,32,0.14); }
.store-emoji {
  font-size: 28px;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green-050);
  flex-shrink: 0;
}
.store-card h3 { font-size: 16px; }
.store-card .tagline { color: var(--ink-soft); font-size: 13px; margin: 2px 0 6px; }
.store-card .meta { font-size: 12px; color: var(--ink-soft); }

/* ---------- store page ---------- */
.back-btn {
  background: none;
  border: 0;
  color: var(--green-700);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 0;
  margin-bottom: 10px;
}
.store-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 6px; }
.call-btn {
  display: inline-block;
  margin-top: 8px;
  background: var(--green-700);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
}
.call-btn:active { background: var(--green-900); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}
.chip.active { background: var(--green-700); border-color: var(--green-700); color: #fff; }

/* ---------- product cards ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.product-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow);
}
.product-card .p-img {
  width: 100%;
  height: 110px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}
.product-card .p-name { font-size: 14px; font-weight: 600; min-height: 2.4em; }
.product-card .p-store { font-size: 11px; color: var(--ink-soft); }
.product-card .p-price { font-size: 15px; font-weight: 800; color: var(--green-900); }
.product-card .p-price span { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.add-btn {
  margin-top: auto;
  background: var(--green-700);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 9px 0;
  font-size: 14px;
  font-weight: 700;
}
.add-btn:active { background: var(--green-900); }

/* qty stepper */
.stepper {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--green-050);
  border-radius: 10px;
  overflow: hidden;
}
.stepper button {
  border: 0;
  background: var(--green-700);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  width: 34px;
  height: 36px;
}
.stepper .qty { font-size: 14px; font-weight: 700; color: var(--green-900); }

/* ---------- cart drawer ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 22, 0.45);
  z-index: 60;
}
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background: var(--paper);
  z-index: 70;
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 24px rgba(0,0,0,0.2);
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.drawer-head h2 { font-size: 18px; }
.icon-btn { background: none; border: 0; font-size: 18px; color: var(--ink-soft); padding: 4px 8px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.drawer-foot { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--card); }

.cart-store-group { margin-bottom: 18px; }
.cart-store-group h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--green-900);
  border-bottom: 2px solid var(--green-050);
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.cart-line { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.cart-line .c-info { flex: 1; min-width: 0; }
.cart-line .c-name { font-size: 14px; font-weight: 600; }
.cart-line .c-unit { font-size: 12px; color: var(--ink-soft); }
.cart-line .c-sum { font-size: 14px; font-weight: 700; white-space: nowrap; }
.cart-line .stepper { margin: 0; flex-shrink: 0; }
.cart-line .stepper button { width: 28px; height: 30px; font-size: 15px; }
.cart-line .qty { min-width: 42px; text-align: center; font-size: 13px; }

.total-row { display: flex; justify-content: space-between; font-size: 14px; padding: 3px 0; color: var(--ink-soft); }
.total-row.grand { font-size: 18px; font-weight: 800; color: var(--ink); padding-top: 8px; }
.cta {
  width: 100%;
  margin-top: 10px;
  background: var(--green-700);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  font-weight: 800;
}
.cta:disabled { opacity: 0.5; cursor: default; }
.cta.secondary { background: var(--green-050); color: var(--green-900); }

.empty-cart { text-align: center; color: var(--ink-soft); padding: 40px 10px; }
.empty-cart .big { font-size: 44px; margin-bottom: 10px; }

/* ---------- checkout ---------- */
.checkout-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.checkout-card h3 { font-size: 15px; margin-bottom: 12px; color: var(--green-900); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green-500); }
.field textarea { resize: vertical; min-height: 70px; }
.option-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.option-row.three { grid-template-columns: 1fr 1fr 1fr; }
.option-pill {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: center;
}
.option-pill.active { border-color: var(--green-700); background: var(--green-050); color: var(--green-900); }
.option-pill small { display: block; font-weight: 500; font-size: 11px; margin-top: 3px; }
.checkbox-line { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.checkbox-line input { width: 18px; height: 18px; accent-color: var(--green-700); }
.form-error { color: var(--danger); font-size: 14px; font-weight: 600; margin: 8px 0; min-height: 1em; }

/* ---------- confirmation ---------- */
.confirm-box { text-align: center; padding: 40px 16px; }
.confirm-box .big { font-size: 64px; }
.confirm-box h1 { margin: 12px 0 6px; }
.order-number { font-size: 22px; font-weight: 800; color: var(--green-900); margin: 8px 0 16px; }

/* ---------- account / order history ---------- */
.status-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--green-050);
  color: var(--green-900);
}
.status-pill.new { background: #fff3e0; color: #e65100; }
.status-pill.canceled { background: #ffebee; color: var(--danger); }
.order-hist-line { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.acc-order-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.acc-switch { background: none; border: 0; color: var(--green-700); font-weight: 700; font-size: 14px; padding: 6px 0; text-decoration: underline; }

/* ---------- toast / footer ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 90;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  max-width: 90vw;
  text-align: center;
}
.site-footer { text-align: center; padding: 20px 14px 30px; color: var(--ink-soft); font-size: 12px; }

/* ---------- RTL (Hebrew) ---------- */
[dir="rtl"] .brand-text,
[dir="rtl"] .brand-ca,
[dir="rtl"] .store-card,
[dir="rtl"] .store-card h3,
[dir="rtl"] .field label,
[dir="rtl"] .checkout-card {
  text-align: right;
}
[dir="rtl"] .cart-drawer {
  right: auto;
  left: 0;
  box-shadow: 6px 0 24px rgba(0,0,0,0.2);
}

@media (max-width: 560px) {
  .brand-text .brand-ca { display: none; }
  .brand-text { font-size: 15px; }
  main { padding: 14px 10px 50px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
}
