:root {
  --morado: #A855F7;
  --morado-oscuro: #7E22CE;
  --morado-profundo: #4c1d95;
  --rosa: #F9A8D4;
  --menta: #6EE7B7;
  --fondo: #fff8fc;
  --texto: #3b0f63;
  --texto-suave: #6b4f7a;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  color: var(--texto);
  background-color: var(--fondo);
}

/* ---------- Encabezado ---------- */
.appbar {
  position: relative;
  background: var(--menta);
  text-align: center;
  padding: 1.5rem 1rem 2rem;
  margin-bottom: 3.5rem;
}
.appbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -14px;
  height: 14px;
  background: radial-gradient(circle at 14px 0, var(--menta) 13px, transparent 14px) 0 0 / 28px 14px repeat-x;
}
.appbar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 30%, rgba(255,255,255,.55) 0 18px, transparent 19px),
    radial-gradient(circle at 88% 20%, rgba(168,85,247,.25) 0 14px, transparent 15px),
    radial-gradient(circle at 80% 75%, rgba(249,168,212,.6) 0 20px, transparent 21px),
    radial-gradient(circle at 20% 80%, rgba(168,85,247,.2) 0 10px, transparent 11px);
}
.appbar > * { position: relative; }

.appbar__logo {
  display: block;
  margin: 0 auto .75rem;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  background: white;
  border: 5px solid var(--rosa); 
  box-shadow: 0 6px 16px rgba(76, 29, 149, .25);
}

.marca {
  margin: 0;
  font-family: var(--serif);
  font-size: 2.3rem;
  line-height: 1.1;
}
.marca__a {
  color: var(--rosa);
  text-shadow: 2px 2px 0 var(--morado-oscuro);
}
.marca__b { color: var(--morado-oscuro); }

.lema {
  display: inline-block;
  margin: .75rem 0 0;
  padding: .3rem 1rem;
  background: white;
  color: var(--morado-oscuro);
  border: 2px solid var(--morado);
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
}

