/* =====================================================================
   ASISTENTES DEL SITIO · Ing. Bot-dinez 🤖 + Ing. Glor-IA ✨
   Usa las variables del sitio → funciona en modo claro y oscuro solos.
   ===================================================================== */
:root {
  --as-gl: #c2429b;        /* color distintivo de la Ing. Glor-IA (claro) */
}
:root[data-theme="dark"] {
  --as-gl: #f08cc8;        /* Glor-IA en oscuro */
}

/* ---------- botón flotante ---------- */
.as-btn {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 99;
  width: 58px; height: 58px; border-radius: 50%;
  border: none; cursor: pointer;
  background: var(--accent); color: var(--accent-contrast);
  display: grid; place-items: center;
  box-shadow: var(--card-shadow-hover);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.as-btn:hover { transform: translateY(-3px) scale(1.04); }

/* ---------- panel ---------- */
.as-panel {
  position: fixed; right: 18px; bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  width: min(390px, calc(100vw - 24px));
  height: min(590px, 72vh);
  display: flex; flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border-color); border-radius: 20px;
  box-shadow: var(--card-shadow-hover);
  overflow: hidden;
  transform: translateY(14px) scale(0.97); opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}
.as-panel.is-open { transform: none; opacity: 1; }
@media (max-width: 520px) {
  .as-panel { right: 12px; left: 12px; width: auto; height: min(560px, 70vh); }
}

/* ---------- cabecera ---------- */
.as-head {
  flex: none;
  display: flex; align-items: center; gap: 11px;
  padding: 13px 14px;
  background: var(--accent); color: var(--accent-contrast);
}
.as-avatar {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  display: grid; place-items: center; font-size: 20px;
}
.as-head-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.as-head-txt strong { font-family: "Poppins", sans-serif; font-size: 0.95rem; }
.as-head-txt small { font-size: 0.72rem; opacity: 0.85; }
.as-close {
  margin-left: auto; flex: none;
  width: 34px; height: 34px; border-radius: 10px;
  border: none; cursor: pointer;
  background: rgba(255, 255, 255, 0.16); color: inherit;
  font-size: 20px; line-height: 1;
}

/* ---------- mensajes ---------- */
.as-msgs {
  flex: 1; overflow-y: auto;
  padding: 14px 12px 8px;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg-primary, transparent);
  scrollbar-width: thin;
}
.asb {
  max-width: 88%;
  border-radius: 15px; padding: 9px 13px;
  font-size: 0.88rem; line-height: 1.5;
}
.asb p { margin: 0; }
.asb p + p { margin-top: 0.45em; }
.asb-bot {
  align-self: flex-start;
  background: var(--bg-tertiary, var(--card-bg));
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 5px;
  color: var(--text-primary);
}
.asb-user {
  align-self: flex-end;
  background: var(--accent); color: var(--accent-contrast);
  border-bottom-right-radius: 5px;
}
.as-precio { color: var(--accent); font-weight: 800; font-variant-numeric: tabular-nums; }

/* etiqueta de quién habla (aparece al cambiar de asistente) */
.as-quien {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em;
  color: var(--text-secondary);
  margin-bottom: 3px;
}
.asb-gl .as-quien { color: var(--as-gl); }

/* ---------- chips ---------- */
.as-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 4px; }
.as-chip {
  font-size: 0.76rem; font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: none; border-radius: 999px;
  padding: 0.45em 0.95em;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.as-chip:hover { transform: translateY(-1px); filter: brightness(1.05); }

/* ---------- indicador "escribiendo…" ---------- */
.as-typing {
  align-self: flex-start;
  display: inline-flex; gap: 4px;
  background: var(--bg-tertiary, var(--card-bg));
  border: 1px solid var(--border-color);
  border-radius: 15px; border-bottom-left-radius: 5px;
  padding: 11px 14px;
}
.as-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-secondary);
  animation: as-pulse 1.1s infinite ease-in-out;
}
.as-typing span:nth-child(2) { animation-delay: 0.15s; }
.as-typing span:nth-child(3) { animation-delay: 0.3s; }
.as-typing-gl span { background: var(--as-gl); }
@keyframes as-pulse {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

/* ---------- formulario ---------- */
.as-form {
  flex: none;
  display: flex; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
  background: var(--card-bg);
}
.as-input {
  flex: 1; min-width: 0;
  border: 1px solid var(--border-color); border-radius: 12px;
  background: var(--bg-secondary); color: var(--text-primary);
  padding: 10px 13px; font-size: 16px; /* 16px evita el auto-zoom de iOS al enfocar */
  font-family: inherit;
}
.as-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.as-send {
  flex: none; width: 42px; border-radius: 12px;
  border: none; cursor: pointer;
  background: var(--accent); color: var(--accent-contrast);
  font-size: 15px;
}

@media (prefers-reduced-motion: reduce) {
  .as-btn, .as-panel, .as-chip { transition: none !important; }
  .as-typing span { animation: none !important; }
}
