/* =========================================================================
   STYLES.CSS  —  Tema AXO: cálido, claro y natural (marrón + verde + crema)
   Para cambiar los colores, edita solo las variables de :root.
   ========================================================================= */

:root {
  --bg:            #faf5ec;   /* Fondo crema cálido */
  --surface:       #ffffff;   /* Tarjetas */
  --surface-2:     #f3ecdf;   /* Inputs, steppers, chips */
  --border:        #ebe0cf;   /* Bordes suaves */
  --text:          #3a2a1d;   /* Texto principal (marrón muy oscuro) */
  --text-soft:     #927f6c;   /* Texto secundario */
  --brown:         #6b4324;   /* Marrón de marca (precios, acentos) */
  --green:         #4e7b3e;   /* Verde de marca (acciones) */
  --green-dark:    #3e6231;
  --brand:         var(--green);
  --brand-ink:     #ffffff;
  --whatsapp:      #25d366;
  --price:         var(--brown);
  --radius:        16px;
  --radius-sm:     11px;
  --shadow:        0 6px 20px rgba(80, 55, 30, .10);
  --shadow-soft:   0 2px 10px rgba(80, 55, 30, .06);
  --safe-bottom:   env(safe-area-inset-bottom, 0px);
}

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

/* El atributo hidden siempre gana, aunque el elemento tenga display:flex */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.42;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
}

/* ---------------- Encabezado ---------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}
.app-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.app-header__logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: contain;
  flex-shrink: 0;
  background: #fff;
  padding: 3px;
  border: 1px solid var(--border);
}
/* Modo logo: el logo reemplaza al texto y se muestra en grande */
.app-header--logo .app-header__logo {
  width: auto;
  height: 48px;
  max-width: 215px;
  border: none;
  padding: 0;
  border-radius: 0;
  background: transparent;
}
.app-header__brand h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: .2px;
  color: var(--brown);
}
.app-header__eslogan {
  font-size: .78rem;
  color: var(--green-dark);
  font-weight: 600;
  margin-top: 1px;
}

.mesa-chip {
  flex-shrink: 0;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 13px;
  line-height: 1.1;
  box-shadow: var(--shadow-soft);
}
.mesa-chip__label {
  display: block;
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-soft);
}
.mesa-chip__num {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--green);
}

/* ---------------- Pestañas de categorías ---------------- */
.categorias {
  position: sticky;
  top: 81px;
  z-index: 15;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.categorias::-webkit-scrollbar { display: none; }

.categoria-btn {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--brown);
  font-size: .88rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.categoria-btn.is-active {
  background: var(--green);
  color: var(--brand-ink);
  border-color: var(--green);
  box-shadow: var(--shadow-soft);
}

/* ---------------- Lista del menú ---------------- */
.menu { padding: 8px 16px 0; }

.categoria-titulo {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--brown);
  margin: 24px 4px 12px;
  scroll-margin-top: 140px;
}

.producto {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
}
.producto__img {
  width: 68px;
  height: 68px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
}
.producto__info { min-width: 0; flex: 1; }
.producto__nombre { font-size: .98rem; font-weight: 700; }
.producto__desc {
  font-size: .8rem;
  color: var(--text-soft);
  margin-top: 3px;
}
.producto__precio {
  font-size: .95rem;
  font-weight: 800;
  color: var(--price);
  margin-top: 8px;
}

/* Producto agotado */
.producto.is-agotado { opacity: .6; }
.producto.is-agotado .producto__precio { color: var(--text-soft); }
.agotado-badge {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: .72rem;
  font-weight: 800;
  padding: 7px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.producto__control { flex-shrink: 0; align-self: center; }

/* Botón "Agregar" */
.btn-agregar {
  border: none;
  background: var(--green);
  color: var(--brand-ink);
  font-weight: 700;
  font-size: .85rem;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}
.btn-agregar:active { transform: scale(.96); }

/* Selector de cantidad (- N +) */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}
.stepper button {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--green);
  color: var(--brand-ink);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.stepper button:active { transform: scale(.92); }
.stepper__cant {
  min-width: 30px;
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
  color: var(--brown);
}

.spacer { height: 92px; }