.pill {
  position: absolute;
  top: .75rem;
  right: .75rem;
  background: white;
  color: var(--morado-profundo);
  border: 2px solid var(--morado);
  border-radius: 999px;
  padding: .2rem .75rem;
  font-size: .8rem;
  font-weight: 600;
}
.pill.sin-conexion { background: #c2410c; color: white; border-color: #c2410c; }

/* ---------- Layout ---------- */
main {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1rem;
}

section {
  background: white;
  border: 4px solid var(--menta);
  border-radius: 28px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

/* Título en píldora, centrado (Nuestro menú, Carrito, etc.) */
.titulo-pill {
  display: block;
  width: fit-content;
  margin: -2.8rem auto 1.25rem;
  padding: .35rem 1.4rem;
  background: var(--menta);
  color: var(--morado-profundo);
  font-family: var(--serif);
  font-size: 1.4rem;
  border: 2px solid var(--morado);
  border-radius: 999px;
  box-shadow: 4px 4px 0 var(--rosa);
}

/* ---------- Producto estrella (solo #A855F7, #F9A8D4, #6EE7B7 y blanco) ---------- */
/* ---------- Producto estrella: degradado morado → rosa, texto blanco, detalles menta ---------- */
.destacado {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  border-radius: 24px;
  background: linear-gradient(120deg, var(--morado) 0%, var(--morado) 50%, var(--rosa) 100%);
  color: white;
}
.destacado__etiqueta {
  display: inline-block;
  padding: .25rem .9rem;
  border-radius: 999px;
  background: white;
  color: var(--morado);
  font-family: var(--serif);
  font-size: .85rem;
  font-weight: 700;
}
.destacado h3 {
  margin: .8rem 0 .6rem;
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1.1;
  color: white;
}
.degradado { color: white; }
.destacado p { margin: 0 0 1rem; color: white; line-height: 1.5; }
.destacado__compra { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.destacado__precio {
  padding: .1rem .9rem;
  border-radius: 999px;
  background: white;
  color: var(--morado);
  font-size: 1.8rem;
  font-weight: 800;
  box-shadow: 3px 3px 0 var(--menta);
}
.destacado__precio small { font-size: .8rem; font-weight: 600; }
.destacado button {
  background: white;
  color: var(--morado);
}
.destacado button:hover { background: white; filter: brightness(.95); transform: translateY(-2px); }
.destacado__foto { position: relative; flex: 0 0 200px; }
.destacado__foto img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 20px;
  border: 4px solid white;
  box-shadow: 0 0 0 3px var(--menta);
}
.destacado__insignia {
  position: absolute;
  top: .7rem;
  left: .7rem;
  z-index: 1;
  background: white;
  color: var(--morado);
  border: 2px solid var(--menta);
  padding: .2rem .7rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 800;
}

/* ---------- Catálogo ---------- */
.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.producto {
  --c: var(--morado);
  --sombra: rgba(168, 85, 247, .30);
  display: flex;
  flex-direction: column;
  background: white;
  border: 3px solid var(--c);
  border-radius: 18px;
  padding: .7rem;
  box-shadow: 0 4px 14px var(--sombra);
  transition: transform .2s ease, box-shadow .2s ease;
}
.producto:nth-child(3n+2) { --c: var(--menta); --sombra: rgba(110, 231, 183, .55); }
.producto:nth-child(3n)   { --c: var(--rosa);  --sombra: rgba(249, 168, 212, .60); }
.producto:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 22px var(--sombra);
}
.producto[hidden] { display: none; }

.producto__foto {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: .6rem;
  background: #fde4f1;
}
.producto strong {
  display: block;
  margin-bottom: .5rem;
  font-family: system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--texto);
  color: var(--morado);
}
.producto .precio {
  display: block;
  margin-bottom: .75rem;
  background: none;
  padding: 0;
  color: var(--texto);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--morado);
}
.producto .precio small { font-size: .7rem; font-weight: 600; }
.producto p { margin: .5rem 0; color: var(--morado); font-size: .85rem; }

/* Botón de cada tarjeta: morado, menta y rosa, en ese orden (sin sombra) */
.producto button {
  margin-top: auto;
  width: 100%;
  font-weight: 500;
  font-size: .85rem;
  background: var(--c);
  color: white;
  box-shadow: none;
}
.producto:nth-child(3n+2) button,
.producto:nth-child(3n) button { color: var(--texto); }
.producto button:hover {
  background: var(--c);        /* se queda en SU color: morado, menta o rosa */
  filter: brightness(.92);     /* solo se oscurece un poquito */
  box-shadow: none;
}

