/* ==========================================================
   SHIGRA — app de tienda (compartida por todas las tiendas)
   ========================================================== */
:root {
  --brand: #B8960C;
  --brand-soft: #FFF9E6;
  --ink: #1A1A1A;
  --muted: #666666;
  --line: rgba(0, 0, 0, .1);
  --chip: #F5F5F5;
  --ok: #4CAF50;
  --wa: #25D366;
  --tab-h: 56px;
  --font: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: #fff; }
body { font-family: var(--font); color: var(--ink); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea { font: inherit; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden] { display: none !important; }

/* ---------- Marco: celular centrado en escritorio ---------- */
.shell { min-height: 100vh; display: flex; justify-content: center; }
.side { display: none; }
.phone { position: relative; width: 100%; min-height: 100vh; display: flex; flex-direction: column; background: #fff; }
@media (min-width: 1024px) {
  body { background: #F9FAFB; }
  .shell { align-items: center; gap: 32px; padding: 24px; }
  .side { display: block; flex: 1; max-width: 320px; }
  .side--left { text-align: right; }
  .phone { flex: 0 0 390px; min-height: 0; height: min(844px, calc(100vh - 48px)); border-radius: 20px; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,.25); }
}
.side h2 { font-size: 1.5rem; font-weight: 500; color: var(--brand); margin-bottom: 8px; }
.side h3 { font-size: 1.25rem; font-weight: 500; color: #C17A2A; margin-bottom: 16px; }
.side p { color: var(--muted); font-size: .9rem; margin-bottom: 8px; }
.promo { background: var(--brand-soft); border-radius: 10px; padding: 14px 16px; font-size: .88rem; margin-bottom: 12px; }

/* ---------- Header de tienda ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #fff; border-bottom: 1px solid color-mix(in srgb, var(--brand) 12%, transparent); }
.top__logo { width: 48px; height: 48px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; overflow: hidden; flex-shrink: 0; }
.top__logo img { width: 100%; height: 100%; object-fit: cover; }
.top__logo .i { width: 24px; height: 24px; }
.top__name { font-size: 1.35rem; font-weight: 700; line-height: 1.15; color: var(--brand); }
.top__url { font-size: .75rem; color: #9CA3AF; }

/* ---------- Contenido y tabbar ---------- */
.main { flex: 1; overflow-y: auto; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); }
@media (min-width: 1024px) { .tabs { position: absolute; } }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--muted); position: relative; }
.tab.is-active { color: var(--brand); }
.tab.is-active .i { stroke-width: 2.5; }
.tab__badge { position: absolute; top: 6px; left: calc(50% + 4px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 10px; display: grid; place-items: center; }

.powered { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px; border-top: 1px solid rgba(0,0,0,.05); font-size: .75rem; color: #9CA3AF; font-weight: 300; }
.powered img { height: 16px; width: auto; opacity: .7; }

/* ---------- Bloques comunes ---------- */
.pad { padding: 16px; }
.page-title { padding: 16px; border-bottom: 1px solid var(--line); font-size: 1.25rem; font-weight: 500; }
.section-title { font-size: 18px; font-weight: 300; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.price { color: var(--brand); font-weight: 500; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 15px; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 500; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; }
.btn--outline { background: #fff; color: var(--brand); border: 1px solid var(--brand); font-weight: 400; }
.btn--wa { background: var(--wa); }
.btn--inline { display: inline-flex; width: auto; padding: 12px 24px; border-radius: 10px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { padding: 8px 16px; border-radius: 999px; white-space: nowrap; font-size: .875rem; background: var(--chip); }
.chip.is-on { background: var(--brand); color: #fff; font-weight: 500; }

/* ---------- Productos ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { border: 1px solid rgba(0,0,0,.08); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.card__img { aspect-ratio: 1; background: #F3F4F6; overflow: hidden; }
.card__img img { width: 100%; height: 100%; object-fit: cover; }
.card__body { padding: 10px 12px 12px; display: grid; gap: 4px; }
.card__name { font-size: .875rem; line-height: 1.3; }
.card__row { display: flex; align-items: center; justify-content: space-between; }
.plus { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; transition: transform .1s; }
.plus:active { transform: scale(.9); }
.plus .i { width: 16px; height: 16px; }
.noimg { width: 100%; height: 100%; display: grid; place-items: center; color: #D1D5DB; }
.noimg .i { width: 40px; height: 40px; stroke-width: 1.5; }

.banner { position: relative; height: 220px; }
.banner img { width: 100%; height: 100%; object-fit: cover; }
.banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(255,255,255,.85), rgba(255,255,255,0) 50%); }

.search { position: relative; margin-top: 14px; }
.search .i { position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: #9CA3AF; }
.search input { width: 100%; padding: 12px 16px 12px 40px; border: 1px solid var(--line); border-radius: 10px; background: #F9F9F9; outline: none; }
.search input:focus { border-color: var(--brand); background: #fff; }

/* ---------- Detalle ---------- */
.back { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: #374151; width: 100%; }
.detail__img { aspect-ratio: 1; background: #F3F4F6; }
.detail__img img { width: 100%; height: 100%; object-fit: cover; }
.detail { padding: 24px; display: grid; gap: 22px; }
.detail h1 { font-size: 1.5rem; font-weight: 500; }
.detail .big { font-size: 1.9rem; color: var(--brand); }
.label { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.qty { display: flex; align-items: center; gap: 16px; }
.qty button { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--brand); color: var(--brand); }
.qty button.fill { background: var(--brand); color: #fff; }
.qty span { font-size: 1.5rem; min-width: 3rem; text-align: center; }
.soft { background: var(--brand-soft); border-radius: 10px; padding: 16px; display: flex; justify-content: space-between; align-items: center; }

/* ---------- Carrito ---------- */
.line { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.line__img { width: 80px; height: 80px; border-radius: 8px; overflow: hidden; background: #F3F4F6; flex-shrink: 0; }
.line__img img { width: 100%; height: 100%; object-fit: cover; }
.line__mid { flex: 1; min-width: 0; }
.line__end { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }
.mini-qty { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.mini-qty button { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--brand); color: var(--brand); }
.mini-qty button.fill { background: var(--brand); color: #fff; }
.mini-qty .i { width: 12px; height: 12px; }
.trash { color: #EF4444; }
.box { border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 10px; }
.row { display: flex; justify-content: space-between; font-size: .9rem; }
.row--total { border-top: 1px solid var(--line); padding-top: 10px; font-size: 1rem; }
.row--total b { color: var(--brand); font-size: 1.25rem; font-weight: 500; }
.pay { width: 100%; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.pay.is-on { border-color: var(--brand); background: var(--brand-soft); }
.field { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; resize: none; }
.field:focus { border-color: var(--brand); }
.stack { display: grid; gap: 10px; }
.sticky-cta { position: sticky; bottom: 0; background: #fff; padding: 12px 16px 16px; border-top: 1px solid rgba(0,0,0,.08); box-shadow: 0 -4px 12px rgba(0,0,0,.06); }
.error { color: #EF4444; font-size: .88rem; text-align: center; }

/* ---------- Estados ---------- */
.state { min-height: 60vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.state__icon { width: 96px; height: 96px; border-radius: 50%; background: var(--chip); color: #9CA3AF; display: grid; place-items: center; margin: 0 auto 16px; }
.state__icon .i { width: 48px; height: 48px; }
.state h2 { font-size: 1.25rem; font-weight: 500; margin-bottom: 8px; }
.state p { color: var(--muted); margin-bottom: 24px; }
.spinner { width: 32px; height: 32px; border: 2px solid var(--brand); border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

.ok-icon { width: 96px; height: 96px; border-radius: 50%; background: #E8F5E9; color: var(--ok); display: grid; place-items: center; margin: 0 auto 20px; animation: pop .4s ease-out; }
.ok-icon .i { width: 60px; height: 60px; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } }
.order-no { background: var(--brand-soft); border-radius: 10px; padding: 20px; text-align: center; }
.order-no b { display: block; font-size: 2rem; font-weight: 500; color: var(--brand); }
.eta { background: #E3F2FD; border-radius: 10px; padding: 16px; text-align: center; }
.eta b { display: block; color: #1976D2; font-size: 1.25rem; font-weight: 500; }

.order { border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 12px; }
.order__top { display: flex; justify-content: space-between; align-items: start; }
.status { font-size: .75rem; padding: 4px 12px; border-radius: 999px; background: #FFF3E0; color: #E65100; }
.status--accepted, .status--on_the_way { background: #E3F2FD; color: #1565C0; }
.status--delivered { background: #E8F5E9; color: #2E7D32; }
.status--cancelled { background: #F3F4F6; color: #6B7280; }

/* ---------- Toast y flash ---------- */
.toast { position: fixed; left: 50%; top: 16px; translate: -50% -150%; z-index: 100; background: #fff; color: var(--ink); border: 1px solid #BBF7D0; border-left: 4px solid var(--ok); padding: 12px 18px; border-radius: 10px; box-shadow: 0 10px 25px rgba(0,0,0,.12); font-size: .9rem; transition: translate .3s ease; max-width: calc(100vw - 32px); }
.toast.is-on { translate: -50% 0; }
.flash { position: fixed; inset: 0; z-index: 90; pointer-events: none; background: color-mix(in srgb, var(--brand) 18%, transparent); animation: flash .4s ease-out forwards; }
@keyframes flash { to { opacity: 0; } }
