/* Hubie Commerce — storefront del tenant piloto (KING PACKAGING)
   Marca Hubie: Nunito 800/900, Ink #16123a, morado #7c5cfc, rosa #ec4899,
   gradiente 135deg #7c5cfc -> #a855f7 -> #ec4899, fondo #f6f7fb.
   Reglas globales de Julio:
   - sin emojis como iconografía (solo SVG de línea)
   - sin barras de scroll visibles (el scroll sigue funcionando)
   - sin títulos ni texto en azul (todo tinta) */

* { box-sizing: border-box; scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; }

:root {
  --ink: #16123a;
  --purple: #7c5cfc;
  --pink: #ec4899;
  --violet: #a855f7;
  --bg: #f6f7fb;
  --card: #ffffff;
  --muted: #5b5878;
  --border: #e6e4f2;
  --radius: 20px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
h1, h2, h3 { color: var(--ink); }
a { color: var(--ink); }
button, input { font-family: inherit; color: var(--ink); }
button { -webkit-appearance: none; appearance: none; cursor: pointer; }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { text-decoration: none; font-weight: 900; font-size: 22px; letter-spacing: -0.5px; }
.brand-mark {
  background: linear-gradient(135deg, var(--purple), var(--violet), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub { color: var(--ink); font-weight: 800; }
.tenant-badge {
  margin-left: auto;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
}
.cart-btn {
  position: relative;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: none;
}
.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

main { max-width: 1100px; margin: 0 auto; padding: 0 16px 48px; }

.hero {
  background: linear-gradient(135deg, var(--purple), var(--violet), var(--pink));
  color: #fff;
  border-radius: var(--radius);
  padding: 32px 24px;
  margin: 20px 0;
}
.hero h1 { color: #fff; margin: 0 0 8px; font-size: clamp(26px, 6vw, 44px); line-height: 1.1; font-weight: 900; }
.hero p { margin: 0 0 20px; opacity: 0.95; font-weight: 700; }
.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  max-width: 520px;
}
.search-row svg { color: var(--muted); flex: none; }
.search-row input {
  border: 0;
  outline: 0;
  width: 100%;
  font-size: 16px;
  padding: 8px 0;
  background: transparent;
}

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; }
.chip {
  flex: none;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 800;
  font-size: 14px;
}
.chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.results-line { font-weight: 800; font-size: 14px; margin: 0 0 12px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
}
.card img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; padding: 12px; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-body h3 { margin: 0; font-size: 15px; line-height: 1.3; }
.card-cat { font-size: 12px; font-weight: 800; color: var(--purple); text-transform: uppercase; letter-spacing: 0.06em; }
.card-price { font-size: 18px; font-weight: 900; margin-top: auto; }
.card-price small { font-size: 12px; font-weight: 700; color: var(--muted); }
.card-add {
  margin-top: 8px;
  border: 0;
  border-radius: 999px;
  padding: 10px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
}
.empty { text-align: center; font-weight: 700; padding: 32px 0; }
.pager { text-align: center; margin-top: 20px; }
.pager button {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  padding: 12px 24px;
  font-weight: 800;
}

.footer { max-width: 1100px; margin: 0 auto; padding: 0 16px 40px; }
.footer p { margin: 4px 0; }

/* Modal de ficha */
.modal, .drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(22, 18, 58, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-card, .drawer-card {
  background: var(--card);
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  padding: 20px;
  position: relative;
}
.modal-card img { width: 100%; max-height: 280px; object-fit: contain; background: #fff; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  display: grid;
  place-items: center;
}
.modal-body h2 { margin: 12px 0 4px; font-size: 22px; }
.tiers { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
.tiers th, .tiers td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.tiers th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.qty-label, .coupon-label { display: block; font-weight: 800; font-size: 14px; margin: 12px 0 6px; }
.qty-row { display: flex; gap: 8px; align-items: stretch; }
.qty-row button {
  width: 48px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 12px;
  font-size: 20px;
  font-weight: 900;
}
.qty-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
  text-align: center;
}
.calc { font-weight: 800; font-size: 16px; }
.btn-primary {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px;
  font-weight: 900;
  font-size: 16px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  margin-top: 8px;
}

/* Carrito */
.drawer { justify-content: flex-end; }
.drawer-card { border-radius: 24px 0 0 24px; max-height: 100dvh; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head h2 { margin: 0; }
.drawer-head .modal-close { position: static; }
.cart-line {
  display: flex;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.cart-line img { width: 56px; height: 56px; object-fit: contain; flex: none; }
.cart-line .info { flex: 1; min-width: 0; }
.cart-line .info strong { display: block; font-size: 14px; }
.cart-line .info span { font-size: 13px; color: var(--muted); }
.cart-line .qty { display: flex; align-items: center; gap: 6px; }
.cart-line .qty button {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-weight: 900;
}
.cart-line .remove { border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 800; }
.coupon-row { display: flex; gap: 8px; }
.coupon-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
  text-transform: uppercase;
}
.coupon-row button {
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  font-weight: 800;
  background: var(--ink);
  color: #fff;
}
.coupon-msg { font-size: 13px; font-weight: 700; min-height: 18px; margin: 6px 0 0; }
.totals { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; font-weight: 700; }
.totals div.grand { font-size: 18px; font-weight: 900; }

@media (min-width: 700px) {
  .modal, .drawer { align-items: center; padding: 24px; }
  .modal-card { border-radius: 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