/* Tarjetas esqueleto */
.producto--cargando strong,
.producto--cargando .precio,
.producto--cargando p {
  background: linear-gradient(90deg, #f6e3ef 25%, #fbeff6 50%, #f6e3ef 75%);
  background-size: 200% 100%;
  animation: brillo 1.4s infinite;
  border-radius: 6px;
  color: transparent;
}
.producto--cargando strong { width: 70%; }
.producto--cargando .precio { display: block; width: 30%; }
.producto--cargando p { width: 45%; }
.producto--cargando button { visibility: hidden; }
@keyframes brillo { to { background-position: -200% 0; } }

/* ---------- Botones (planos, sin sombra) ---------- */
button {
  background: var(--morado-oscuro);
  color: white;
  border: none;
  border-radius: 999px;
  padding: .6rem 1.1rem;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 700;
  box-shadow: none;
  transition: transform .15s ease, background .15s ease, filter .15s ease;
}
button:hover { background: #6B21A8; }
button:active { transform: translateY(2px); }
button:focus-visible { outline: 3px solid var(--menta); outline-offset: 2px; }

/* ---------- Filtros por categoría (avance 2) ---------- */
.filtros {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;   
  gap: .6rem;
  margin-bottom: 1rem;
}
.filtros button {
  background: white;
  color: var(--morado-oscuro);
  border: 2px solid var(--rosa);
}
.filtros button[aria-pressed="true"] {
  background: var(--morado-oscuro);
  color: white;
  border-color: var(--morado-oscuro);
}

/* ---------- Mensajes, mapa y carrito (avances 2 y 3) ---------- */
.mensaje { color: var(--texto-suave); font-size: .9rem; min-height: 1.2em; }
.mensaje a { color: var(--morado-oscuro); }
.sucursal-info { color: var(--texto-suave); font-size: .9rem; margin: 0 0 .6rem; }

.mapa {
  height: 260px;
  border-radius: 16px;
  margin-top: .75rem;
  border: 3px solid var(--rosa);
}

#carrito-lista { list-style: none; padding: 0; }
#carrito-lista li {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: .6rem;
  border-bottom: 2px dashed var(--rosa);
  padding: .5rem 0;
}

/* ---------- Pie ---------- */
.pie {
  background: var(--menta);
  padding: 1rem 1.25rem;
  margin-top: 2rem;
}
.pie__info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem 2.5rem;
}
.pie__item {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--morado-oscuro);
  font-family: var(--serif);
  font-weight: 400;
  font-size: .95rem;
  line-height: 1.3;
  text-align: left;
}
.pie__item p { margin: 0; }
.pie__item strong { font-weight: 700; font-size: 1.05rem; }
.pie__icono { width: 40px; height: 40px; flex: none; }
.pie__iconos { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.pie__iconos .pie__icono { width: 30px; height: 30px; }
.pie__autor {
  margin: .75rem 0 1.5rem;
  text-align: center;
  color: var(--texto-suave);
  font-size: .8rem;
}

/* ---------- Celular ---------- */
@media (max-width: 480px) {
  .appbar__logo { width: 170px; height: 170px; }
  .marca { font-size: 1.8rem; }
  .lema { font-size: .8rem; }
  .grid { grid-template-columns: 1fr; gap: 1rem; }
  .titulo-pill { font-size: 1.15rem; }

  .destacado { flex-direction: column-reverse; padding: 1rem; }
  .destacado__foto { flex: none; width: 100%; }
  .destacado h3 { font-size: 1.6rem; }

  .pie__info {
    flex-direction: column;
    align-items: flex-start;
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
  }

  #carrito-lista li {
    grid-template-columns: 1fr auto;
    grid-template-areas: "nombre nombre" "cantidad precio" "quitar quitar";
  }
  .carrito-nombre { grid-area: nombre; }
  .carrito-cantidad { grid-area: cantidad; }
  .carrito-precio { grid-area: precio; justify-self: end; }
  .carrito-quitar { grid-area: quitar; justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Tamaño del logo (déjalo al final del archivo) ---------- */
.appbar .appbar__logo {
  width: 200px;
  height: 200px;
  border: none;
}
@media (max-width: 480px) {
  .appbar .appbar__logo {
    width: 150px;
    height: 150px;
  }
}

/* ---------- Burbujas que suben ---------- */
.burbujas {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;            /* detrás de todo el contenido */
}
.burbujas span {
  position: absolute;
  bottom: -90px;          /* nacen debajo de la pantalla */
  left: var(--x);
  width: var(--t);
  height: var(--t);
  border-radius: 50%;
  background: var(--c);
  animation: subir var(--d) linear var(--r) infinite;
}
@keyframes subir {
  0%   { transform: translate(0, 0);        opacity: 0; }
  10%  { opacity: 1; }
  50%  { transform: translate(22px, -55vh); }
  90%  { opacity: 1; }
  100% { transform: translate(-14px, -118vh); opacity: 0; }
}

/* ---------- Botón Quitar con el estilo de los títulos ---------- */
.carrito-quitar {
  background: var(--menta);
  color: var(--morado-profundo);
  font-family: var(--serif);
  font-weight: 600;
  font-size: .85rem;
  padding: .25rem .9rem;
  border: 2px solid var(--morado);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--rosa);
}
.carrito-quitar:hover {
  background: var(--menta);
  color: var(--morado-profundo);
  filter: brightness(.94);
}
main {
 max-width: 1400px;                              /* antes 1200px */                     /* más ancho para que quepan las dos columnas */
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;   /* menú | carrito */
  gap: 1.5rem;
  align-items: start;                      /* ambos arrancan arriba */
}

main > section { grid-column: 1; }         /* menú (y futuras secciones) a la izquierda */

main > .carrito {
  grid-column: 2;
  grid-row: 1;                             /* misma fila donde empieza el menú */
  position: sticky;                        /* se queda visible al hacer scroll */
  top: 1.5rem;
}

/* Celular y tablet: vuelve a una sola columna */
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  main > .carrito { grid-column: 1; grid-row: auto; position: static; }
}

