/* =====================================================================
   Page-level pieces: landing hero, shop cards, product cards,
   order cards, wallet, rider queue.
   ===================================================================== */

/* -------------------------------------------------------------- landing */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(760px 420px at 88% -12%, rgba(255, 255, 255, 0.2), transparent 62%),
    var(--brand-gradient);
  color: #fff;
  padding: 54px 0 62px;
}
@media (max-width: 560px) {
  .hero { padding: 32px 0 50px; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
}
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 46px;
  background: var(--page);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  transform: scaleX(1.5);
}
.hero-inner { position: relative; z-index: 1; max-width: 660px; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.18);
  font-size: var(--t-xs);
  font-weight: 700;
  margin-bottom: 16px;
}
.hero h1 {
  color: #fff;
  font-size: clamp(1.8rem, 5.2vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
}
.hero p {
  color: rgba(255, 255, 255, 0.88);
  font-size: var(--t-md);
  margin-top: 12px;
  max-width: 52ch;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.hero-facts {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  margin-top: 30px;
  position: relative;
  z-index: 1;
}
.hero-fact-value { font-size: var(--t-xl); font-weight: 800; color: #fff; letter-spacing: -0.02em; }
.hero-fact-label { font-size: var(--t-xs); color: rgba(255, 255, 255, 0.76); font-weight: 600; }

.section { padding: 40px 0; }
.section-tight { padding: 26px 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--line); }

.step-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 18px;
  position: relative;
  transition: transform var(--med), box-shadow var(--med);
}
.step-card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.step-num {
  position: absolute;
  top: 14px; right: 16px;
  font-size: var(--t-2xl);
  font-weight: 800;
  color: var(--surface-3);
  line-height: 1;
}
.step-ic {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: var(--brand-soft);
  color: var(--brand-strong);
  display: grid; place-items: center;
  margin-bottom: 13px;
}

.cat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 15px 8px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: var(--t-xs);
  font-weight: 650;
  text-align: center;
  transition: all var(--med);
}
.cat-tile:hover {
  border-color: var(--brand-300);
  color: var(--brand-deep);
  transform: translateY(-2px);
  box-shadow: var(--sh-2);
}
.cat-emoji { font-size: 26px; line-height: 1; }

.role-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.role-card-top {
  padding: 18px;
  color: #fff;
  background: var(--brand-gradient);
}
.role-card.is-shop  .role-card-top { background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700)); }
.role-card.is-rider .role-card-top { background: linear-gradient(135deg, var(--orange-400), var(--orange-600)); }
.role-card-top h3 { color: #fff; }
.role-card-top p { color: rgba(255, 255, 255, 0.85); font-size: var(--t-sm); margin-top: 3px; }
.role-card-body { padding: 18px; flex: 1 1 auto; }
.role-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.role-list li { display: flex; gap: 9px; align-items: flex-start; font-size: var(--t-sm); color: var(--ink-soft); }
.role-list .icon { color: var(--ok-500); margin-top: 2px; }

/* ----------------------------------------------------------- shop cards */

.shop-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  min-width: 0;
  width: 100%;
  transition: transform var(--med), box-shadow var(--med), border-color var(--med);
}
.shop-card:hover { transform: translateY(-3px); box-shadow: var(--sh-3); border-color: var(--brand-300); }
.shop-card.is-far { opacity: 0.72; }
.shop-card.is-far:hover { transform: none; }
.shop-card-hit {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.shop-card-hit:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

.shop-card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(120px 80px at 80% 20%, rgba(255, 255, 255, 0.55), transparent 70%),
    var(--brand-soft);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.shop-card-media img { width: 100%; height: 100%; object-fit: cover; }
.shop-card-media .shop-emoji { font-size: 42px; line-height: 1; filter: drop-shadow(0 2px 0 rgba(255,255,255,0.4)); }
.shop-card-media.has-photo::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 46%;
  background: linear-gradient(to top, rgba(10, 15, 22, 0.45), transparent);
  pointer-events: none;
}

.shop-card-flags {
  position: absolute;
  top: 9px; left: 9px;
  display: flex;
  gap: 6px;
  z-index: 2;
  flex-wrap: wrap;
  max-width: calc(100% - 56px);
  pointer-events: none;
}
.shop-card-fav {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 3;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  display: grid; place-items: center;
  color: var(--ink-faint);
  box-shadow: var(--sh-1);
  transition: all var(--fast);
}
.shop-card-fav:hover { transform: scale(1.08); }
.shop-card-fav.is-on { color: var(--bad-500); }
.shop-card-fav.is-on .icon { fill: currentColor; }

