/* Agente web de Autbyt (2026-11-04): burbuja + panel de chat del sitio
   público. Clases con prefijo sa- para no chocar con styles.css.
   Azul de marca #158CF2. Móvil primero: el panel nunca tapa toda la
   pantalla y la burbuja vive sobre el contenido (position: fixed). */
.sa-bubble {
  position: fixed; right: 18px; bottom: 18px; z-index: 1200;
  display: flex; align-items: center; gap: 9px;
  background: #158CF2; color: #fff; border: none; cursor: pointer;
  border-radius: 999px; padding: 12px 18px 12px 14px;
  font: 600 0.95rem/1.1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 10px 28px rgba(21, 140, 242, 0.42), 0 3px 8px rgba(0, 0, 0, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.sa-bubble:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(21, 140, 242, 0.5), 0 4px 10px rgba(0, 0, 0, 0.3); }
.sa-bubble:focus-visible { outline: 3px solid rgba(21, 140, 242, 0.55); outline-offset: 2px; }
.sa-bubble .sa-avatar {
  width: 26px; height: 26px; display: block; flex: none;
  border-radius: 50%; object-fit: cover; background: #fdf6ec;
}
.sa-bubble .sa-dot {
  position: absolute; top: -3px; right: -3px; width: 14px; height: 14px;
  border-radius: 50%; background: #f59e0b; border: 2px solid #0b1220; display: none;
}
.sa-bubble.sa-has-new .sa-dot { display: block; }

.sa-panel {
  position: fixed; right: 18px; bottom: 86px; z-index: 1201;
  width: min(372px, calc(100vw - 24px));
  height: min(560px, calc(100dvh - 120px));
  display: flex; flex-direction: column;
  background: #0e1626; color: #e8eefc;
  border: 1px solid rgba(96, 165, 250, 0.35); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  font: 400 0.95rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.sa-panel[hidden] { display: none; }
.sa-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px; background: linear-gradient(135deg, #158CF2, #0b5cad);
  color: #fff; flex: none;
}
.sa-head .sa-avatar-wrap { flex: none; display: block; line-height: 0; }
.sa-head .sa-avatar {
  width: 40px; height: 40px; display: block;
  border-radius: 50%; object-fit: cover; background: #fdf6ec;
}
.sa-head .sa-title { font-weight: 800; font-size: 1rem; line-height: 1.15; }
.sa-head .sa-sub { font-size: 0.78rem; opacity: 0.88; line-height: 1.2; }
.sa-close {
  margin-left: auto; background: rgba(255, 255, 255, 0.16); color: #fff;
  border: none; width: 30px; height: 30px; border-radius: 50%;
  font-size: 1rem; cursor: pointer; flex: none; line-height: 1;
}
.sa-body {
  flex: 1; overflow-y: auto; padding: 14px 12px; display: flex;
  flex-direction: column; gap: 10px; scroll-behavior: smooth;
}
.sa-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.sa-msg.sa-bot { background: #1a2740; border: 1px solid rgba(96, 165, 250, 0.22); align-self: flex-start; border-bottom-left-radius: 4px; }
.sa-msg.sa-user { background: #158CF2; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.sa-msg.sa-note { background: transparent; border: 1px dashed rgba(245, 158, 11, 0.55); color: #fcd9a0; align-self: stretch; max-width: 100%; font-size: 0.86rem; }
.sa-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.sa-chip {
  background: rgba(21, 140, 242, 0.14); color: #a9cdff;
  border: 1px solid rgba(21, 140, 242, 0.5); border-radius: 999px;
  padding: 6px 12px; font-size: 0.85rem; cursor: pointer;
}
.sa-chip:hover { background: rgba(21, 140, 242, 0.3); color: #fff; }
.sa-wa-row { align-self: flex-start; margin-top: -4px; }
.sa-wa-btn {
  background: #25d366; color: #fff; border: none; border-radius: 999px;
  padding: 9px 16px; font-weight: 700; font-size: 0.9rem; cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
}
.sa-wa-btn:hover { background: #1fb857; }
.sa-lead {
  background: #131f36; border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.sa-lead[hidden] { display: none; }
.sa-lead h4 { margin: 0; font-size: 0.92rem; color: #fff; }
.sa-lead label { font-size: 0.8rem; color: #a9b8d8; display: flex; flex-direction: column; gap: 4px; }
.sa-lead input {
  background: #0b1220; border: 1px solid rgba(96, 165, 250, 0.35); color: #fff;
  border-radius: 9px; padding: 8px 10px; font-size: 0.92rem; width: 100%; box-sizing: border-box;
}
.sa-lead .sa-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.sa-btn {
  background: #158CF2; color: #fff; border: none; border-radius: 10px;
  padding: 9px 14px; font-weight: 700; cursor: pointer; font-size: 0.92rem;
}
.sa-btn:disabled { opacity: 0.55; cursor: wait; }
.sa-err { color: #fda4af; font-size: 0.84rem; min-height: 1em; }
.sa-foot { flex: none; display: flex; gap: 8px; padding: 10px; border-top: 1px solid rgba(96, 165, 250, 0.22); background: #0b1220; }
.sa-foot input {
  flex: 1; background: #131f36; border: 1px solid rgba(96, 165, 250, 0.35);
  color: #fff; border-radius: 10px; padding: 10px 12px; font-size: 0.95rem; min-width: 0;
}
.sa-send {
  background: #158CF2; color: #fff; border: none; border-radius: 10px;
  width: 44px; font-size: 1.05rem; cursor: pointer; flex: none;
}
.sa-send:disabled { opacity: 0.55; cursor: wait; }
@media (max-width: 480px) {
  .sa-bubble { right: 12px; bottom: 12px; padding: 11px 15px 11px 12px; }
  .sa-panel { right: 12px; bottom: 74px; width: calc(100vw - 24px); height: min(520px, calc(100dvh - 96px)); }
}
@media (prefers-reduced-motion: reduce) {
  .sa-bubble { transition: none; }
  .sa-body { scroll-behavior: auto; }
}
