/* === DOCK DEL ASISTENTE IA =====================================
   Un unico contenedor fijo. El boton violeta, el teaser y el panel
   viven adentro: el teaser y el panel se posicionan SIEMPRE respecto
   de este wrapper, nunca respecto del viewport ni del boton blanco. */
.ai-dock{
  position:fixed; right:24px; bottom:24px; z-index:75;
  width:58px; height:58px;
}
.ai-float-btn{
  position:relative; z-index:3; width:58px; height:58px; border-radius:50%;
  background:var(--violet); border:0; cursor:pointer; display:grid; place-items:center; color:#fff;
  box-shadow:0 12px 32px -8px rgba(124,58,237,.55); transition:transform .4s var(--ease), box-shadow .4s var(--ease);
}
.ai-float-btn::after{
  content:''; position:absolute; inset:-6px; border-radius:50%; border:1.5px solid rgba(124,58,237,.35);
  animation:pulse 2.6s infinite;
}
@keyframes pulse{0%{transform:scale(.95); opacity:.8}70%{transform:scale(1.25); opacity:0}100%{opacity:0}}
.ai-float-btn:hover{transform:scale(1.08); box-shadow:0 16px 40px -8px rgba(124,58,237,.7)}
/* el boton blanco de compartir solo comparte: se aparta cuando el chat abre */
body.chat-open .fab{opacity:0; transform:translateY(10px); pointer-events:none}
.fab{transition:opacity .35s var(--ease), transform .35s var(--ease)}
.ai-float-btn svg{width:26px; height:26px}
.ai-chat-window{
  position:absolute; right:0; bottom:calc(100% + 14px); z-index:2;
  width:380px; max-width:calc(100vw - 32px); height:min(560px,70vh); background:#fff;
  border:1px solid var(--line); border-radius:22px; box-shadow:0 40px 90px -30px rgba(12,10,30,.35);
  display:none; flex-direction:column; overflow:hidden;
}
.ai-chat-window.open{display:flex; animation:aiUp .45s var(--ease)}
@keyframes aiUp{from{opacity:0; transform:translateY(14px) scale(.98)}to{opacity:1; transform:none}}
.ai-chat-header{
  background:var(--ink); color:#fff; padding:18px 22px; display:flex; align-items:center; justify-content:space-between;
}
.ai-chat-title{font-size:.95rem; font-weight:800; letter-spacing:-.01em; display:flex; align-items:center; gap:8px}
.ai-chat-title .live{width:7px; height:7px; border-radius:50%; background:#34D399; box-shadow:0 0 0 3px rgba(52,211,153,.2)}
.ai-chat-subtitle{font-size:.74rem; color:#8B8B9C; margin-top:4px}
.ai-chat-close{background:none; border:0; color:#8B8B9C; font-size:1.1rem; cursor:pointer; transition:color .25s}
.ai-chat-close:hover{color:#fff}
.ai-chat-messages{flex:1; min-height:0; overflow-y:auto; overflow-x:hidden; padding:15px; display:flex; flex-direction:column; gap:9px; background:var(--paper)}
.ai-message{display:flex}
.ai-message.user{justify-content:flex-end}
.ai-message-bubble{
  max-width:82%; width:fit-content; padding:9px 13px; border-radius:14px;
  font-size:.83rem; line-height:1.45; white-space:pre-line;
  word-break:normal; overflow-wrap:anywhere;
  animation:bubIn .3s var(--ease);
}
.ai-message-bubble.assistant{
  background:#151C31; color:#E4E7F2; border:1px solid rgba(255,255,255,.07);
  border-bottom-left-radius:5px; box-shadow:0 6px 16px -10px rgba(12,10,30,.55);
}
.ai-message-bubble.user{
  background:var(--violet); color:#fff; border-bottom-right-radius:5px;
  box-shadow:0 6px 16px -8px rgba(124,58,237,.5);
}
@media(max-width:640px){
  .ai-message-bubble{max-width:84%; font-size:.8rem; line-height:1.45; padding:8px 11px; border-radius:13px}
  .ai-chat-messages{padding:12px; gap:7px}
  .ai-chat-input{padding:10px 14px; font-size:.84rem}
  .ai-chat-send{width:34px; height:34px}
  .ai-chat-header{padding:14px 16px}
  .ai-chat-title{font-size:.9rem}
  .ai-chat-subtitle{font-size:.68rem}
}
@media(max-width:400px){
  .ai-message-bubble{max-width:86%; font-size:.78rem}
}
.ai-chat-input-area{padding:14px 16px; border-top:1px solid var(--line); display:flex; gap:9px; background:#fff}
.ai-chat-input{
  flex:1; border:1px solid var(--line-2); border-radius:100px; padding:11px 16px; font-size:.9rem;
  font-family:var(--sans); outline:none; transition:border-color .25s, box-shadow .25s;
}
.ai-chat-input:focus{border-color:var(--violet); box-shadow:0 0 0 3px rgba(124,58,237,.12)}
.ai-chat-send{
  background:var(--violet); border:0; color:#fff; cursor:pointer; border-radius:50%; width:38px; height:38px;
  display:grid; place-items:center; font-size:1rem; flex:0 0 auto; transition:transform .3s var(--ease), filter .3s;
}
.ai-chat-send:hover{transform:scale(1.08); filter:brightness(1.08)}
.ai-typing-dots{display:inline-flex; gap:4px; align-items:center; padding:3px 2px}
.ai-typing-dots span{width:6px; height:6px; border-radius:50%; background:var(--faint); animation:tp 1.1s infinite}
.ai-typing-dots span:nth-child(2){animation-delay:.15s}
.ai-typing-dots span:nth-child(3){animation-delay:.3s}
@media(max-width:640px){
  .ai-dock{right:16px; bottom:20px}
  .fab{right:16px; bottom:112px}
  .ai-chat-window{width:calc(100vw - 32px); height:70vh; max-height:70vh; bottom:calc(100% + 12px)}
}
