/* ── Chat IA flotante (abajo-derecha) ───────────────────────────── */
.ig-chat-wrap {
  position: fixed;
  right: 24px;
  bottom: 32px;
  z-index: 99998;
  font-family: 'Inter', system-ui, sans-serif;
}

/* Botón burbuja */
.ig-chat-fab {
  width: 60px; height: 60px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: var(--ig-chat, #f97316);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.28);
  transition: transform .2s ease, box-shadow .2s ease;
}
.ig-chat-fab:hover { transform: scale(1.06); box-shadow: 0 14px 32px rgba(15,23,42,.35); }
.ig-chat-fab svg { width: 28px; height: 28px; }
.ig-chat-fab .ig-chat-close-ic { display: none; }
.ig-chat-wrap.is-open .ig-chat-fab .ig-chat-open-ic { display: none; }
.ig-chat-wrap.is-open .ig-chat-fab .ig-chat-close-ic { display: block; }

/* Panel */
.ig-chat-panel {
  position: absolute;
  right: 0; bottom: 74px;
  width: 370px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 130px);
  background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  display: none; flex-direction: column;
  border: 1px solid #eef1f6;
}
.ig-chat-wrap.is-open .ig-chat-panel { display: flex; animation: igChatIn .25s ease; }
@keyframes igChatIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* Header */
.ig-chat-head {
  background: var(--ig-chat, #f97316);
  color: #fff; padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
}
.ig-chat-head__ico {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ig-chat-head__ico svg { width: 22px; height: 22px; }
.ig-chat-head__txt { flex: 1; min-width: 0; }
.ig-chat-head__txt h4 { margin: 0; font-size: .95rem; font-weight: 800; line-height: 1.2; }
.ig-chat-head__txt span { font-size: .74rem; opacity: .9; display: flex; align-items: center; gap: 5px; }
.ig-chat-head__txt span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.3); }

/* Cuerpo mensajes */
.ig-chat-body {
  flex: 1; overflow-y: auto; padding: 16px;
  background: #f7f9fc;
  display: flex; flex-direction: column; gap: 10px;
}
.ig-chat-msg { max-width: 82%; padding: 10px 13px; border-radius: 14px; font-size: .88rem; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.ig-chat-msg--bot { align-self: flex-start; background: #fff; color: #0f172a; border: 1px solid #eef1f6; border-bottom-left-radius: 4px; }
.ig-chat-msg--user { align-self: flex-end; background: var(--ig-chat, #f97316); color: #fff; border-bottom-right-radius: 4px; }

/* Typing */
.ig-chat-typing { align-self: flex-start; background: #fff; border: 1px solid #eef1f6; border-radius: 14px; padding: 12px 14px; display: inline-flex; gap: 4px; }
.ig-chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; animation: igChatBlink 1.2s infinite; }
.ig-chat-typing span:nth-child(2) { animation-delay: .2s; }
.ig-chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes igChatBlink { 0%,60%,100% { opacity: .3; } 30% { opacity: 1; } }

/* Footer input */
.ig-chat-foot { padding: 10px; border-top: 1px solid #eef1f6; background: #fff; display: flex; gap: 8px; align-items: flex-end; }
.ig-chat-foot textarea {
  flex: 1; resize: none; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 10px 12px; font-size: .88rem; font-family: inherit; max-height: 90px; outline: none;
  transition: border-color .2s;
}
.ig-chat-foot textarea:focus { border-color: var(--ig-chat, #f97316); }
.ig-chat-send {
  width: 42px; height: 42px; flex-shrink: 0; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--ig-chat, #f97316); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: filter .2s, transform .15s;
}
.ig-chat-send:hover { filter: brightness(1.07); }
.ig-chat-send:disabled { opacity: .5; cursor: default; }
.ig-chat-send svg { width: 18px; height: 18px; }
.ig-chat-foot__note { position: absolute; }

@media (max-width: 480px) {
  .ig-chat-wrap { right: 16px; bottom: 20px; }
  .ig-chat-panel { right: -4px; bottom: 70px; height: 70vh; }
}
