/* ================================
   HELENA – CONTENEDOR RAÍZ
================================ */
#helena-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: inherit;
}

/* ================================
   BOTÓN FLOTANTE
================================ */
#helena-button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primario, #6f1d1b);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
  transition: transform .2s ease, box-shadow .2s ease;
}

#helena-button:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
}

/* ================================
   PANEL DE CHAT
================================ */
#helena-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  max-height: 480px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 50px rgba(0,0,0,.30);
  overflow: hidden;
  display: none;
}

/* ================================
   ESTADO ABIERTO
================================ */
#helena-root.open #helena-panel {
  display: flex;
  flex-direction: column;
}

/* ================================
   HEADER DEL CHAT
================================ */
.helena-header {
  background: linear-gradient(
    135deg,
    var(--color-primario, #6f1d1b),
    #8b2b28
  );
  color: #fff;
  padding: 12px 14px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ================================
   MENSAJES
================================ */
#helena-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: #f6f7f9;
}

/* ================================
   INPUT
================================ */
.helena-input {
  padding: 10px;
  border-top: 1px solid #ddd;
  background: #fff;
}

#helena-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #ccc;
  font-size: 14px;
}

#helena-input:focus {
  outline: none;
  border-color: var(--color-primario, #6f1d1b);
}

#helena-chat {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 320px;
  height: 420px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
  z-index: 9999;
}

#helena-button {
  font-size: 22px;
  user-select: none;
}

.helena-actions {
  display: flex;
  gap: 8px;
}

#helena-clear {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 16px;
}

.helena-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#helena-clear {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.85;
}

#helena-clear:hover {
  opacity: 1;
  transform: scale(1.05);
}

/* ================================
   MENSAJES – BASE
================================ */
.helena-msg {
  margin-bottom: 10px;
  line-height: 1.45;
}

/* ================================
   TEXTO
================================ */
.helena-text {
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
  white-space: pre-line; /* 👈 MUY IMPORTANTE */
}

/* ================================
   USUARIO
================================ */
.helena-user .helena-text {
  background: #e6f0ff;
  color: #003366;
  margin-left: auto;
  text-align: right;
}

/* ================================
   HELENA
================================ */
.helena-bot .helena-text {
  background: #f4f4f4;
  color: #222;
}

/* ================================
   SISTEMA
================================ */
.helena-system .helena-text {
  background: transparent;
  color: #666;
  font-size: 12px;
  text-align: center;
}

/* ================================
   ENLACES ACCIONABLES
================================ */
.helena-text a {
  color: var(--color-primario, #6f1d1b);
  text-decoration: underline;
  font-weight: 600;
  cursor: pointer;
}

.helena-text a:hover {
  opacity: 0.85;
}

/* ================================
   LISTAS
================================ */
.helena-text ul {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.helena-text li {
  margin-bottom: 6px;
}

.helena-msg.intro {
  opacity: 0.95;
}

.helena-msg {
  display: flex;
  width: 100%;
  margin-bottom: 10px;
}

.helena-msg.helena-bot {
  justify-content: flex-start;
}

.helena-msg.helena-user {
  justify-content: flex-end;
}

.helena-msg.helena-bot .helena-text {
  background: #f1f1f1;
  color: #222;
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 12px;
}

.helena-msg.helena-user .helena-text {
  background: #e7f0ff;
  color: #0b3a82;
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 12px;
}

/* 🔥 FIX MÓVIL */
#helena-messages {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
