/* ===========================================================
   Softlution — Widget del agente IA
   Estilo coherente con la web (dark + menta).
   =========================================================== */
.sl-chat,
.sl-chat * { box-sizing: border-box; }

:root {
  --sl-mint: #00E5A0;
  --sl-mint-deep: #00B37D;
  --sl-ink: #0A0B0D;
  --sl-ink-2: #101316;
  --sl-ink-3: #171B1F;
  --sl-line: rgba(255,255,255,.10);
  --sl-line-2: rgba(255,255,255,.18);
  --sl-fog: #8B9298;
  --sl-paper: #F1F3F1;
}

/* Botón flotante */
.sl-chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 9998;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 18px; border: none; border-radius: 99px; cursor: pointer;
  background: var(--sl-mint); color: var(--sl-ink);
  font-family: 'Hanken Grotesk', system-ui, sans-serif; font-weight: 600; font-size: 15px;
  box-shadow: 0 10px 30px rgba(0,229,160,.30); transition: transform .18s, box-shadow .18s, opacity .2s;
}
.sl-chat-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(0,229,160,.42); }
.sl-chat-fab svg { width: 20px; height: 20px; }
.sl-chat-fab.hidden { opacity: 0; pointer-events: none; transform: scale(.9); }

/* Ventana del chat */
.sl-chat-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 9999;
  width: min(390px, calc(100vw - 32px)); height: min(620px, calc(100vh - 40px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--sl-ink-2); border: 1px solid var(--sl-line-2); border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
  font-family: 'Hanken Grotesk', system-ui, sans-serif; color: var(--sl-paper);
  opacity: 0; transform: translateY(16px) scale(.98); pointer-events: none;
  transition: opacity .26s, transform .26s;
}
.sl-chat-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* Cabecera */
.sl-chat-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px;
  border-bottom: 1px solid var(--sl-line); background: var(--sl-ink-2);
}
.sl-chat-avatar {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: var(--sl-mint); color: var(--sl-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
}
.sl-chat-head .t { flex: 1; min-width: 0; }
.sl-chat-head .name { font-family: 'Space Grotesk', system-ui, sans-serif; font-weight: 600; font-size: 15px; }
.sl-chat-head .status { font-size: 12px; color: var(--sl-mint); display: flex; align-items: center; gap: 6px; }
.sl-chat-head .status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--sl-mint); }
.sl-chat-x {
  background: transparent; border: 1px solid var(--sl-line); color: var(--sl-fog);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 16px; line-height: 1;
  display: grid; place-items: center; transition: color .18s, border-color .18s;
}
.sl-chat-x:hover { color: var(--sl-paper); border-color: var(--sl-line-2); }

/* Cuerpo de mensajes */
.sl-chat-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.sl-chat-body::-webkit-scrollbar { width: 8px; }
.sl-chat-body::-webkit-scrollbar-thumb { background: var(--sl-line-2); border-radius: 99px; }

.sl-msg { max-width: 84%; padding: 11px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.sl-msg.bot { align-self: flex-start; background: var(--sl-ink-3); border: 1px solid var(--sl-line); border-bottom-left-radius: 5px; }
.sl-msg.user { align-self: flex-end; background: var(--sl-mint); color: var(--sl-ink); border-bottom-right-radius: 5px; font-weight: 500; }

/* Formato del texto de Softy (estilo web) */
.sl-msg.bot .sl-b { color: var(--sl-mint); font-weight: 700; }
.sl-msg.bot .sl-dot { color: var(--sl-mint); font-weight: 700; }
.sl-msg.bot .sl-code {
  background: rgba(0,229,160,.10); color: var(--sl-mint);
  padding: 1px 6px; border-radius: 5px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px;
}

/* Indicador "escribiendo" */
.sl-typing { align-self: flex-start; display: inline-flex; gap: 5px; padding: 13px 15px; background: var(--sl-ink-3); border: 1px solid var(--sl-line); border-radius: 14px; border-bottom-left-radius: 5px; }
.sl-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--sl-fog); animation: sl-bounce 1.2s infinite; }
.sl-typing span:nth-child(2) { animation-delay: .2s; }
.sl-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes sl-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Pie / input */
.sl-chat-foot { padding: 12px; border-top: 1px solid var(--sl-line); background: var(--sl-ink-2); }
.sl-chat-form { display: flex; gap: 8px; align-items: flex-end; }
.sl-chat-input {
  flex: 1; resize: none; max-height: 110px; min-height: 44px;
  background: var(--sl-ink-3); border: 1px solid var(--sl-line); border-radius: 12px;
  color: var(--sl-paper); font-family: inherit; font-size: 14.5px; padding: 11px 14px; outline: none;
  transition: border-color .18s;
}
.sl-chat-input:focus { border-color: var(--sl-mint); }
.sl-chat-input::placeholder { color: var(--sl-fog); }
/* Sin barra de scroll en el campo de texto (queda más limpio) */
.sl-chat-input { scrollbar-width: none; -ms-overflow-style: none; }
.sl-chat-input::-webkit-scrollbar { width: 0; height: 0; display: none; }
.sl-chat-send {
  flex: none; width: 44px; height: 44px; border: none; border-radius: 12px; cursor: pointer;
  background: var(--sl-mint); color: var(--sl-ink); display: grid; place-items: center;
  transition: background .18s, transform .12s;
}
.sl-chat-send:hover { background: var(--sl-mint-deep); }
.sl-chat-send:disabled { opacity: .5; cursor: not-allowed; }
.sl-chat-send svg { width: 19px; height: 19px; }
.sl-chat-legal { text-align: center; font-size: 10.5px; color: var(--sl-fog); margin-top: 8px; }

@media (max-width: 480px) {
  .sl-chat-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: none; }
  .sl-chat-fab { right: 16px; bottom: 16px; }
}
