/* Chat con IA de la tienda (includes/tienda_chat_widget.php, assets/js/tienda-chat.js). Toma el color de la tienda. */
.tchat { --tchat-acento: var(--primary, #111); --tchat-fondo: #fff; --tchat-texto: #1d1d1f; --tchat-suave: #f2f3f5; --tchat-borde: #e3e5e8; --tchat-gris: #6b7280; }
.tchat-boton {
  position: fixed; right: 28px; bottom: 28px; z-index: 1040;
  width: 60px; height: 60px; border-radius: 50%; border: 0;
  background: var(--tchat-acento); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.28); transition: transform .2s, box-shadow .2s;
}
.tchat--con-wa .tchat-boton { bottom: 100px; }
.tchat-boton:hover { transform: scale(1.08); box-shadow: 0 6px 22px rgba(0,0,0,.35); }
.tchat-boton:focus-visible { outline: 3px solid #fff; box-shadow: 0 0 0 6px var(--tchat-acento); }
.tchat.abierto .tchat-boton { transform: scale(.92); }

.tchat-panel {
  position: fixed; right: 28px; bottom: 100px; z-index: 1041;
  width: 370px; height: min(560px, calc(100vh - 140px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--tchat-fondo); color: var(--tchat-texto);
  border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.25);
  font-size: 14.5px; line-height: 1.45;
}
.tchat--con-wa .tchat-panel { bottom: 172px; height: min(560px, calc(100vh - 212px)); }
.tchat-panel[hidden] { display: none; }

.tchat-cab { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--tchat-acento); color: #fff; }
.tchat-cab-titulo { font-weight: 600; font-size: 15px; flex: 1; min-width: 0; }
.tchat-cab-sub { font-size: 12px; opacity: .85; font-weight: 400; }
.tchat-cerrar { background: transparent; border: 0; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 22px; line-height: 1; }
.tchat-cerrar:hover, .tchat-cerrar:focus-visible { background: rgba(255,255,255,.18); outline: none; }

.tchat-mensajes { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--tchat-suave); }
.tchat-msg { max-width: 85%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tchat-msg--asistente { align-self: flex-start; background: var(--tchat-fondo); border: 1px solid var(--tchat-borde); border-bottom-left-radius: 4px; }
.tchat-msg--usuario { align-self: flex-end; background: var(--tchat-acento); color: #fff; border-bottom-right-radius: 4px; }
.tchat-msg a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.tchat-msg ul { margin: 4px 0; padding-left: 18px; white-space: normal; }
.tchat-escribiendo { align-self: flex-start; color: var(--tchat-gris); font-size: 13px; padding: 4px 2px; }
.tchat-escribiendo span { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: currentColor; animation: tchat-punto 1.2s infinite ease-in-out; }
.tchat-escribiendo span:nth-child(2) { animation-delay: .15s; }
.tchat-escribiendo span:nth-child(3) { animation-delay: .3s; }
@keyframes tchat-punto { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.tchat-atajos { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; background: var(--tchat-suave); }
.tchat-atajo { border: 1px solid var(--tchat-borde); background: var(--tchat-fondo); color: var(--tchat-texto); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.tchat-atajo:hover, .tchat-atajo:focus-visible { border-color: var(--tchat-acento); outline: none; }

.tchat-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--tchat-borde); background: var(--tchat-fondo); }
.tchat-input { flex: 1; resize: none; border: 1px solid var(--tchat-borde); border-radius: 12px; padding: 9px 12px; font: inherit; max-height: 110px; min-height: 40px; color: var(--tchat-texto); background: var(--tchat-fondo); }
.tchat-input:focus { outline: none; border-color: var(--tchat-acento); }
.tchat-enviar { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0; background: var(--tchat-acento); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.tchat-enviar:disabled { opacity: .45; cursor: default; }
.tchat-aviso { font-size: 11.5px; color: var(--tchat-gris); padding: 0 14px 10px; background: var(--tchat-fondo); }
.tchat-aviso a { color: inherit; text-decoration: underline; }

@media (max-width: 575px) {
  .tchat-boton { right: 16px; bottom: 16px; width: 54px; height: 54px; }
  .tchat--con-wa .tchat-boton { bottom: 82px; }
  .tchat-panel, .tchat--con-wa .tchat-panel { right: 0; bottom: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tchat-boton, .tchat-escribiendo span { transition: none; animation: none; }
}
