/* NEODMAG Asistente IA — widget */

/* ---------- boton flotante ---------- */
/* bottom:76px deja libre el boton de "revisitar cookies" de CookieYes */
#nd-bot-btn{position:fixed;bottom:76px;z-index:2147482000;width:56px;height:56px;border-radius:50%;
  background:#E31E24;border:none;cursor:pointer;box-shadow:0 6px 22px rgba(0,0,0,.28);
  display:flex;align-items:center;justify-content:center;
  transition:transform .22s ease,opacity .22s ease,box-shadow .18s ease}
#nd-bot-btn:hover{box-shadow:0 10px 28px rgba(0,0,0,.34)}
#nd-bot-btn svg{width:26px !important;height:26px !important;fill:#fff;display:block}
#nd-bot-btn .nd-bot-dot{position:absolute;top:-3px;right:-3px;width:14px;height:14px;border-radius:50%;
  background:#22c55e;border:2px solid #fff}
#nd-bot-btn.nd-bot-away{opacity:0;transform:translateY(14px) scale(.85);pointer-events:none}
body.nd-bot-left #nd-bot-btn{left:24px}
body.nd-bot-right #nd-bot-btn{right:24px}
/* En escritorio el boton va centrado abajo: en la esquina pasaba desapercibido.
   Se centra con margin, no con transform, para no romper la animacion de ocultar. */
@media (min-width:1000px){
  body.nd-bot-left #nd-bot-btn,
  body.nd-bot-right #nd-bot-btn{left:50%;right:auto;margin-left:-28px}
}

/* ---------- fondo oscuro (solo escritorio) ---------- */
#nd-bot-back{position:fixed;inset:0;z-index:2147482900;background:rgba(15,17,20,.45);
  display:none;opacity:0;transition:opacity .18s ease}
#nd-bot-back.nd-open{display:block;opacity:1}

/* ---------- panel ----------
   En escritorio va centrado en la pantalla: escribir en una esquina
   resulta incomodo cuando la conversacion es larga. */
#nd-bot-panel{position:fixed;z-index:2147483000;
  top:50%;left:50%;transform:translate(-50%,-50%);
  width:560px;max-width:calc(100vw - 48px);
  height:min(680px,calc(100vh - 80px));background:#fff;border-radius:16px;overflow:hidden;
  box-shadow:0 24px 80px rgba(0,0,0,.35);display:none;flex-direction:column;
  font-family:inherit;color:#1c1e21}
body.nd-bot-left #nd-bot-panel,
body.nd-bot-right #nd-bot-panel{left:50%;right:auto}
#nd-bot-panel.nd-open{display:flex}
#nd-bot-panel .nd-bot-msg{max-width:76%}

