/* ===== FlowyMarket: tienda pública ===== */
:root {
  --primary: #e0457b; --on-primary: #fff; --bg: #fdeef2; --text: #c2185b;
  --surface: #fff7f9; --line: #f3d3dd; --muted: #c86a8d; --soft: #fbe0e9;
  --font: 'Poppins', system-ui, sans-serif; --radius: 18px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
body.has-bg-image { background-size: cover; background-position: center; background-attachment: fixed; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.page { max-width: 760px; margin: 0 auto; background: var(--bg); min-height: 100vh; position: relative; box-shadow: 0 0 0 1px var(--line); }
body.has-bg-image .page { background: color-mix(in srgb, var(--bg) 92%, transparent); }

.banner-paused { background: #2b2b2b; color: #fff; text-align: center; padding: 10px 16px; font-size: 14px; }
.banner-preview { background: var(--primary); color: var(--on-primary); text-align: center; padding: 6px; font-size: 12px; letter-spacing: .02em; }

/* ----- Hero ----- */
.hero { position: relative; color: #fff; text-align: center; padding: 56px 24px 48px; overflow: hidden;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 45%, #000)); }
.hero.has-image { background-size: cover; background-position: center; }
.hero::before { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, var(--ov, 0)); }
.hero.tint-light { color: #111; }
.hero.tint-light::before { background: rgba(255, 255, 255, var(--ov, 0)); }
.hero > * { position: relative; }
.hero-logo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin: 0 auto 14px; border: 3px solid rgba(255, 255, 255, .85); background: #fff; }
.hero h1 { margin: 0 0 10px; font-size: clamp(26px, 6vw, 38px); font-weight: 700; letter-spacing: -.01em; }
.hero p { margin: 0 auto; max-width: 620px; font-size: clamp(15px, 3.6vw, 19px); line-height: 1.45; opacity: .96; white-space: pre-line; }

/* ----- Barra del catálogo ----- */
.catbar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.catbar-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.icon-btn { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--soft); color: var(--primary);
  display: grid; place-items: center; transition: transform .15s; }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 22px; height: 22px; }
.chips { position: relative; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; scroll-behavior: smooth; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 10px 18px; border-radius: 999px; border: 1px solid transparent; background: transparent;
  color: var(--text); font-weight: 600; font-size: 15px; white-space: nowrap; }
.chip.active { border-color: var(--primary); color: var(--primary); background: var(--surface); }
.searchbox { display: none; padding: 0 14px 12px; }
.searchbox.open { display: block; }
.searchbox input { width: 100%; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); outline: none; }
.searchbox input:focus { border-color: var(--primary); }
.tools { display: flex; gap: 8px; padding: 0 14px 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 14px; }
.pill svg { width: 16px; height: 16px; }
.pill.on { border-color: var(--primary); color: var(--primary); }

/* ----- Productos ----- */
.cat-section { scroll-margin-top: 140px; }
.cat-title { margin: 0; padding: 18px 16px 6px; font-size: 19px; font-weight: 700; }
.products.list .card { display: flex; gap: 14px; padding: 16px; border-bottom: 1px solid var(--line); background: none; border-radius: 0; width: 100%; text-align: left; border-left: 0; border-right: 0; border-top: 0; }
.products.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 10px 14px 18px; }
.products.grid .card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-align: left; padding: 0; }
.card { color: inherit; position: relative; }
.card:disabled { cursor: default; }
.thumb { flex: none; width: 96px; height: 96px; border-radius: calc(var(--radius) * .6); background: color-mix(in srgb, var(--text) 10%, #e6e6e6); overflow: hidden; display: grid; place-items: center; color: #6a6a6a; }
.products.grid .thumb { width: 100%; height: auto; aspect-ratio: 1; border-radius: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb svg { width: 34px; height: 34px; }
.card-body { min-width: 0; flex: 1; }
.products.grid .card-body { padding: 10px 12px 14px; }
.card h3 { margin: 2px 0 6px; font-size: 16px; font-weight: 600; }
.card p { margin: 0 0 8px; font-size: 13.5px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-weight: 600; font-size: 15.5px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.price s { color: var(--muted); font-weight: 400; font-size: 13.5px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--primary); color: var(--on-primary); }
.badge.gray { background: #8a8a8a; color: #fff; }
.card .badge { position: absolute; top: 10px; right: 10px; }
.card.soldout { opacity: .55; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ----- Otros bloques ----- */
.block-text { padding: 26px 22px; text-align: center; line-height: 1.55; font-size: 15.5px; white-space: pre-line; }
.block-image { padding: 12px 14px; }
.block-image img { width: 100%; border-radius: var(--radius); }
.block-image a { display: block; }
.block-wa { padding: 16px; text-align: center; }
.block-divider { height: 1px; background: var(--line); margin: 14px 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 22px; border: 0; border-radius: var(--radius);
  background: var(--primary); color: var(--on-primary); font-weight: 600; font-size: 15.5px; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn.wa { background: #25d366; color: #fff; }
.footer { text-align: center; padding: 26px 16px 110px; font-size: 12.5px; color: var(--muted); }
.footer a { color: inherit; }

/* ----- Carrito flotante ----- */
.cart-fab { position: fixed; right: max(18px, calc(50% - 380px + 18px)); bottom: 22px; z-index: 30; width: 60px; height: 60px; border-radius: 50%; border: 0;
  background: var(--primary); color: var(--on-primary); box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 45%, transparent); display: grid; place-items: center; }
.cart-fab svg { width: 26px; height: 26px; }
.cart-fab .count { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #111; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.cart-fab.bump { animation: bump .35s; }
@keyframes bump { 50% { transform: scale(1.15); } }

/* ----- Modales / hojas ----- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; background: var(--bg); color: var(--text); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; animation: up .25s ease-out; overflow: hidden; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 22px; } }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 18px; flex: 1; }
.sheet-body { overflow-y: auto; padding: 16px; flex: 1; }
.sheet-foot { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.close-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--soft); color: var(--text); font-size: 20px; line-height: 1; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .45); animation: fade .2s; }
.drawer { position: absolute; left: 0; top: 0; bottom: 0; width: min(320px, 86vw); background: var(--bg); padding: 18px; overflow-y: auto; animation: slide .25s ease-out; }
@keyframes slide { from { transform: translateX(-30px); opacity: .4; } }
.drawer h2 { margin: 6px 0 14px; font-size: 18px; }
.drawer button.link { display: block; width: 100%; text-align: left; padding: 13px 12px; border: 0; border-radius: 12px; background: none; font-weight: 500; font-size: 16px; }
.drawer button.link:hover { background: var(--soft); }

/* Producto */
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 8px; margin: -16px -16px 14px; scrollbar-width: none; }
.gallery img { flex: none; width: 100%; aspect-ratio: 1; object-fit: cover; scroll-snap-align: center; }
.gallery.single img { aspect-ratio: 4 / 3; }
.p-title { margin: 0 0 6px; font-size: 21px; }
.p-desc { margin: 0 0 12px; color: var(--muted); line-height: 1.5; white-space: pre-line; }
.opt-group { margin: 18px 0; }
.opt-group h4 { margin: 0 0 8px; font-size: 15px; display: flex; justify-content: space-between; gap: 10px; }
.opt-group h4 small { font-weight: 500; color: var(--muted); font-size: 12px; }
.opt-group h4 small.req { color: var(--primary); }
.opt { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: calc(var(--radius) * .6); margin-bottom: 6px; background: var(--surface); }
.opt input { accent-color: var(--primary); width: 18px; height: 18px; }
.opt span { flex: 1; }
.opt.disabled { opacity: .5; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.qty button { width: 38px; height: 38px; border: 0; background: none; font-size: 18px; color: var(--primary); }
.qty span { min-width: 26px; text-align: center; font-weight: 600; }
.foot-row { display: flex; gap: 12px; align-items: center; }
.foot-row .btn { flex: 1; }

/* Carrito */
.line { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line .thumb { width: 60px; height: 60px; }
.line-info { flex: 1; min-width: 0; }
.line-info b { display: block; font-size: 15px; }
.line-info small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.line-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.line .qty button { width: 30px; height: 30px; font-size: 16px; }
.totals { margin-top: 14px; display: grid; gap: 6px; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-weight: 700; font-size: 17px; padding-top: 6px; border-top: 1px dashed var(--line); }
.muted { color: var(--muted); font-size: 13px; }

/* Formulario de pedido */
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13.5px; font-weight: 600; }
.field input, .field textarea, .field select { width: 100%; padding: 12px 14px; border-radius: calc(var(--radius) * .6); border: 1px solid var(--line); background: var(--surface); outline: none; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 14px; }
.seg label { display: flex; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: calc(var(--radius) * .6); background: var(--surface); font-size: 14px; cursor: pointer; }
.seg input { accent-color: var(--primary); }
.seg label:has(input:checked) { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.section-title { font-size: 15px; font-weight: 700; margin: 18px 0 10px; }
.error-box { background: #fde8e8; color: #9b1c1c; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.done { text-align: center; padding: 10px 0; }
.done .big { font-size: 46px; }
.done h3 { margin: 6px 0; font-size: 21px; }
.transfer-box { background: var(--surface); border: 1px dashed var(--primary); border-radius: 12px; padding: 12px; text-align: left; white-space: pre-line; font-size: 14px; margin: 12px 0; }

/* Filtros */
.range-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.check input { accent-color: var(--primary); width: 18px; height: 18px; }
.radio-list label { display: flex; gap: 10px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.radio-list input { accent-color: var(--primary); width: 18px; height: 18px; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #1b1b1b; color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; z-index: 80; box-shadow: var(--shadow); max-width: 90vw; text-align: center; }
