/* ============================================================
   CATÁLOGO WEB - ESTILOS
   ------------------------------------------------------------
   Pensado para celular primero. En pantallas grandes el
   contenido se centra con un ancho máximo, para que no se
   estire de forma incómoda.
   ============================================================ */

:root {
  --negro:        #0f0f0f;
  --gris-fondo:   #f5f6f8;
  --blanco:       #ffffff;
  --texto:        #1d232b;
  --texto-suave:  #6c7583;
  --borde:        #e3e7ed;

  --acento:       #16a34a;   /* verde: acciones principales */
  --acento-oscuro:#15803d;
  --whatsapp:     #25d366;
  --rojo:         #dc2626;
  --amarillo:     #f59e0b;

  --alto-barra:    56px;
  --alto-subbarra: 40px;
  --ancho-max:     620px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--gris-fondo);
  color: var(--texto);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--acento);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 12px;
  background: var(--blanco);
  color: var(--texto);
  padding: 10px 16px;
  border-radius: 6px;
  z-index: 1000;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}


/* ============================================================
   BARRA SUPERIOR (fija en todas las pantallas)
   ============================================================ */

.barra {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--alto-barra);
  background: linear-gradient(90deg, #05051a 0%, #1a1a6b 55%, #3535e0 100%);
  color: var(--blanco);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px 0 0;
  z-index: 100;
}

.barra-titulo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.barra-logo {
  width: var(--alto-barra);
  height: var(--alto-barra);
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.barra-titulo {
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ---------- Subbarra: volver a la pantalla anterior ---------- */

.subbarra {
  position: fixed;
  top: var(--alto-barra);
  left: 0; right: 0;
  z-index: 99;
  min-height: var(--alto-subbarra);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blanco);
  border-bottom: 1px solid var(--borde);
}

.subbarra-boton {
  width: 100%;
  max-width: var(--ancho-max);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--texto);
  padding: 0 14px;
}

.subbarra-boton span:first-child {
  font-size: 18px;
  line-height: 1;
}


/* ---------- Contenedor de acciones (admin + carrito) ---------- */

.barra-acciones {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.barra-boton {
  background: rgba(255,255,255,0.14);
  border-radius: 10px;
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  color: var(--blanco);
  font-size: 18px;
  flex-shrink: 0;
  padding: 6px;
}

.barra-boton:active { transform: scale(0.94); }

.barra-usuario {
  width: auto;
  height: auto;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}


/* ---------- Ícono del carrito con contador ---------- */

.carrito-boton {
  position: relative;
  background: rgba(255,255,255,0.14);
  border-radius: 10px;
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  color: var(--blanco);
  font-size: 19px;
  flex-shrink: 0;
}

.carrito-boton:active { transform: scale(0.94); }

.carrito-contador {
  position: absolute;
  top: -5px; right: -5px;
  background: var(--acento);
  color: var(--blanco);
  font-size: 11px;
  font-weight: 700;
  min-width: 19px;
  height: 19px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border: 2px solid var(--negro);
}

.carrito-contador.oculto { display: none; }


/* ============================================================
   CONTENEDOR DE PANTALLAS
   ============================================================ */

main {
  padding-top: var(--alto-barra);
  max-width: var(--ancho-max);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--gris-fondo);
}

main.con-subbarra {
  padding-top: calc(var(--alto-barra) + var(--alto-subbarra));
}

.pantalla { display: none; padding: 14px; }
.pantalla.activa { display: block; }


/* ============================================================
   PANTALLA 1 - CATEGORÍAS
   ============================================================ */

.saludo {
  padding: 4px 2px 16px;
}

.saludo h1 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 3px;
}

.saludo p {
  font-size: 14px;
  color: var(--texto-suave);
}

#lista-categorias {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.categoria {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  display: block;
  width: 100%;
  background-size: cover;
  background-position: center;
  text-align: center;
}

