/* =====================================================================
   La tienda en el celular con el formato de la app de iPhone (29-sep-2026, Nanu: "para celular me gustó
   más el formato que armaste en iphone, podemos fusionar ambos estilos").
   De la WEB queda la cara: encabezado rojo con el logo, buscador, barra de entrega y categorías.
   De la APP: productos en 2 columnas con la foto cuadrada grande y "Agregar" a lo ancho, y la barra de
   abajo (Inicio · Catálogo · Carrito · Pedidos · Cuenta) en lugar de Ingresar / Registrate / Carrito
   arriba y de la barra "Ver carrito". Sólo hasta 700 px: en la compu la tienda no cambia.
   ===================================================================== */
.tabbar { display: none; }

@media (max-width: 700px) {
  /* ---------- Encabezado de la tienda: logo y buscador en una sola fila ---------- */
  #navDerecha { display: none; }
  .pagina-tienda .nav-inner {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "logo search";
    padding: .55rem .9rem;
    gap: .7rem;
  }
  .pagina-tienda .logo img { height: 34px; }
  /* La lupa adentro del campo: Lucide cambia el <i> por un <svg> y la regla de styles.css ya no lo agarraba */
  .search-box svg { position: absolute; left: .85rem; z-index: 1; width: 16px; height: 16px; color: var(--gray-500); pointer-events: none; }
  .search-box input { padding-left: 2.4rem; }
  /* Las categorías fijas quedan pegadas al encabezado, que ahora es más bajo (tabbar.js mide su alto) */
  .con-tabbar .sidebar { top: var(--alto-header, 63px); }

  /* ---------- Productos: 2 columnas, tarjeta vertical (como la app) ---------- */
  .product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem;
  }
  .product-card { flex-direction: column; border-radius: 16px; }
  .product-img { width: 100%; aspect-ratio: 1 / 1; }
  .product-img .fav-btn { top: .4rem; right: .4rem; width: 32px; height: 32px; }
  .product-img .fav-btn i { width: 16px; height: 16px; }
  .product-info {
    display: flex;
    flex-direction: column;
    align-items: stretch;        /* el diseño anterior dejaba "end": nombre y precio corridos a la derecha */
    gap: .15rem;
    padding: .55rem .6rem .65rem;
  }
  .price-tag { align-self: flex-start; }
  .price-tag { font-size: .55rem; padding: .12rem .38rem; margin-bottom: .1rem; }
  .product-name {
    font-size: .84rem;
    line-height: 1.25;
    min-height: 2.5em;           /* 2 renglones: las tarjetas de una fila quedan parejas */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .product-unit { font-size: .7rem; margin-bottom: 0; }
  .product-pack { font-size: .66rem; margin-top: .15rem; padding: .18rem .4rem; max-width: 100%; }
  .product-price-wrap { margin-top: auto; padding-top: .3rem; flex-wrap: wrap; row-gap: 0; justify-content: flex-start; }
  .product-price { font-size: 1.12rem; }
  .precio-tachado { font-size: .72rem; }

  /* "+ Agregar" a lo ancho, como la app (antes era un "+" redondo flotando) */
  .add-btn {
    position: static;
    width: 100%;
    height: auto;
    margin-top: .45rem;
    padding: .62rem .5rem;
    border-radius: 12px;
    gap: .3rem;
    box-shadow: none;
  }
  .add-btn .add-btn-text { display: inline; font-weight: 800; font-size: .88rem; }
  .add-btn .add-btn-plus { order: -1; font-size: 1.15rem; font-weight: 700; line-height: 1; }
  .add-btn:active { transform: scale(.97); box-shadow: none; }

  /* ---------- Barra de abajo (la de la app) ---------- */
  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  /* Carrito cerrado: Inicio · Catálogo · Cuenta (styles.css esconde Carrito y Pedidos) */
  body.carrito-cerrado .tabbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 150;                 /* arriba del contenido; el carrito (200) y los modales (300) la tapan */
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -6px 20px -12px rgba(0,0,0,.18);
  }
  .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    background: none;
    border: 0;
    padding: 0;
    font: 600 .68rem var(--font);
    color: var(--gray-600);
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .tab i, .tab svg { width: 23px; height: 23px; }
  .tab.activo { color: var(--red); }
  .tab.activo span:last-child { font-weight: 800; }
  .tab-ico { position: relative; display: inline-flex; }
  .tab-badge {
    position: absolute;
    top: -6px; right: -11px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--red);
    color: var(--white);
    font: 800 .66rem/18px var(--mono);
    text-align: center;
    box-shadow: 0 0 0 2px var(--white);
  }
  .tab-badge[hidden] { display: none; }

  /* Lugar para la barra: nada queda tapado abajo; los avisos van arriba de ella */
  body.con-tabbar { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
  .con-tabbar .mobile-cart-bar { display: none !important; }
  .con-tabbar .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- "Catálogo": todas las categorías y, adentro, sus subcategorías (29-sep-2026) ----------
   Una hoja que sube desde abajo con UNA lista en un solo recuadro (como Ajustes del iPhone): cada categoría con su
   ícono de color, cuántos productos tiene y, debajo del nombre, sus subcategorías con más productos. Tocar una que
   tiene subcategorías entra a ellas; las demás llevan directo a sus productos. script.js la arma. */
.explorador { position: fixed; inset: 0; z-index: 260; }
.explorador-fondo { position: absolute; inset: 0; background: rgba(15,15,16,.42); touch-action: none; animation: exFondo .2s ease-out; }
.explorador-hoja {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: calc(100vh - 44px);          /* siempre del mismo alto: al entrar a una categoría no salta */
  height: calc(100dvh - 44px);
  display: flex;
  flex-direction: column;
  background: var(--gray-50);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 40px rgba(15,15,16,.2);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: exSube .28s cubic-bezier(.2,.8,.2,1);
}
.explorador-cab {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  padding: .5rem .45rem;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  border-radius: 20px 20px 0 0;
}
.explorador-cab h2 { grid-column: 2; text-align: center; font-size: 1.02rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.explorador-cab button {
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.explorador-cab button:active { background: var(--gray-100); }
.explorador-cab svg { width: 22px; height: 22px; }
.explorador-volver { grid-column: 1; grid-row: 1; }
.explorador-cerrar { grid-column: 3; grid-row: 1; }
.explorador-cuerpo { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: .8rem .8rem 1.1rem; }
.explor-lista { background: var(--white); border: 1px solid var(--gray-200); border-radius: 14px; overflow: hidden; }
.explor-lista li {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 58px;
  padding: .6rem .75rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.explor-lista li + li { border-top: 1px solid var(--gray-100); }
.explor-lista li:active { background: var(--gray-100); }
.explor-lista li.active { background: var(--red-soft); }
.explor-lista .cat-ico {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--tinte, var(--gray-100));
  color: var(--tinte-ico, var(--gray-700));
}
.explor-lista .cat-ico svg { width: 20px; height: 20px; }
.explor-nombre { flex: 1; min-width: 0; font-weight: 700; font-size: .95rem; line-height: 1.25; color: var(--ink); }
.explor-nombre small { display: block; margin-top: .15rem; font-weight: 500; font-size: .76rem; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.explor-lista li.active .explor-nombre { color: var(--red); }
.explor-n { flex: 0 0 auto; color: var(--gray-500); font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.explor-flecha { flex: 0 0 auto; width: 18px; height: 18px; color: var(--gray-300); }
.explor-subs .explor-punto { flex: 0 0 auto; width: 38px; display: grid; place-items: center; }
.explor-subs .explor-punto::before { content: ""; width: 7px; height: 7px; border-radius: 3px; background: var(--tinte-ico, var(--gray-300)); opacity: .55; }
@keyframes exSube { from { transform: translateY(100%); } to { transform: none; } }
@keyframes exFondo { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .explorador-hoja, .explorador-fondo { animation: none; } }