.shop-card-dist {
  position: absolute;
  bottom: 8px; left: 9px;
  z-index: 2;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: rgba(10, 15, 22, 0.58);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.shop-card-body { padding: 12px 13px; display: flex; flex-direction: column; gap: 7px; flex: 1 1 auto; min-width: 0; }
.shop-card-name { font-size: var(--t-base); font-weight: 750; letter-spacing: -0.015em; }
.shop-card-meta {
  font-size: var(--t-xs);
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.shop-card-meta > span { min-width: 0; }
.shop-card-offers { display: flex; gap: 5px; flex-wrap: wrap; }
.shop-card-foot {
  margin-top: auto;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.shop-card-foot .hours {
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42%;
}

.cat-tile span:last-child {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.3em;
  line-height: 1.25;
}

/* Shop detail hero — name and logo sit on the green banner */
.store-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.store-banner {
  position: relative;
  background:
    radial-gradient(420px 180px at 100% 0%, rgba(255, 255, 255, 0.18), transparent 60%),
    var(--brand-gradient);
  padding: 22px 18px;
  min-height: 118px;
  display: flex;
  align-items: center;
}
.store-banner.has-photo > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.store-banner.has-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 83, 61, 0.88), rgba(7, 83, 61, 0.55));
}
.store-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
}
.store-head-main { flex: 1 1 180px; min-width: 0; }
.store-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.store-title-row h1 { margin: 0; color: #fff; min-width: 0; overflow-wrap: anywhere; }
.store-sub {
  margin-top: 3px;
  font-size: var(--t-sm);
  color: rgba(255, 255, 255, 0.86);
}
.store-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  margin-left: auto;
}

.store-logo {
  width: 64px; height: 64px;
  border-radius: var(--r-md);
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: #fff;
  object-fit: cover;
  display: grid;
  place-items: center;
  font-size: 30px;
  flex: 0 0 auto;
  line-height: 1;
}

.store-hero-body { padding: 12px 18px 14px; }
.store-meta-row {
  display: flex;
  gap: 14px 18px;
  flex-wrap: wrap;
  font-size: var(--t-sm);
  color: var(--ink-soft);
}
.store-meta-row > div {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

@media (max-width: 640px) {
  .store-banner { padding: 16px 14px; align-items: stretch; }
  .store-head { flex-wrap: wrap; align-items: flex-start; }
  .store-head-main { flex: 1 1 0; }
  .store-head-actions { width: 100%; margin-left: 0; }
  .store-head-actions .btn { flex: 1 1 auto; justify-content: center; }
  .store-logo { width: 52px; height: 52px; font-size: 24px; }
}

/* -------------------------------------------------------- product cards */

.product-list { display: flex; flex-direction: column; gap: 0; }
.product-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.product-row:last-child { border-bottom: 0; }
.product-thumb {
  width: 72px; height: 72px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  overflow: hidden;
  flex: 0 0 auto;
}
.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.product-name { font-weight: 700; font-size: var(--t-base); }
.product-unit { font-size: var(--t-xs); color: var(--ink-muted); }
.product-price { display: flex; align-items: baseline; gap: 7px; margin-top: 3px; }
.product-price .now { font-weight: 800; font-size: var(--t-base); }
.product-price .was { font-size: var(--t-xs); color: var(--ink-faint); text-decoration: line-through; }
.product-off {
  font-size: 10px;
  font-weight: 800;
  color: var(--ok-700);
  background: var(--ok-50);
  padding: 1px 6px;
  border-radius: 4px;
}
.product-action { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.product-row.is-out { opacity: 0.55; }

/* Product grid used in the shop owner catalogue */
.catalog-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto auto;
  gap: 14px 16px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.catalog-row:last-child { border-bottom: 0; }
.catalog-row:hover { background: var(--surface-2); }
.catalog-row.is-off { opacity: 0.6; }
.catalog-row .grow { min-width: 0; }
.catalog-row .product-name,
.catalog-row .product-unit { overflow: hidden; text-overflow: ellipsis; }
.catalog-row .product-price { flex-wrap: wrap; }

@media (max-width: 900px) {
  .catalog-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }
  .catalog-row > .nowrap,
  .catalog-row > .row {
    grid-column: 2;
    justify-self: start;
  }
}

/* ---------------------------------------------------------- order cards */

.order-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: box-shadow var(--med), border-color var(--med);
}
.order-card:hover { box-shadow: var(--sh-2); }
.order-card.is-new { border-color: var(--orange-300); box-shadow: 0 0 0 3px rgba(244, 98, 31, 0.12); }
.order-card.is-live { border-color: var(--brand-300); }

