/* =====================================================================
   Bot de ayuda (abajo a la derecha)
   ===================================================================== */
.bot { --bot-verde: #13bd0d; --bot-oscuro: #1f1d1d; position: fixed; right: 20px; bottom: 20px; z-index: 900; }

/* Botón */
.bot-lanzador {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 58px;
  padding: 0 16px;
  color: #fff;
  font: inherit;
  background: var(--bot-oscuro);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, gap 0.25s, padding 0.25s;
}
.bot-lanzador::after {
  /* puntito verde "en línea" */
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 12px;
  height: 12px;
  background: var(--bot-verde);
  border: 2px solid #fff;
  border-radius: 50%;
}
.bot-lanzador:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3); }
.bot-lanzador:focus-visible { outline: 3px solid var(--bot-verde); outline-offset: 3px; }
.bot-lanzador-texto {
  max-width: 0;
  overflow: hidden;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  transition: max-width 0.3s ease;
}
@media (hover: hover) {
  .bot:not(.abierto) .bot-lanzador:hover { gap: 8px; padding-right: 20px; }
  .bot:not(.abierto) .bot-lanzador:hover .bot-lanzador-texto { max-width: 140px; }
}
.bot-icono-cerrar, .bot.abierto .bot-icono-abrir { display: none; }
.bot.abierto .bot-icono-cerrar { display: block; }
.bot.abierto .bot-lanzador::after { display: none; }

/* Panel */
.bot-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(580px, calc(100vh - 120px));
  overflow: hidden;
  background: #f6f7f9;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  transform-origin: bottom right;
  animation: bot-entrar 0.22s cubic-bezier(.22, .61, .36, 1);
}
.bot-panel[hidden] { display: none; }
@keyframes bot-entrar { from { opacity: 0; transform: translateY(12px) scale(0.97); } }

.bot-cabecera {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  color: #fff;
  background: var(--bot-oscuro);
}
.bot-cabecera img { flex: 0 0 auto; background: #fff; border-radius: 50%; }
.bot-cabecera div { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.25; }
.bot-cabecera strong { font-size: 0.98rem; }
.bot-cabecera span { font-size: 0.78rem; color: rgba(255, 255, 255, 0.7); }
.bot-cabecera span::before { content: "● "; color: var(--bot-verde); }
.bot-cerrar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.bot-cerrar:hover { background: rgba(255, 255, 255, 0.2); }

/* Conversación */
.bot-log {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 16px 12px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}
.bot-msg { display: flex; animation: bot-msg 0.25s ease; }
@keyframes bot-msg { from { opacity: 0; transform: translateY(6px); } }
.bot-msg-yo { justify-content: flex-end; }
.bot-burbuja {
  max-width: 88%;
  padding: 10px 13px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #1d2433;
  background: #fff;
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  overflow-wrap: anywhere;
}
.bot-burbuja p { margin: 0; }
.bot-burbuja p + * { margin-top: 8px; }
.bot-msg-yo .bot-burbuja { color: #fff; background: var(--bot-oscuro); border-radius: 16px 16px 4px 16px; }
.bot-escribiendo .bot-burbuja { letter-spacing: 3px; color: #8a93a3; animation: bot-latido 1s infinite; }
@keyframes bot-latido { 50% { opacity: 0.4; } }

.bot-enlace { display: inline-block; margin-top: 8px; font-weight: 700; color: #0f7a0b; text-decoration: none; }
.bot-enlace:hover { text-decoration: underline; }
.bot-boton {
  display: inline-block;
  margin-top: 4px;
  padding: 9px 16px;
  font-weight: 700;
  color: #fff;
  background: var(--bot-oscuro);
  border-radius: 999px;
  text-decoration: none;
}
.bot-boton.bot-wa { background: #25d366; }
.bot-enlace.bot-wa { color: #128c4a; }

/* Opciones */
.bot-opciones { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 4px; }
.bot-chip {
  padding: 8px 12px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: #1d2433;
  text-align: left;
  background: #fff;
  border: 1px solid #d9dde3;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.bot-chip:hover { border-color: var(--bot-oscuro); background: #fafafa; }
.bot-chip:active { transform: scale(0.97); }

/* Listas dentro de las respuestas */
.bot-lista { margin: 6px 0 0; padding-left: 18px; }
.bot-lista li + li { margin-top: 6px; }
.bot-productos, .bot-pedidos, .bot-eventos { display: grid; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.bot-producto, .bot-pedido, .bot-evento {
  display: flex;
  gap: 10px;
  padding: 8px;
  color: inherit;
  text-decoration: none;
  background: #f6f7f9;
  border: 1px solid transparent;
  border-radius: 12px;
  transition: border-color 0.15s;
}
.bot-producto:hover, .bot-pedido:hover, .bot-evento:hover { border-color: #c9d2df; }
.bot-producto img { flex: 0 0 48px; width: 48px; height: 64px; object-fit: contain; background: #fff; border-radius: 6px; }
.bot-producto-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bot-producto-info strong, .bot-evento strong { font-size: 0.86rem; line-height: 1.3; }
.bot-producto-info small, .bot-pedido small, .bot-evento small { font-size: 0.76rem; color: #6b7280; }
.bot-producto-precio { font-size: 0.84rem; }
.bot-producto-precio s { color: #9aa1ad; }
.bot-producto-precio em, .bot-evento em { font-size: 0.74rem; font-style: normal; font-weight: 700; }
em.hay { color: #13803a; }
em.agotado { color: #a32c1f; }
.bot-pedido, .bot-evento { flex-direction: column; gap: 3px; }
.bot-pedido-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bot-pedido-texto { font-size: 0.8rem; color: #3d4556; }
.bot-estado { padding: 2px 8px; font-size: 0.72rem; font-weight: 700; color: #1d4f91; background: #e8f1ff; border-radius: 999px; white-space: nowrap; }
.bot-estado-pendiente_pago { color: #8a5a00; background: #fff4dc; }
.bot-estado-pagado, .bot-estado-listo_recojo, .bot-estado-entregado { color: #13803a; background: #e9f9ee; }
.bot-estado-cancelado { color: #a32c1f; background: #fdecea; }
.bot-evento-fecha { font-size: 0.8rem; font-weight: 700; color: #0f7a0b; }

/* Escribir */
.bot-form { display: flex; gap: 8px; padding: 10px; background: #fff; border-top: 1px solid #eceef1; }
.bot-form input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  font: inherit;
  font-size: 0.9rem;
  background: #f3f4f6;
  border: 1px solid transparent;
  border-radius: 999px;
}
.bot-form input:focus { outline: none; background: #fff; border-color: var(--bot-oscuro); }
.bot-form button {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  height: 42px;
  color: #fff;
  background: var(--bot-oscuro);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

/* Celular: el chat ocupa casi toda la pantalla */
@media (max-width: 640px) {
  .bot { right: 14px; bottom: 14px; }
  .bot-lanzador { height: 52px; padding: 0 13px; }
  .bot-panel {
    position: fixed;
    inset: auto 8px 76px 8px;
    width: auto;
    height: min(78vh, calc(100dvh - 96px));
  }
  .bot-form input { font-size: 16px; } /* evita el zoom automático del iPhone */
  body:has(.carrito-aviso.visible) .bot:not(.abierto) { transform: translateY(-74px); transition: transform 0.25s; }
}
@media print { .bot { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .bot-panel, .bot-msg, .bot-escribiendo .bot-burbuja { animation: none; }
  .bot-lanzador, .bot-lanzador-texto { transition: none; }
  .bot-log { scroll-behavior: auto; }
}