/* ---------------- Barra flotante del carrito ---------------- */
.carrito-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  background: var(--green);
  color: var(--brand-ink);
  padding: 15px 18px;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(62, 98, 49, .35);
  cursor: pointer;
  font-family: inherit;
}
.carrito-bar__count {
  background: rgba(255,255,255,.22);
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: .85rem;
}
.carrito-bar__text { font-weight: 700; }
.carrito-bar__total { margin-left: auto; font-weight: 800; }

/* ---------------- Hoja / modal del carrito ---------------- */
.hoja { position: fixed; inset: 0; z-index: 40; }
.hoja__fondo {
  position: absolute;
  inset: 0;
  background: rgba(58, 42, 29, .45);
  animation: fade .2s ease;
}
.hoja__panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  padding: 8px 18px calc(18px + var(--safe-bottom));
  box-shadow: 0 -10px 40px rgba(58, 42, 29, .2);
  animation: slideUp .25s ease;
}
@keyframes fade   { from { opacity: 0; } }
@keyframes slideUp{ from { transform: translateY(100%); } }

.hoja__barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 8px;
  position: sticky;
  top: 0;
  background: var(--surface);
}
.hoja__barra h2 { font-size: 1.15rem; color: var(--brown); font-weight: 800; }
.hoja__cerrar {
  border: none;
  background: var(--surface-2);
  color: var(--text);
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
}

.hoja__items { overflow-y: auto; padding: 6px 0; }

.linea {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.linea__info { flex: 1; min-width: 0; }
.linea__nombre { font-size: .92rem; font-weight: 700; }
.linea__precio { font-size: .8rem; color: var(--text-soft); margin-top: 2px; }
.linea__subtotal { font-weight: 800; font-size: .92rem; white-space: nowrap; color: var(--brown); }

.linea .stepper button { width: 30px; height: 30px; font-size: 1.1rem; }
.linea .stepper__cant { min-width: 24px; font-size: .95rem; }

.carrito-vacio {
  text-align: center;
  color: var(--text-soft);
  padding: 30px 0;
  font-size: .9rem;
}

/* Aviso de mesa + notas */
.aviso-mesa, .notas { margin: 12px 0 4px; }
.aviso-mesa label, .notas label {
  display: block;
  font-size: .82rem;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.aviso-mesa input, .notas textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
  padding: 11px 12px;
  resize: none;
}
.aviso-mesa input:focus, .notas textarea:focus {
  outline: none;
  border-color: var(--green);
}
.aviso-mesa.is-error input { border-color: #d9534f; }

/* Formulario de entrega a domicilio */
.domicilio-form { margin: 12px 0 4px; }
.domicilio-form label {
  display: block;
  font-size: .82rem;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.domicilio-form textarea, .domicilio-form input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
  padding: 11px 12px;
  resize: none;
  margin-bottom: 10px;
}
.domicilio-form textarea:focus, .domicilio-form input:focus {
  outline: none;
  border-color: var(--green);
}
.domicilio-form.is-error textarea, .domicilio-form.is-error input { border-color: #d9534f; }

/* Desglose subtotal + envío */
.hoja__desglose {
  padding: 10px 2px 0;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.linea-desglose {
  display: flex;
  justify-content: space-between;
  font-size: .9rem;
  color: var(--text-soft);
  padding: 4px 0;
}

.hoja__resumen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 2px;
  font-size: 1rem;
}
.hoja__resumen strong { font-size: 1.35rem; color: var(--brown); }

.btn-enviar {
  width: 100%;
  border: none;
  background: var(--whatsapp);
  color: #fff;
  font-weight: 800;
  font-size: 1.02rem;
  padding: 15px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 8px 24px rgba(37, 211, 102, .3);
}
.btn-enviar:active { transform: scale(.99); }
.btn-enviar:disabled { opacity: .5; cursor: not-allowed; }

.nota-legal {
  text-align: center;
  font-size: .72rem;
  color: var(--text-soft);
  margin-top: 10px;
}

/* ---------------- Pantallas grandes ---------------- */
@media (min-width: 640px) {
  .app-header, .categorias, .menu { max-width: 560px; margin-inline: auto; }
  .carrito-bar { left: 50%; transform: translateX(-50%); width: min(528px, calc(100% - 32px)); }
  .hoja__panel { max-width: 560px; margin-inline: auto; border-radius: 22px 22px 0 0; }
}
