/* СуперМагнит — ИИ-помощник (виджет) */

/* ---------- boton flotante ---------- */
/* bottom:76px deja libre el boton de "revisitar cookies" de CookieYes */
#sm-bot-btn{position:fixed;bottom:76px;z-index:2147482000;width:56px;height:56px;border-radius:50%;
  background:#ff0004;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}
#sm-bot-btn:hover{box-shadow:0 10px 28px rgba(0,0,0,.34)}
#sm-bot-btn svg{width:26px !important;height:26px !important;fill:#fff;display:block}
#sm-bot-btn .sm-bot-dot{position:absolute;top:-3px;right:-3px;width:14px;height:14px;border-radius:50%;
  background:#22c55e;border:2px solid #fff}
#sm-bot-btn.sm-bot-away{opacity:0;transform:translateY(14px) scale(.85);pointer-events:none}
body.sm-bot-left #sm-bot-btn{left:24px}
body.sm-bot-right #sm-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. */


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

/* ---------- panel ----------
   En escritorio va centrado en la pantalla: escribir en una esquina
   resulta incomodo cuando la conversacion es larga. */
#sm-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.sm-bot-left #sm-bot-panel,
body.sm-bot-right #sm-bot-panel{left:50%;right:auto}
#sm-bot-panel.sm-open{display:flex}
#sm-bot-panel .sm-bot-msg{max-width:76%}

/* ---------- cabecera ---------- */
.sm-bot-head{background:#141518;color:#fff;padding:14px 16px;display:flex;align-items:center;gap:10px;flex:0 0 auto}
.sm-bot-head .sm-bot-av{width:36px;height:36px;border-radius:50%;background:#ff0004;display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.sm-bot-head .sm-bot-av svg{width:18px;height:18px;fill:#fff}
.sm-bot-head b{display:block;font-size:15px;line-height:1.3}
.sm-bot-head span{display:block;font-size:12.5px;opacity:.72;line-height:1.3}
.sm-bot-title{flex:1 1 auto;min-width:0}
.sm-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}
.sm-bot-reset svg{width:18px !important;height:18px !important;fill:none;stroke:#fff;stroke-width:2.2;stroke-linecap:round}
.sm-bot-reset:hover{opacity:1;background:rgba(255,255,255,.1)}
.sm-bot-close{background:none;border:none;color:#fff;font-size:26px;line-height:1;cursor:pointer;
  opacity:.8;padding:2px 8px;border-radius:8px}
.sm-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 */
.sm-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}
.sm-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}
.sm-bot-msg.bot{background:#fff;border:1px solid #e6e8eb;align-self:flex-start;border-bottom-left-radius:5px}
.sm-bot-msg.me{background:#ff0004;color:#fff;align-self:flex-end;border-bottom-right-radius:5px}
.sm-bot-msg a{color:inherit;text-decoration:underline}
.sm-bot-msg.bot a{color:#d80008}
.sm-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}
.sm-bot-typing i{width:7px;height:7px;border-radius:50%;background:#b9bec4;animation:ndb 1s infinite}
.sm-bot-typing i:nth-child(2){animation-delay:.15s}
.sm-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 ---------- */
.sm-bot-chips{display:flex;flex-wrap:wrap;gap:7px;padding:0 16px 12px;background:#f7f8f9;flex:0 0 auto}
.sm-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}
.sm-bot-chip:hover{border-color:#ff0004;color:#ff0004}

/* ---------- pie con el campo ---------- */
.sm-bot-foot{flex:0 0 auto;border-top:1px solid #e6e8eb;background:#fff;
  padding:10px 12px calc(10px + env(safe-area-inset-bottom, 0px))}
.sm-bot-form{display:flex;gap:8px;align-items:flex-end}
.sm-bot-form textarea{flex:1 1 auto;resize:none !important;border:1.5px solid #d9dce0 !important;border-radius:10px !important;padding:11px 12px !important;
  font-size:16px !important;line-height:1.4 !important;font-family:inherit !important;height:46px !important;min-height:46px !important;max-height:110px !important;
  color:#1c1e21 !important;background:#fff !important;box-shadow:none !important;margin:0 !important;box-sizing:border-box !important;width:auto !important;
  transition:border-color .15s ease}
.sm-bot-form textarea::placeholder{color:#8f949b;opacity:1}
.sm-bot-form textarea:focus{outline:none;border-color:#ff0004;box-shadow:0 0 0 3px rgba(255,0,4,.10)}
.sm-bot-send{flex:0 0 auto;width:46px !important;height:46px !important;min-width:0 !important;padding:0 !important;margin:0 !important;border-radius:10px !important;border:none !important;background:#ff0004 !important;cursor:pointer;
  display:flex;align-items:center;justify-content:center}
.sm-bot-send:disabled{opacity:.45;cursor:default}
.sm-bot-send svg{width:19px !important;height:19px !important;fill:#fff;display:block;flex:0 0 auto}
.sm-bot-note{display:block;margin-top:8px;font-size:11.5px;color:#8a8f96;line-height:1.45}
.sm-bot-note a{color:#8a8f96;text-decoration:underline}
.sm-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. */
  #sm-bot-btn{bottom:86px;width:52px;height:52px}
  body.sm-bot-left #sm-bot-btn{left:16px;right:auto;margin-left:0}
  body.sm-bot-right #sm-bot-btn{right:16px;left:auto;margin-left:0}

  /* Con el menu lateral abierto el boton estorba: se aparta. */
  body.menu-open #sm-bot-btn{display:none !important}

  /* Pantalla completa y anclado arriba: la altura la fija el JS con visualViewport,
     asi el teclado no descoloca nada. */
  #sm-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.sm-bot-left #sm-bot-panel,
  body.sm-bot-right #sm-bot-panel{left:0 !important;right:0 !important}
  #sm-bot-panel .sm-bot-msg{max-width:86%}
  #sm-bot-back{display:none !important}
  .sm-bot-head{padding:12px 14px}
  .sm-bot-body{padding:14px}
  .sm-bot-chips{padding:0 14px 10px}
  .sm-bot-foot{padding:10px 12px calc(10px + env(safe-area-inset-bottom, 0px))}

  body.sm-bot-open jdiv{display:none !important}

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

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

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

