/* Asistente de chat (burbuja abajo a la derecha). Lógica en /assets/js/chat.js;
   textos en el bloque js.chat de i18n/textos/<idioma>/chat.json. */
.trx-chat-boton {
  position: fixed; right: 22px; bottom: 22px; z-index: 45;
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--teal); color: #0a0c0b; display: grid; place-items: center;
  box-shadow: 0 10px 30px rgba(0, 168, 148, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.2s ease, background 0.2s ease;
}
.trx-chat-boton:hover { background: var(--teal-bright); transform: translateY(-2px); }
.trx-chat-boton svg { width: 32px; height: 32px; }
.trx-chat-boton .cerrar, .trx-chat-abierto .trx-chat-boton .abrir { display: none; }
.trx-chat-abierto .trx-chat-boton .cerrar { display: block; }
body:has(.cp-barra) .trx-chat-boton { bottom: 100px; }

.trx-chat {
  position: fixed; right: 22px; bottom: 94px; z-index: 46;
  width: min(400px, calc(100vw - 32px)); height: min(640px, calc(100dvh - 120px));
  display: none; flex-direction: column; overflow: hidden; padding: 0; margin: 0;
  background: #121514; color: var(--text); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  font-family: var(--font-sans); font-size: 0.92rem; line-height: 1.5;
}
.trx-chat-abierto .trx-chat { display: flex; animation: trx-chat-entra 0.18s ease-out; }
@keyframes trx-chat-entra { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.trx-chat-cab {
  display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px 16px;
  background: var(--bg-raise); border-bottom: 1px solid var(--line);
}
.trx-chat-cab .icono { width: 36px; height: 36px; border-radius: 50%; background: var(--teal); color: #0a0c0b; display: grid; place-items: center; flex-shrink: 0; }
.trx-chat-cab .icono svg { width: 20px; height: 20px; }
.trx-chat-cab .titulos { flex: 1; min-width: 0; }
.trx-chat-cab b { display: block; font-size: 0.95rem; }
.trx-chat-cab small { display: block; color: var(--text-dim); font-size: 0.78rem; }
.trx-chat-cab button {
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--text-dim);
  cursor: pointer; display: grid; place-items: center;
}
.trx-chat-cab button:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.trx-chat-cab button svg { width: 18px; height: 18px; }

.trx-chat-cuerpo { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.trx-chat-aviso { font-size: 0.74rem; color: var(--text-dim); text-align: center; padding: 0 10px; }
.trx-chat-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.trx-chat-msg.usuario { align-self: flex-end; background: var(--teal); color: #0a0c0b; border-bottom-right-radius: 5px; }
.trx-chat-msg.asistente { align-self: flex-start; background: var(--bg-raise); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.trx-chat-msg.asistente a { color: var(--teal-bright); }
.trx-chat-msg.asistente ul { margin: 4px 0 4px 18px; white-space: normal; }
.trx-chat-msg.asistente p + p { margin-top: 8px; }
.trx-chat-msg .puntos { display: inline-flex; gap: 4px; padding: 4px 0; }
.trx-chat-msg .puntos i { width: 6px; height: 6px; border-radius: 50%; background: var(--teal-bright); animation: trx-chat-punto 1s infinite; }
.trx-chat-msg .puntos i:nth-child(2) { animation-delay: 0.15s; }
.trx-chat-msg .puntos i:nth-child(3) { animation-delay: 0.3s; }
@keyframes trx-chat-punto { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.trx-chat-tarjetas { align-self: stretch; display: grid; gap: 8px; max-width: 88%; }
.trx-chat-tarjeta {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; text-decoration: none;
  background: rgba(0, 168, 148, 0.08); border: 1px solid rgba(47, 214, 188, 0.3); color: var(--text);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.trx-chat-tarjeta:hover { background: rgba(0, 168, 148, 0.16); border-color: var(--teal-bright); }
.trx-chat-tarjeta .txt { flex: 1; min-width: 0; }
.trx-chat-tarjeta b { display: block; font-size: 0.86rem; color: var(--teal-bright); }
.trx-chat-tarjeta small { display: block; color: var(--text-dim); font-size: 0.76rem; line-height: 1.35; }
.trx-chat-tarjeta svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--teal-bright); }

.trx-chat-sugerencias { display: flex; flex-wrap: wrap; gap: 8px; }
.trx-chat-sugerencias button {
  padding: 7px 12px; border-radius: 99px; border: 1px solid rgba(47, 214, 188, 0.45); background: transparent;
  color: var(--teal-bright); font: inherit; font-size: 0.8rem; cursor: pointer; text-align: left;
}
.trx-chat-sugerencias button:hover { background: rgba(0, 168, 148, 0.14); }

.trx-chat-pie { border-top: 1px solid var(--line); background: var(--bg-raise); padding: 10px 10px 10px 14px; display: flex; gap: 8px; align-items: flex-end; }
.trx-chat-pie textarea {
  flex: 1; resize: none; border: 0; background: transparent; color: var(--text); font: inherit; line-height: 1.4;
  max-height: 120px; padding: 8px 0; outline: none;
}
.trx-chat-pie textarea::placeholder { color: var(--text-dim); }
.trx-chat-pie button {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--teal); color: #0a0c0b; cursor: pointer;
  display: grid; place-items: center; flex-shrink: 0;
}
.trx-chat-pie button:disabled { opacity: 0.4; cursor: default; }
.trx-chat-pie button svg { width: 18px; height: 18px; }
.trx-chat-estado { font-size: 0.74rem; color: var(--text-dim); padding: 0 16px 8px; background: var(--bg-raise); min-height: 1.2em; }

@media (max-width: 640px) {
  .trx-chat { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .trx-chat-abierto .trx-chat-boton { display: none; }
  .trx-chat-boton { right: 16px; bottom: 16px; width: 54px; height: 54px; }
}