#carrito-lista { list-style: none; padding: 0; margin: 0; }

.carrito-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;   /* foto | nombre y precio | controles */
  gap: .75rem;
  align-items: center;
  padding: .6rem;
  margin-bottom: .6rem;
  background: #fff;
  border: 2px solid #e9d5ff;
  border-radius: 14px;
}
.carrito-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
}

#carrito-lista .carrito-nombre {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 9.5rem;        /* asegura que quepa "cacahuate" completo */
  overflow-wrap: normal;
}
#carrito-lista .carrito-foto {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}
#toasts {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  z-index: 1000;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 2rem);
}

.toast {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem 1.1rem;
  background: #7e22ce;
  color: #fff;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(126, 34, 206, .35);
  animation: toast-entrada .3s ease-out;
}

.toast__icono {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #6ee7b7;
  color: #4c1d95;
  font-size: .8rem;
  font-weight: 800;
  flex-shrink: 0;
}

.toast--salida { animation: toast-salida .3s ease-in forwards; }

@keyframes toast-entrada {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-salida {
  to { opacity: 0; transform: translateY(12px); }
}

@media (prefers-reduced-motion: reduce) {
  .toast, .toast--salida { animation-duration: .01s; }
}

#carrito-lista li:not(.carrito-vacio) {
  border: 2px solid #F9A8D4;      /* el rectángulo, mismo lila claro de tus tarjetas */
  border-radius: 14px;
  padding: .6rem .8rem;
  margin-bottom: .6rem;           /* espacio entre un producto y otro */
  background: #fff;
}
.appbar { position: relative; }

#estado-conexion {
  position: absolute;
  top: .9rem;
  right: 1rem;         
  left: auto;          
  width: fit-content;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .3rem .85rem;
  background: rgba(255, 255, 255, .85);
  color: #5b21b6;
  font-size: .85rem;
  font-weight: 700;
  border-radius: 999px;
}

#estado-conexion::before {
  content: "";
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  background: #22c55e;          /* verde = conectado */
}

#estado-conexion.pill--offline {
  background: #f9a8d4;
  color: #5b1740;
}
#estado-conexion.pill--offline::before {
  background: #e11d48;          /* rojo = sin conexión */
}
.notificaciones {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px dashed #f9a8d4;
}
.notificaciones__texto { margin: 0 0 .6rem; }

/* #btn-notificar ya no lleva color propio: usa el estilo general de button */
#btn-notificar:disabled { opacity: 1; cursor: default; }
#carrito-lista .carrito-cantidad {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: .3rem;
  flex-shrink: 0;
  white-space: nowrap;
}
#carrito-lista .carrito-nombre {
  min-width: 0;           /* deja que el nombre se achique y baje de renglón */
  overflow-wrap: anywhere;
}

#carrito-lista .carrito-foto {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
#carrito-lista .carrito-cantidad button {
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}
@media (min-width: 901px) {
  main { grid-template-rows: auto 1fr; }

  /* el menú ocupa las dos filas de la izquierda */
  main > section.panel { grid-row: 1 / span 2; }

  /* carrito arriba a la derecha y distancia justo debajo */
  main > section.carrito  { grid-column: 2; grid-row: 1; position: static; }
  main > section.distancia { grid-column: 2; grid-row: 2; }
}