/* ========= CHATBOT (CLARO / MINIMAL / BORDE HUNDIDO) ========= */
:root {
  --cb-bg: #f6f8fb;
  --cb-surface: #ffffff;
  --cb-text: #0f172a;
  --cb-muted: #64748b;

  --cb-border: rgba(15, 23, 42, 0.18);
  --cb-border-strong: rgba(15, 23, 42, 0.28);

  --cb-shadow-out: 0 18px 40px rgba(15, 23, 42, 0.12);
  --cb-shadow-in: inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(15, 23, 42, 0.06);

  --cb-accent: #0ea5e9;
  --cb-accent-2: #22c55e;

  --cb-radius: 18px;
}

/* ====== Botón flotante ====== */
#idappsh-chat-launcher {
  position: fixed;
  right: 18px;

  /* IMPORTANTE: se mueve por scroll con TOP (JS actualiza --cb-launcher-top) */
  bottom: auto !important;
  top: var(--cb-launcher-top, 55vh);

  width: 56px;
  height: 56px;
  border-radius: 999px;

  background: linear-gradient(180deg, #ffffff00, #eef2f700);
  border: 1px solid var(--cb-border-strong);
  box-shadow: var(--cb-shadow-out), var(--cb-shadow-in);

  color: var(--cb-text);
  cursor: pointer;
  z-index: 9999;

  display: grid;
  place-items: center;

  transform: translateY(0);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease,
    top 0.18s ease;
}

/* “Hey aquí estoy” (pulso suave) */
#idappsh-chat-launcher.is-nudging {
  animation: cbNudge 0.55s ease;
  transform: translateY(-1px);
  background: linear-gradient(180deg, #62ff6aec, #f1c70cde, #31fff5);
  color: var(--cb-text);
  border-color: rgb(101, 245, 5);
}

@keyframes cbNudge {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-2px) scale(1.03); }
  70% { transform: translateY(0) scale(1); }
  100% { transform: translateY(0) scale(1); }
}

/* Puntito estado */
#idappsh-chat-launcher::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 9px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--cb-accent);
  box-shadow: 0 0 0 3px rgba(12, 210, 236, 0.384);
  opacity: 0.95;
}

/* Hover */
#idappsh-chat-launcher:hover {
  border-color: rgba(14, 233, 124, 0.45);
  transform: translateY(-2px);
}

/* ====== Panel ====== */
#idappsh-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 155px;

  width: 380px;
  max-width: calc(100vw - 44px);
  height: 540px;
  max-height: calc(100vh - 220px);

  border-radius: var(--cb-radius);
  border: 1px solid var(--cb-border-strong);

  background: var(--cb-bg);
  box-shadow: var(--cb-shadow-out);

  overflow: hidden;
  z-index: 9999;

  display: none;
  flex-direction: column;
}

#idappsh-chat-panel.open {
  display: flex;
}

/* ====== Header ====== */
.chat-head {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;

  background: linear-gradient(180deg, #54d4df, #021e4c);
  border-bottom: 1px solid var(--cb-border);
}

.chat-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-name {
  font-weight: 800;
  color: var(--cb-text);
  font-size: 0.95rem;
}

.chat-sub {
  color: var(--cb-muted);
  font-size: 0.76rem;
}

.chat-close {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--cb-border);
  background: #100808db;
  color: var(--cb-muted);
  cursor: pointer;
  box-shadow: var(--cb-shadow-in);
  display: grid;
  place-items: center;
  transition: transform 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.chat-close:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 165, 233, 0.4);
  color: var(--cb-text);
}

/* ====== Body ====== */
.chat-body {
  flex: 1;
  padding: 14px;
  overflow: auto;
}

/* ====== Mensajes ====== */
.msg {
  font-size: 0.9rem;
  line-height: 1.35;
  padding: 10px 12px;
  border-radius: 16px;
  margin-bottom: 10px;
  max-width: 88%;
  border: 1px solid var(--cb-border);
  background: #fff;
  color: var(--cb-text);
  box-shadow: var(--cb-shadow-in);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg.assistant,
.msg.bot {
  background: #97075b5d;
}

.msg.user,
.msg.me {
  margin-left: auto;
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.12), rgba(14, 165, 233, 0.05));
  border-color: rgba(14, 165, 233, 0.28);
}

/* ====== Botones “¿Te ayudó?” ====== */
.help-row {
  margin: 6px 0 12px;
  padding: 10px 12px;
  border: 1px dashed rgba(15, 23, 42, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: var(--cb-shadow-in);
}

.help-q {
  font-size: 0.82rem;
  color: var(--cb-muted);
  margin-bottom: 8px;
}

.help-btn {
  border: 1px solid var(--cb-border);
  background: #fff;
  color: var(--cb-text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  margin-right: 8px;
  transition: transform 0.12s ease, border-color 0.12s ease, filter 0.12s ease;
}

.help-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 165, 233, 0.35);
}

.help-btn.yes { border-color: rgba(34, 197, 94, 0.28); }
.help-btn.no  { border-color: rgba(14, 165, 233, 0.28); }

/* ====== Acciones a humano (Whats/Telegram) ====== */
.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 12px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 8px 10px;
  border-radius: 12px;

  border: 1px solid rgba(15, 23, 42, 0.18);
  background: #fff;
  color: var(--cb-text);
  text-decoration: none;

  box-shadow: var(--cb-shadow-in);
  transition: transform 0.12s ease, border-color 0.12s ease, filter 0.12s ease;
}

.action-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 165, 233, 0.38);
}

/* ====== Footer ====== */
.chat-foot {
  padding: 12px;
  display: flex;
  gap: 10px;
  background: linear-gradient(180deg, #f3f6fb, #ffffff);
  border-top: 1px solid var(--cb-border);
}

#idappsh-chat-input {
  flex: 1;
  border-radius: 14px;
  border: 1px solid var(--cb-border);
  background: #ffffff;
  padding: 11px 12px;
  color: var(--cb-text);
  outline: none;
  box-shadow: var(--cb-shadow-in);
}

#idappsh-chat-input:focus {
  border-color: rgba(14, 165, 233, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 0 0 3px rgba(14, 165, 233, 0.15);
}

.chat-send {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(14, 165, 233, 0.28);
  background: linear-gradient(180deg, #0ea5e9, #0284c7);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.chat-send:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.chat-send:active {
  transform: translateY(0) scale(0.98);
}

/* ====== Responsive ====== */
@media (max-width: 700px) {
  #idappsh-chat-launcher {
    right: 16px;
    bottom: auto !important;
  }

  #idappsh-chat-panel {
    right: 16px;
    width: 92vw;
    height: 60vh;
  }
}
/* ================= ICONO PERSONALIZADO CHATBOT ================= */
/* ================= ICONO PERSONALIZADO CHATBOT ================= */

#idappsh-chat-launcher .chatbot-icon{
  display:block;
  width:60px;
  height:60px;
  background-image:url("../img/chatbotia92x192.png");
  background-position:center;
  background-repeat:no-repeat;
  background-size:contain;
  pointer-events:none;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.25));
}

/* animaciones conservadas */
#idappsh-chat-launcher.is-nudging .chatbot-icon{
  transform:scale(1.06);
  transition:transform .18s ease;
}

#idappsh-chat-launcher:hover .chatbot-icon{
  transform:scale(1.08);
  transition:transform .18s ease;
}
