/* Asistente de IA — widget flotante. Paleta de marca Gudfy. z-index scale:
   contenido<10, drawers=1000, FAB=1001, modales=9999, toasts=10000. */

.gfa-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  transition: transform .25s ease, opacity .2s ease;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
}
.gfa-stack.gfa-scroll-hidden:not(.gfa-open) { transform: translateY(140%); opacity: 0; pointer-events: none; }
body.mp-drawer-open .gfa-stack:not(.gfa-open) { transform: translateY(140%); opacity: 0; pointer-events: none; }
@media (max-width: 900px) {
  .gfa-stack { bottom: calc(86px + env(safe-area-inset-bottom)); right: 16px; }
}
@media print { .gfa-stack { display: none; } }

/* ── FAB ─────────────────────────────────────────────────────────────────── */
.gfa-fab {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: #7B2FBE; color: #fff; border: none; cursor: pointer;
  box-shadow: 0 4px 16px rgba(123, 47, 190, .45);
  transition: transform .2s ease, box-shadow .2s ease;
}
.gfa-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(123, 47, 190, .6); }
.gfa-fab:focus-visible { outline: 3px solid #27E19D; outline-offset: 3px; }
.gfa-fab svg { display: block; width: 28px; height: 28px; }
.gfa-open .gfa-fab { background: #1F0046; }

/* ── Panel ───────────────────────────────────────────────────────────────── */
.gfa-panel {
  width: 370px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 140px);
  background: #fff; border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 18px 50px rgba(31, 0, 70, .28);
  border: 1px solid #EDE5F8;
  animation: gfa-in .18s ease;
}
@keyframes gfa-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) {
  .gfa-panel { width: calc(100vw - 24px); height: calc(100vh - 120px); }
}

.gfa-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: #1F0046; color: #fff;
}
.gfa-head-t { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .95rem; }
.gfa-dot { width: 8px; height: 8px; border-radius: 50%; background: #27E19D; box-shadow: 0 0 0 3px rgba(39,225,157,.25); }
.gfa-close { background: none; border: none; color: #fff; cursor: pointer; opacity: .8; padding: 4px; border-radius: 6px; line-height: 0; }
.gfa-close:hover { opacity: 1; background: rgba(255,255,255,.12); }
.gfa-close svg { width: 18px; height: 18px; }

.gfa-msgs {
  flex: 1; overflow-y: auto; padding: 14px;
  background: #F5F0FC; display: flex; flex-direction: column; gap: 10px;
}

.gfa-msg { max-width: 85%; padding: 9px 12px; border-radius: 14px; font-size: .88rem; line-height: 1.45; word-wrap: break-word; }
.gfa-msg.user { align-self: flex-end; background: #7B2FBE; color: #fff; border-bottom-right-radius: 4px; }
.gfa-msg.assistant { align-self: flex-start; background: #fff; color: #1a0a30; border: 1px solid #EDE5F8; border-bottom-left-radius: 4px; }
.gfa-msg a { color: inherit; text-decoration: underline; }
.gfa-msg.assistant a { color: #7B2FBE; }
.gfa-msg code { background: rgba(123,47,190,.1); padding: 1px 5px; border-radius: 5px; font-size: .85em; }

.gfa-sources { align-self: flex-start; font-size: .68rem; color: #7a5fa0; margin-top: -4px; padding: 0 4px; }

/* Escalación a humano */
.gfa-esc {
  align-self: flex-start; max-width: 85%;
  background: #ECFDF5; border: 1px solid #27E19D; border-radius: 14px; padding: 12px;
}
.gfa-esc-t { font-size: .82rem; color: #0F9E6A; font-weight: 700; margin-bottom: 8px; }
.gfa-esc-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #25D366; color: #fff; text-decoration: none;
  padding: 8px 14px; border-radius: 9px; font-weight: 700; font-size: .85rem;
}
.gfa-esc-btn:hover { background: #1faa52; }

/* Typing indicator */
.gfa-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: #fff; border: 1px solid #EDE5F8; border-radius: 14px; }
.gfa-typing span { width: 7px; height: 7px; border-radius: 50%; background: #b79fd6; animation: gfa-bounce 1.2s infinite; }
.gfa-typing span:nth-child(2) { animation-delay: .2s; }
.gfa-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes gfa-bounce { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Input */
.gfa-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #EDE5F8; background: #fff; }
.gfa-input { flex: 1; border: 1px solid #EDE5F8; border-radius: 10px; padding: 9px 12px; font-size: .9rem; font-family: inherit; outline: none; color: #1a0a30; }
.gfa-input:focus { border-color: #7B2FBE; box-shadow: 0 0 0 3px rgba(123,47,190,.12); }
.gfa-send { background: #7B2FBE; color: #fff; border: none; border-radius: 10px; width: 42px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.gfa-send:hover { background: #6a26a6; }
.gfa-send svg { width: 18px; height: 18px; }

.gfa-foot { font-size: .66rem; color: #9a86bd; text-align: center; padding: 6px 10px 9px; background: #fff; }
