/* Widget de chat de soporte — AMASFLY
   Usa los tokens de site.css (navy/verde/paper/tipografías); sin estilos
   inline en el HTML, todo vive acá. */

.chat-bubble{
  position:fixed;right:clamp(16px,4vw,28px);bottom:clamp(16px,4vw,28px);z-index:60;
  width:58px;height:58px;border-radius:50%;border:0;cursor:pointer;
  background:var(--green);color:#fff;font-size:26px;line-height:1;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 12px 28px -10px rgba(8,20,31,.5);
  transition:background .2s ease,transform .2s cubic-bezier(.16,1,.3,1);
}
.chat-bubble:hover{background:var(--green-dark);transform:scale(1.05)}
.chat-bubble[aria-expanded="true"]{background:var(--navy)}

.chat-panel{
  position:fixed;right:clamp(16px,4vw,28px);bottom:calc(clamp(16px,4vw,28px) + 70px);z-index:60;
  width:min(360px,calc(100vw - 32px));max-height:min(560px,calc(100vh - 120px));
  background:var(--white);border-radius:8px;border:1px solid var(--hair);
  box-shadow:0 30px 60px -24px rgba(8,20,31,.45);
  display:flex;flex-direction:column;overflow:hidden;
  font-family:var(--body);
}
.chat-panel[hidden]{display:none}

.chat-head{
  background:var(--navy);color:#fff;padding:14px 16px;
  display:flex;align-items:center;justify-content:space-between;gap:10px;flex:0 0 auto;
}
.chat-head h2{
  font-family:var(--display);font-weight:700;font-size:15px;margin:0;letter-spacing:-.01em;
}
.chat-close{
  background:transparent;border:0;color:#cfd8e0;cursor:pointer;
  font-size:20px;line-height:1;padding:2px 4px;border-radius:3px;
}
.chat-close:hover{color:#fff}

.chat-body{
  flex:1 1 auto;overflow-y:auto;padding:14px 16px;
  display:flex;flex-direction:column;gap:10px;background:var(--paper);
}

.chat-msg{
  max-width:86%;padding:9px 12px;border-radius:10px;font-size:14.5px;line-height:1.55;
  white-space:pre-wrap;word-wrap:break-word;
}
.chat-msg.bot{
  align-self:flex-start;background:var(--white);border:1px solid var(--hair);color:var(--ink);
  border-bottom-left-radius:3px;
}
.chat-msg.usuario{
  align-self:flex-end;background:var(--green);color:#fff;border-bottom-right-radius:3px;
}

.chat-typing{
  align-self:flex-start;display:flex;gap:4px;padding:10px 12px;
  background:var(--white);border:1px solid var(--hair);border-radius:10px;border-bottom-left-radius:3px;
}
.chat-typing span{
  width:6px;height:6px;border-radius:50%;background:var(--muted);
  animation:chatDot 1.1s ease-in-out infinite;
}
.chat-typing span:nth-child(2){animation-delay:.15s}
.chat-typing span:nth-child(3){animation-delay:.3s}
@keyframes chatDot{0%,60%,100%{opacity:.3;transform:translateY(0)}30%{opacity:1;transform:translateY(-2px)}}

.chat-cta{
  align-self:flex-start;max-width:86%;display:inline-block;text-decoration:none;
  font-family:var(--display);font-weight:700;font-size:13.5px;color:#fff;
  background:var(--green);padding:9px 14px;border-radius:4px;
}
.chat-cta:hover{background:var(--green-dark)}

.chat-form{
  flex:0 0 auto;display:flex;gap:8px;padding:12px;border-top:1px solid var(--hair);background:var(--white);
}
.chat-input{
  flex:1 1 auto;border:1px solid var(--hair);border-radius:6px;padding:10px 12px;
  font-family:var(--body);font-size:14.5px;color:var(--ink);background:var(--white);
}
.chat-input:focus-visible{outline:2px solid var(--green);outline-offset:1px}
.chat-send{
  flex:0 0 auto;border:0;border-radius:6px;background:var(--green);color:#fff;cursor:pointer;
  width:40px;height:40px;display:flex;align-items:center;justify-content:center;
}
.chat-send:hover{background:var(--green-dark)}
.chat-send:disabled{background:var(--hair);cursor:not-allowed}

@media(max-width:520px){
  .chat-panel{
    right:10px;left:10px;bottom:10px;width:auto;max-height:min(82vh,640px);
  }
  .chat-bubble{right:16px;bottom:16px}
}
