/* Asistente para clientes — botón flotante y conversación */
.asis-boton {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 6px 18px 6px 6px;
  border: 2px solid var(--dorado, #c4943a);
  border-radius: 999px;
  background: var(--espresso, #22160f);
  color: var(--crema, #f5edd8);
  font: 700 0.98rem/1.1 var(--f-texto, system-ui, sans-serif);
  box-shadow: 0 10px 28px -8px rgba(20, 11, 6, 0.65);
  cursor: pointer;
  animation: asis-entrar 0.5s ease-out 1.2s both;
}
.asis-boton img { width: 40px; height: 40px; border-radius: 50%; background: #fff; }
.asis-boton:hover { background: var(--rojo-da-oscuro, #9e1a21); }
.asis-boton:focus-visible, .asis-panel button:focus-visible, .asis-panel a:focus-visible, .asis-form input:focus-visible {
  outline: 3px solid var(--dorado, #c4943a);
  outline-offset: 2px;
}
.asis-boton[hidden], .asis-panel[hidden], .asis-sugs[hidden] { display: none; }
@keyframes asis-entrar { from { opacity: 0; transform: translateY(18px) scale(0.9); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .asis-boton { animation: none; } }

.asis-panel {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 61;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 32px));
  height: min(620px, calc(100dvh - 32px));
  background: var(--crema, #f5edd8);
  border: 2px solid var(--espresso, #22160f);
  border-radius: 18px;
  box-shadow: 0 24px 60px -18px rgba(20, 11, 6, 0.7);
  overflow: hidden;
  font-family: var(--f-texto, system-ui, sans-serif);
  color: var(--tinta, #2a1b13);
}
.asis-cabeza {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.6rem 0.7rem 0.8rem;
  background: var(--espresso, #22160f);
  color: var(--crema, #f5edd8);
  border-bottom: 4px solid transparent;
  border-image: var(--correo) 1;
}
.asis-cabeza img { border-radius: 50%; background: #fff; flex: none; }
.asis-cabeza-txt { flex: 1; display: grid; line-height: 1.2; }
.asis-cabeza-txt strong { font-family: var(--f-display, Georgia, serif); font-size: 1.1rem; font-weight: 700; }
.asis-cabeza-txt small { color: #d9c9a3; font-size: 0.8rem; }
.asis-cabeza-txt small::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #5fd38d; }
.asis-x, .asis-reiniciar {
  width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent;
  color: var(--crema, #f5edd8); font-size: 1.7rem; line-height: 1; cursor: pointer;
}
.asis-reiniciar { font-size: 1.3rem; }
.asis-x:hover, .asis-reiniciar:hover { background: rgba(255, 255, 255, 0.12); }

.asis-lista {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overscroll-behavior: contain;
}
.asis-msg { max-width: 86%; padding: 0.6rem 0.8rem; border-radius: 16px; font-size: 0.97rem; line-height: 1.4; }
.asis-msg p { margin: 0; white-space: pre-line; }
.asis-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--linea, #ddcca8); border-bottom-left-radius: 4px; }
.asis-msg.cliente { align-self: flex-end; background: var(--rojo-da, #c8222a); color: #fff; border-bottom-right-radius: 4px; }
.asis-acciones { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.55rem; }
.asis-accion {
  display: inline-flex; align-items: center; min-height: 2.3rem; padding: 0 0.8rem;
  border: 1.5px solid var(--espresso, #22160f); border-radius: 999px; background: var(--crema, #f5edd8);
  color: var(--espresso, #22160f); font: 700 0.86rem var(--f-texto, system-ui, sans-serif); text-decoration: none; cursor: pointer;
}
.asis-accion.reservar { background: var(--espresso, #22160f); color: var(--crema, #f5edd8); }
.asis-accion.llamar { border-color: var(--verde-hoja, #2f4a3a); color: var(--verde-hoja, #2f4a3a); }
.asis-accion:hover { filter: brightness(1.1); }
.escribiendo { display: flex; gap: 4px; padding: 0.8rem; }
.escribiendo span { width: 8px; height: 8px; border-radius: 50%; background: #b8a682; animation: asis-punto 1s infinite; }
.escribiendo span:nth-child(2) { animation-delay: 0.15s; }
.escribiendo span:nth-child(3) { animation-delay: 0.3s; }
@keyframes asis-punto { 0%, 60%, 100% { opacity: 0.3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

.asis-sugs { display: flex; gap: 0.35rem; overflow-x: auto; padding: 0 0.8rem 0.5rem; scrollbar-width: none; }
.asis-sugs button {
  flex: none; min-height: 2.2rem; padding: 0 0.8rem; border: 1.5px solid var(--dorado, #c4943a); border-radius: 999px;
  background: #fff8e8; color: var(--espresso, #22160f); font: 600 0.86rem var(--f-texto, system-ui, sans-serif); cursor: pointer; white-space: nowrap;
}
.asis-form { display: flex; gap: 0.4rem; padding: 0.55rem 0.6rem; background: #fff; border-top: 1px solid var(--linea, #ddcca8); }
.asis-form input {
  flex: 1; min-width: 0; min-height: 2.8rem; padding: 0 0.9rem; border: 1.5px solid var(--linea, #ddcca8);
  border-radius: 999px; font: 1rem var(--f-texto, system-ui, sans-serif); background: var(--crema, #f5edd8); color: inherit;
}
.asis-enviar { width: 2.8rem; height: 2.8rem; flex: none; border: 0; border-radius: 50%; background: var(--rojo-da, #c8222a); color: #fff; cursor: pointer; display: grid; place-items: center; }
.asis-aviso { margin: 0; padding: 0 0.8rem 0.5rem; background: #fff; font-size: 0.72rem; color: #8a7558; text-align: center; }

@media (max-width: 520px) {
  .asis-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .asis-boton-txt { font-size: 0.9rem; }
  body.asis-abierto { overflow: hidden; }
}
@media print { .asis-boton, .asis-panel { display: none !important; } }

/* Ventura en la página de clientes */
.asis-boton img { object-fit: cover; }
.asis-cara { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 2px solid var(--dorado, #c4943a); background: #fff; flex: none; }
.asis-panel.hablando .asis-cara { animation: asis-habla 0.45s ease-in-out infinite alternate; box-shadow: 0 0 0 4px rgba(196, 148, 58, 0.45); }
@keyframes asis-habla { from { transform: scale(1); } to { transform: scale(1.07); } }
@media (prefers-reduced-motion: reduce) { .asis-panel.hablando .asis-cara { animation: none; } }
.asis-voz { width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; font-size: 1.2rem; cursor: pointer; }
.asis-voz:hover { background: rgba(255, 255, 255, 0.12); }
.asis-mic { width: 2.8rem; height: 2.8rem; flex: none; border: 0; border-radius: 50%; background: var(--dorado, #c4943a); color: var(--espresso, #22160f); display: grid; place-items: center; cursor: pointer; }
.asis-mic.activo { background: #e03150; color: #fff; box-shadow: 0 0 0 6px rgba(224, 49, 80, 0.2); }
.asis-escuchar { display: inline-block; margin-top: 0.45rem; padding: 0.2rem 0.65rem; border: 1px solid var(--linea, #ddcca8); border-radius: 999px; background: #fff8e8; color: var(--espresso, #22160f); font: 600 0.8rem var(--f-texto, system-ui, sans-serif); cursor: pointer; }

.asis-fuentes { margin-top: 0.4rem; font: 0.75rem var(--f-texto, system-ui, sans-serif); color: #6b5a48; }
.asis-fuentes a { color: #8a5a12; text-decoration: underline; }

.asis-accion.whatsapp { background: #25d366; color: #fff; border-color: #1ebe5a; font-weight: 700; }