.order-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.order-num { font-weight: 800; font-size: var(--t-base); letter-spacing: -0.01em; }
.order-when { font-size: var(--t-xs); color: var(--ink-muted); }
.order-head-right { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.order-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 13px; }

.order-party {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.order-items-mini { display: flex; flex-direction: column; gap: 6px; }
.order-item-mini {
  display: flex;
  gap: 10px;
  font-size: var(--t-sm);
  color: var(--ink-soft);
}
.order-item-mini .oi-name { flex: 1 1 auto; min-width: 0; }
.order-item-mini .oi-qty { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.order-item-mini .oi-amt { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }

.order-facts {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--t-xs);
  color: var(--ink-muted);
}
.order-facts strong { color: var(--ink); font-weight: 700; }

.order-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.order-foot .grow { min-width: 120px; }

/* Delivery PIN callout */
.pin-card {
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--brand-soft);
  border: 1px dashed var(--brand-300);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------- wallet card */

.wallet-hero {
  border-radius: var(--r-lg);
  padding: 20px;
  color: #fff;
  background: var(--brand-gradient);
  position: relative;
  overflow: hidden;
}
.wallet-hero.is-negative { background: linear-gradient(135deg, var(--bad-500), #7f1d1d); }
.wallet-hero::after {
  content: "";
  position: absolute;
  top: -40px; right: -30px;
  width: 170px; height: 170px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}
.wallet-label {
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.78);
}
.wallet-amount {
  font-size: var(--t-3xl);
  font-weight: 850;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.wallet-note { font-size: var(--t-sm); color: rgba(255, 255, 255, 0.85); margin-top: 6px; }
.wallet-actions { display: flex; gap: 9px; margin-top: 16px; flex-wrap: wrap; position: relative; z-index: 1; }

.ledger-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.ledger-row:last-child { border-bottom: 0; }
.ledger-ic {
  width: 32px; height: 32px;
  border-radius: var(--r-xs);
  display: grid; place-items: center;
}
.ledger-ic.is-credit { background: var(--ok-50);  color: var(--ok-700); }
.ledger-ic.is-debit  { background: var(--bad-50); color: var(--bad-700); }
.ledger-amt { font-weight: 750; font-variant-numeric: tabular-nums; text-align: right; }

/* ---------------------------------------------------------- rider queue */

.rider-hero {
  border-radius: var(--r-lg);
  padding: 18px;
  background: var(--brand-gradient);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.rider-hero .rider-hero-name { font-size: var(--t-lg); font-weight: 800; color: #fff; }
.rider-hero-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}
.rider-hero-stat-value { font-size: var(--t-lg); font-weight: 800; color: #fff; }
.rider-hero-stat-label { font-size: 10.5px; color: rgba(255, 255, 255, 0.8); font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; }

.queue-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: #fff;
  font-size: var(--t-xs);
  font-weight: 800;
}

.duty-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
}

/* ---------------------------------------------------- QR scanner sheet */

#qr-reader { border-radius: var(--r-md); overflow: hidden; }
#qr-reader video { width: 100% !important; border-radius: var(--r-md); }
.qr-guide {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--slate-900);
  min-height: 250px;
  display: grid;
  place-items: center;
}
.qr-scanline {
  position: absolute;
  left: 8%; right: 8%;
  height: 2px;
  background: var(--brand-300);
  box-shadow: 0 0 12px var(--brand);
  animation: scanline 2s ease-in-out infinite alternate;
}
@keyframes scanline { from { top: 16%; } to { bottom: 16%; top: auto; } }

/* --------------------------------------------------------- print styles */

@media print {
  .topbar, .tabbar, .panel-side, .panel-top, .site-foot,
  .btn, .toast-host, .announce, .cart-fab { display: none !important; }
  body { background: #fff; }
  .card, .qr-frame { box-shadow: none; border-color: #ccc; }
  .panel { grid-template-columns: 1fr; }
  .panel-content { padding: 0; }
}