/* ---------- cabecera ---------- */
.nd-bot-head{background:#141518;color:#fff;padding:14px 16px;display:flex;align-items:center;gap:10px;flex:0 0 auto}
.nd-bot-head .nd-bot-av{width:36px;height:36px;border-radius:50%;background:#E31E24;display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.nd-bot-head .nd-bot-av svg{width:18px;height:18px;fill:#fff}
.nd-bot-head b{display:block;font-size:15px;line-height:1.3}
.nd-bot-head span{display:block;font-size:12.5px;opacity:.72;line-height:1.3}
.nd-bot-title{flex:1 1 auto;min-width:0}
.nd-bot-reset{margin-left:auto;background:none;border:none;color:#fff;cursor:pointer;opacity:.72;
  padding:5px 7px;border-radius:8px;display:flex;align-items:center}
.nd-bot-reset svg{width:18px !important;height:18px !important;fill:none;stroke:#fff;stroke-width:2.2;stroke-linecap:round}
.nd-bot-reset:hover{opacity:1;background:rgba(255,255,255,.1)}
.nd-bot-close{background:none;border:none;color:#fff;font-size:26px;line-height:1;cursor:pointer;
  opacity:.8;padding:2px 8px;border-radius:8px}
.nd-bot-close:hover{opacity:1;background:rgba(255,255,255,.1)}

/* ---------- conversacion ----------
   min-height:0 es lo que impide que el panel "crezca" y se descoloque */
.nd-bot-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;padding:16px;background:#f7f8f9;display:flex;flex-direction:column;gap:10px}
.nd-bot-msg{max-width:86%;padding:10px 13px;border-radius:14px;font-size:14.5px;line-height:1.55;
  white-space:pre-wrap;word-wrap:break-word;overflow-wrap:anywhere}
.nd-bot-msg.bot{background:#fff;border:1px solid #e6e8eb;align-self:flex-start;border-bottom-left-radius:5px}
.nd-bot-msg.me{background:#E31E24;color:#fff;align-self:flex-end;border-bottom-right-radius:5px}
.nd-bot-msg a{color:inherit;text-decoration:underline}
.nd-bot-msg.bot a{color:#c8161d}
.nd-bot-typing{display:flex;gap:4px;padding:12px 14px;background:#fff;border:1px solid #e6e8eb;
  border-radius:14px;align-self:flex-start;width:fit-content;flex:0 0 auto}
.nd-bot-typing i{width:7px;height:7px;border-radius:50%;background:#b9bec4;animation:ndb 1s infinite}
.nd-bot-typing i:nth-child(2){animation-delay:.15s}
.nd-bot-typing i:nth-child(3){animation-delay:.3s}
@keyframes ndb{0%,60%,100%{opacity:.3;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}

/* ---------- sugerencias ---------- */
.nd-bot-chips{display:flex;flex-wrap:wrap;gap:7px;padding:0 16px 12px;background:#f7f8f9;flex:0 0 auto}
.nd-bot-chip{border:1px solid #d9dce0;background:#fff;border-radius:16px;padding:7px 12px;font-size:13px;
  cursor:pointer;color:#33373d;line-height:1.3;font-family:inherit}
.nd-bot-chip:hover{border-color:#E31E24;color:#E31E24}

/* ---------- pie con el campo ---------- */
.nd-bot-foot{flex:0 0 auto;border-top:1px solid #e6e8eb;background:#fff;
  padding:10px 12px calc(10px + env(safe-area-inset-bottom, 0px))}
.nd-bot-form{display:flex;gap:8px;align-items:flex-end}
.nd-bot-form textarea{flex:1 1 auto;resize:none;border:1.5px solid #d9dce0;border-radius:10px;padding:11px 12px;
  font-size:16px;line-height:1.4;font-family:inherit;height:46px;max-height:110px;color:#1c1e21;background:#fff;
  transition:border-color .15s ease}
.nd-bot-form textarea::placeholder{color:#8f949b;opacity:1}
.nd-bot-form textarea:focus{outline:none;border-color:#E31E24;box-shadow:0 0 0 3px rgba(227,30,36,.10)}
.nd-bot-send{flex:0 0 auto;width:46px;height:46px;border-radius:10px;border:none;background:#E31E24;cursor:pointer;
  display:flex;align-items:center;justify-content:center}
.nd-bot-send:disabled{opacity:.45;cursor:default}
.nd-bot-send svg{width:19px !important;height:19px !important;fill:#fff;display:block;flex:0 0 auto}
.nd-bot-note{display:block;margin-top:8px;font-size:11.5px;color:#8a8f96;line-height:1.45}
.nd-bot-note a{color:#8a8f96;text-decoration:underline}
.nd-bot-hp{position:absolute;left:-9999px;width:1px;height:1px;opacity:0}

/* ---------- movil ---------- */
@media (max-width:999px){
  /* A la derecha: en el lado izquierdo tapaba las lineas del menu desplegable. */
  #nd-bot-btn{bottom:84px;width:52px;height:52px}
  body.nd-bot-left #nd-bot-btn,
  body.nd-bot-right #nd-bot-btn{left:auto;right:16px;margin-left:0}

  /* Con el menu lateral abierto el boton estorba: se aparta. */
  body.nd-cd-open #nd-bot-btn,
  body.ct-panel-active #nd-bot-btn{display:none !important}

  /* Pantalla completa y anclado arriba: la altura la fija el JS con visualViewport,
     asi el teclado no descoloca nada. */
  #nd-bot-panel{top:0;left:0 !important;right:0 !important;bottom:auto;transform:none;
    width:100%;max-width:100%;height:100dvh;border-radius:0}
  body.nd-bot-left #nd-bot-panel,
  body.nd-bot-right #nd-bot-panel{left:0 !important;right:0 !important}
  #nd-bot-panel .nd-bot-msg{max-width:86%}
  #nd-bot-back{display:none !important}
  .nd-bot-head{padding:12px 14px}
  .nd-bot-body{padding:14px}
  .nd-bot-chips{padding:0 14px 10px}
  .nd-bot-foot{padding:10px 12px calc(10px + env(safe-area-inset-bottom, 0px))}

  /* Con el chat abierto los demas botones flotantes taparian el campo */
  body.nd-bot-open #ht-ctc-chat,
  body.nd-bot-open .ht-ctc,
  body.nd-bot-open .cky-btn-revisit-wrapper{display:none !important}

  /* Bloqueo del fondo: evita que la pagina se mueva detras del chat */
  body.nd-bot-lock{position:fixed;left:0;right:0;width:100%;overflow:hidden}
}

/* Con el chat abierto no deben aparecer popups encima */
body.nd-bot-open .ct-popup,
body.nd-bot-open [class*="ct-popup"],
body.nd-bot-open .pum-overlay{display:none !important}

@media (prefers-reduced-motion:reduce){
  #nd-bot-btn,.nd-bot-typing i{transition:none;animation:none}
}

/* El icono flotante de configuracion de cookies estorbaba en movil y en
   escritorio; el enlace sigue disponible en el pie de pagina.
   CookieYes inyecta su estilo despues del nuestro, asi que hace falta
   mas especificidad (ademas el JS lo retira del documento). */
html body .cky-btn-revisit-wrapper,
html body .cky-revisit-bottom-left,
html body .cky-revisit-bottom-right,
html body [class*="cky-revisit"]{display:none !important;visibility:hidden !important;
  opacity:0 !important;pointer-events:none !important}

/* Boton apartado con un deslizamiento: se esconde tras el borde y asoma una pestana */
.nd-bot-tab{position:fixed;bottom:88px;z-index:2147482001;width:26px;height:44px;border:none;border-radius:8px 0 0 8px;
  background:#E31E24;color:#fff;cursor:pointer;display:none;align-items:center;justify-content:center;
  box-shadow:0 4px 14px rgba(0,0,0,.25);padding:0}
.nd-bot-tab svg{width:16px !important;height:16px !important;fill:none;stroke:#fff;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
body.nd-bot-left .nd-bot-tab{left:0;border-radius:0 8px 8px 0;transform:scaleX(-1)}
body.nd-bot-right .nd-bot-tab{right:0}
@media (max-width:999px){ .nd-bot-tab{right:0 !important;left:auto !important;border-radius:8px 0 0 8px !important;transform:none !important;bottom:96px} }
body.nd-bot-docked #nd-bot-btn{display:none !important}
body.nd-bot-docked .nd-bot-tab{display:flex}
body.nd-bot-open .nd-bot-tab{display:none !important}