.categoria-nombre {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  color: var(--blanco);
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  padding: 0 14%;
  text-align: center;
}

.boton-contacto-negocio {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 18px;
  padding: 14px;
  background: var(--whatsapp);
  color: var(--blanco);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.boton-contacto-negocio:active { opacity: 0.85; }

.categoria:active { transform: scale(0.985); }


/* ============================================================
   PANTALLA 2 - LISTADO DE PRODUCTOS
   ============================================================ */

.contador-productos {
  font-size: 14px;
  color: var(--texto-suave);
  padding: 2px 2px 12px;
}

#lista-productos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.producto-fila {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--blanco);
  border-radius: 14px;
  padding: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--borde);
}

.producto-fila:active { background: #fafbfc; }

.producto-miniatura {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 9px;
  object-fit: cover;
  background: var(--gris-fondo);
  flex-shrink: 0;
}

.producto-datos { min-width: 0; }

.producto-nombre {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 3px;
}

.producto-unidad {
  font-size: 13px;
  color: var(--texto-suave);
  font-weight: 400;
}

.producto-precio {
  font-size: 18px;
  font-weight: 800;
}

.etiqueta-oferta {
  display: inline-block;
  background: var(--rojo);
  color: var(--blanco);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.etiqueta-agotado {
  display: inline-block;
  background: var(--texto-suave);
  color: var(--blanco);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
}

.producto-fila.agotado { opacity: 0.55; }


/* ============================================================
   PANTALLA 3 - DETALLE DEL PRODUCTO
   ============================================================ */

.detalle-imagen {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
  background: var(--blanco);
  margin-bottom: 16px;
}

.detalle-nombre {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
}

.detalle-precio {
  font-size: 26px;
  font-weight: 800;
  color: var(--acento);
  margin-bottom: 2px;
}

.detalle-unidad {
  font-size: 14px;
  color: var(--texto-suave);
  margin-bottom: 20px;
}

.bloque {
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.bloque-titulo {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 9px;
}

.observaciones {
  width: 100%;
  min-height: 74px;
  border: 1px solid var(--borde);
  border-radius: 9px;
  padding: 10px;
  font-size: 15px;
  resize: vertical;
  color: var(--texto);
}

.observaciones:focus {
  outline: none;
  border-color: var(--acento);
}

.contador-caracteres {
  text-align: right;
  font-size: 12px;
  color: var(--texto-suave);
  margin-top: 5px;
}


/* ---------- Selector de cantidad ---------- */

.selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.selector-boton {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--gris-fondo);
  border: 1px solid var(--borde);
  font-size: 24px;
  font-weight: 700;
  color: var(--texto);
  display: grid;
  place-items: center;
  line-height: 1;
}

.selector-boton:active { background: var(--borde); }
.selector-boton:disabled { opacity: 0.35; }

.selector-valor {
  font-size: 24px;
  font-weight: 800;
  min-width: 90px;
  text-align: center;
}

.selector-valor small {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--texto-suave);
}


/* ============================================================
   PANTALLA 4 - CARRITO
   ============================================================ */

.carrito-acciones {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.carrito-linea {
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 13px;
  margin-bottom: 11px;
}

.carrito-linea-arriba {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.carrito-linea-nombre {
  font-size: 16px;
  font-weight: 600;
}

.carrito-linea-obs {
  font-size: 13px;
  color: var(--texto-suave);
  font-style: italic;
  margin-top: 3px;
}

.carrito-linea-subtotal {
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
}

.carrito-linea-abajo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.selector-chico { gap: 12px; }
.selector-chico .selector-boton { width: 34px; height: 34px; font-size: 19px; }
.selector-chico .selector-valor { font-size: 16px; min-width: 66px; }
.selector-chico .selector-valor small { font-size: 11px; }

.quitar {
  color: var(--rojo);
  font-size: 13px;
  font-weight: 600;
  padding: 6px;
}


/* ---------- Formulario ---------- */

.campo { margin-bottom: 14px; }

.campo label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 5px;
}

.campo label .obligatorio { color: var(--rojo); }

.campo input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--borde);
  border-radius: 9px;
  font-size: 15px;
  color: var(--texto);
}

