/* =============================================================
   Catálogo público — estilos mobile-first, tema claro.
   ============================================================= */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --texto: #1c2024;
  --suave: #6b7280;
  --borde: #e6e8eb;
  --acento: #111827;
  --wa: #25d366;
  --wa-oscuro: #1da851;
  --sombra: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --radio: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--texto);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Encabezado ---------- */
.encabezado {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--borde);
  padding: 12px 16px 10px;
}
.encabezado-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1100px;
  margin: 0 auto;
}
.logo {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}
.btn-carrito {
  position: relative;
  font-size: 22px;
  background: var(--bg);
  border: 1px solid var(--borde);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  flex: 0 0 auto;
}
.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--wa);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ---------- Filtros ---------- */
.filtros {
  max-width: 1100px;
  margin: 10px auto 0;
}
.buscador {
  width: 100%;
  padding: 11px 14px;
  font-size: 16px; /* 16px evita el zoom automático en iOS */
  border: 1px solid var(--borde);
  border-radius: 12px;
  background: var(--bg);
  outline: none;
}
.buscador:focus { border-color: #c7ccd1; background: #fff; }
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--borde);
  background: var(--card);
  color: var(--suave);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.chip.activo {
  background: var(--acento);
  color: #fff;
  border-color: var(--acento);
}

/* ---------- Contenido / grilla ---------- */
.contenido {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}
.estado {
  text-align: center;
  color: var(--suave);
  padding: 40px 0;
  font-size: 15px;
}
.grilla {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 560px) { .grilla { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 820px) { .grilla { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Tarjeta de producto ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  overflow: hidden;
  box-shadow: var(--sombra);
  display: flex;
  flex-direction: column;
}
.card-foto {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #eef0f2;
  cursor: pointer;
}
.card-foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-foto .sin-foto {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aab1b8;
  font-size: 13px;
}
.card-foto .mini-galeria {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
}
.card-cuerpo {
  padding: 10px 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.card-nombre {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
}
.card-meta {
  font-size: 12px;
  color: var(--suave);
}
.card-precio {
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
}
.card-acciones { margin-top: auto; padding-top: 8px; }
.btn-agregar {
  width: 100%;
  padding: 9px;
  border: none;
  border-radius: 10px;
  background: var(--acento);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-agregar:active { transform: scale(.98); }
.btn-agregar.en-carrito { background: var(--wa); }

/* control +/- cuando ya está en el carrito */
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--borde);
  border-radius: 10px;
  overflow: hidden;
}
.stepper button {
  width: 38px;
  height: 38px;
  border: none;
  background: var(--bg);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}
.stepper button:disabled { color: #c7ccd1; cursor: not-allowed; }
.stepper .cant { font-size: 15px; font-weight: 700; }

/* ---------- Carrito (panel lateral) ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 40;
}
.panel-carrito {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(420px, 100%);
  height: 100%;
  background: var(--card);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 24px rgba(0, 0, 0, .12);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--borde);
}
.panel-header h2 { margin: 0; font-size: 18px; }
.btn-cerrar {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--suave);
}
.items-carrito {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}
.carrito-vacio {
  text-align: center;
  color: var(--suave);
  padding: 48px 0;
}
.item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--borde);
}
.item img, .item .item-sinfoto {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  object-fit: cover;
  background: #eef0f2;
  flex: 0 0 auto;
}
.item-info { flex: 1; min-width: 0; }
.item-nombre { font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.item-meta { font-size: 12px; color: var(--suave); }
.item-precio { font-size: 13px; font-weight: 700; margin-top: 4px; }
.item .stepper { width: 118px; margin-top: 6px; }
.item-quitar {
  background: none;
  border: none;
  color: #d23b3b;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  margin-top: 6px;
}

.panel-footer {
  border-top: 1px solid var(--borde);
  padding: 16px;
}
.total-fila {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  font-size: 15px;
}
.total-fila strong { font-size: 22px; }
.btn-enviar-wa {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--wa);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.btn-enviar-wa:hover { background: var(--wa-oscuro); }
.btn-enviar-wa:disabled { background: #cfd4d8; cursor: not-allowed; }
.nota-envio {
  font-size: 12px;
  color: var(--suave);
  text-align: center;
  margin: 10px 0 0;
}

[hidden] { display: none !important; }
