/* LOHĒS · ventana de chat del asistente (se usa en todas las páginas) */

.lha-boton {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 12px 14px;
  border: 1px solid var(--dorado, #DDBB80);
  border-radius: 999px;
  background: var(--negro, #141218);
  color: var(--marfil, #FBF8F5);
  font: 500 0.95rem/1 var(--sans, system-ui, sans-serif);
  cursor: pointer;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s ease, background 0.2s ease;
}
.lha-boton:hover { transform: translateY(-2px); background: var(--negro-suave, #2A2630); }
.lha-boton svg { width: 20px; height: 20px; flex: none; }
.lha-boton[aria-expanded="true"] { display: none; }

.lha-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 91;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: var(--marfil, #FBF8F5);
  color: var(--negro, #141218);
  font-family: var(--sans, system-ui, sans-serif);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55);
}
.lha-panel[hidden] { display: none; }

.lha-cabecera {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 14px;
  background: var(--negro, #141218);
  color: var(--marfil, #FBF8F5);
}
.lha-titulo { margin: 0; font: 600 1.15rem/1.2 var(--serif, Georgia, serif); letter-spacing: 0.01em; }
.lha-aviso { margin: 4px 0 0; font-size: 0.78rem; line-height: 1.4; color: var(--dorado, #DDBB80); }
.lha-cerrar {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.lha-cerrar:hover { background: var(--negro-suave, #2A2630); }

.lha-mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lha-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.93rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.lha-msg--ia { align-self: flex-start; background: var(--blanco, #FFFFFF); border: 1px solid var(--crema, #F4ECE4); border-bottom-left-radius: 4px; }
.lha-msg--yo { align-self: flex-end; background: var(--rosa, #F1D3D8); border-bottom-right-radius: 4px; }
.lha-msg--error { align-self: center; max-width: 100%; background: transparent; color: var(--rosa-texto, #8E4B5A); font-size: 0.85rem; text-align: center; }

.lha-escribiendo { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: var(--blanco, #FFFFFF); border: 1px solid var(--crema, #F4ECE4); border-radius: 14px; }
.lha-escribiendo span { width: 6px; height: 6px; border-radius: 50%; background: var(--tierra, #A6907A); animation: lha-parpadeo 1.2s infinite ease-in-out; }
.lha-escribiendo span:nth-child(2) { animation-delay: 0.2s; }
.lha-escribiendo span:nth-child(3) { animation-delay: 0.4s; }
@keyframes lha-parpadeo { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.lha-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--crema, #F4ECE4);
  background: var(--blanco, #FFFFFF);
}
.lha-input {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--crema, #F4ECE4);
  border-radius: 12px;
  font: inherit;
  font-size: 0.93rem;
  resize: none;
  color: inherit;
  background: var(--marfil, #FBF8F5);
}
.lha-input:focus { outline: 2px solid var(--dorado, #DDBB80); outline-offset: 0; }
.lha-enviar {
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--negro, #141218);
  color: var(--marfil, #FBF8F5);
  cursor: pointer;
}
.lha-enviar:disabled { opacity: 0.4; cursor: default; }
.lha-enviar svg { width: 18px; height: 18px; margin: auto; }

.lha-legal { margin: 0; padding: 0 12px 10px; background: var(--blanco, #FFFFFF); font-size: 0.72rem; color: var(--gris-texto, #4D4852); }
.lha-legal a { color: var(--rosa-texto, #8E4B5A); }

@media (max-width: 480px) {
  .lha-panel { right: 8px; bottom: 8px; width: calc(100vw - 16px); height: calc(100dvh - 16px); }
  .lha-boton__texto { display: none; }
  .lha-boton { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .lha-boton, .lha-escribiendo span { transition: none; animation: none; }
}