.campo input:focus {
  outline: none;
  border-color: var(--acento);
}

.campo input.error { border-color: var(--rojo); }

.opciones { display: flex; gap: 10px; }

.opcion {
  flex: 1;
  padding: 13px 8px;
  border: 2px solid var(--borde);
  border-radius: 10px;
  background: var(--blanco);
  font-size: 14px;
  font-weight: 600;
  color: var(--texto);
  text-align: center;
  line-height: 1.25;
}

.opcion.elegida {
  border-color: var(--acento);
  background: #f0fdf4;
  color: var(--acento-oscuro);
}

.oculto { display: none !important; }


/* ---------- Resumen y botón final ---------- */

.resumen {
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.resumen-fila {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  padding: 3px 0;
  color: var(--texto-suave);
}

.resumen-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 22px;
  font-weight: 800;
  color: var(--texto);
  border-top: 1px solid var(--borde);
  margin-top: 9px;
  padding-top: 9px;
}

.boton-whatsapp {
  width: 100%;
  padding: 16px;
  background: var(--whatsapp);
  color: #05391b;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.boton-whatsapp:active { background: #1fb955; }
.boton-whatsapp:disabled { background: #cfd5dc; color: #8b939d; }

.aviso {
  background: #fff8e6;
  border-left: 4px solid var(--amarillo);
  border-radius: 8px;
  padding: 11px 13px;
  font-size: 13.5px;
  margin-bottom: 14px;
}

.aviso.error {
  background: #fdeceb;
  border-left-color: var(--rojo);
}


/* ---------- Botón fijo de agregar (pantalla detalle) ---------- */

.barra-accion {
  position: sticky;
  bottom: 0;
  background: var(--gris-fondo);
  padding: 12px 0 6px;
  margin-top: 6px;
}

.boton-principal {
  width: 100%;
  padding: 16px;
  background: var(--acento);
  color: var(--blanco);
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.boton-principal:active { background: var(--acento-oscuro); }
.boton-principal:disabled { background: #cfd5dc; }


/* ---------- Estado vacío ---------- */

.vacio {
  text-align: center;
  padding: 60px 24px;
  color: var(--texto-suave);
}

.vacio-icono { font-size: 46px; margin-bottom: 12px; }
.vacio p { margin-bottom: 18px; font-size: 15px; }

.boton-secundario {
  display: inline-block;
  padding: 12px 22px;
  background: var(--negro);
  color: var(--blanco);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
}


/* ---------- Aviso flotante al agregar ---------- */

.confirmacion {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(90px);
  background: var(--negro);
  color: var(--blanco);
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 14.5px;
  font-weight: 600;
  z-index: 200;
  transition: transform 0.25s ease;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  max-width: 90vw;
  text-align: center;
}

.confirmacion.visible { transform: translateX(-50%) translateY(0); }


/* ---------- Botón flotante de carrito (estilo WhatsApp) ---------- */

.carrito-flotante {
  position: fixed;
  right: 18px;
  bottom: 90px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--acento);
  color: var(--blanco);
  font-size: 26px;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  z-index: 150;
}

.carrito-flotante:active { transform: scale(0.94); }

.carrito-flotante-contador {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--rojo);
  color: var(--blanco);
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border: 2px solid var(--blanco);
}

.carrito-flotante-contador.oculto { display: none; }

footer {
  text-align: center;
  font-size: 12px;
  color: var(--texto-suave);
  padding: 26px 14px 34px;
}


.boton-vaciar {
  padding: 8px 16px;
  background: var(--rojo);
  color: var(--blanco);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.boton-vaciar:hover {
  background: #c41e3a;
}

.boton-vaciar:active {
  background: #a01830;
}

