/* ---------- CHAT WIDGET ---------- */
.chat-widget{
  position:fixed;bottom:26px;right:26px;z-index:300;
  font-family:'Manrope',sans-serif;
}

.chat-toggle{
  width:60px;height:60px;border-radius:50%;border:none;
  background:linear-gradient(135deg, var(--brand-blue), var(--brand-blue-light));
  color:var(--white);
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 14px 30px -8px rgba(18,59,93,.55);
  cursor:pointer;
  transition:transform .2s ease, box-shadow .2s ease;
  position:relative;
}
.chat-toggle:hover{transform:scale(1.06);box-shadow:0 16px 34px -6px rgba(18,59,93,.65);}
.chat-toggle svg{width:28px;height:28px;position:absolute;transition:opacity .2s ease, transform .2s ease;}
.chat-icon-close{opacity:0;transform:scale(.7) rotate(-45deg);}
.chat-toggle[aria-expanded="true"] .chat-icon-open{opacity:0;transform:scale(.7) rotate(45deg);}
.chat-toggle[aria-expanded="true"] .chat-icon-close{opacity:1;transform:scale(1) rotate(0);}

.chat-panel{
  /* Posicionado absoluto (no en el flujo flex) a propósito: si no, aunque
     esté visualmente oculto (visibility:hidden), seguiría reservando su
     espacio dentro de .chat-widget -hasta 520px de alto- y ese hueco
     invisible tapaba los toques en cualquier contenido que quedara debajo,
     en cualquier parte de la página, en pantallas de celular. */
  position:absolute;
  right:0;
  bottom:74px;
  width:min(360px, calc(100vw - 52px));
  height:min(520px, calc(100vh - 140px));
  background:var(--white);
  border-radius:20px;
  box-shadow:0 30px 60px -20px rgba(18,33,41,.45);
  border:1px solid rgba(18,59,93,.08);
  display:flex;flex-direction:column;
  overflow:hidden;
  transform:translateY(16px) scale(.97);
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .22s ease, transform .22s ease, visibility .22s;
}
.chat-panel.chat-open{
  transform:translateY(0) scale(1);
  opacity:1;
  visibility:visible;
  pointer-events:auto;
}

.chat-header{
  background:linear-gradient(135deg, var(--brand-blue), #0F3252);
  color:var(--white);
  padding:16px 18px;
  display:flex;align-items:center;justify-content:space-between;
  gap:12px;
  flex-shrink:0;
}
.chat-header-title{display:flex;align-items:center;gap:10px;}
.chat-header-title strong{display:block;font-size:.95rem;font-family:'Fraunces',serif;}
.chat-header-title span{display:block;font-size:.72rem;color:rgba(255,255,255,.75);margin-top:2px;}
.chat-header-dot{
  width:9px;height:9px;border-radius:50%;background:var(--gold);
  box-shadow:0 0 0 3px rgba(200,164,93,.25);
  flex-shrink:0;
}
.chat-close{
  background:none;border:none;color:rgba(255,255,255,.8);
  font-size:1rem;cursor:pointer;padding:4px 6px;line-height:1;
  transition:color .2s ease;
}
.chat-close:hover{color:var(--white);}

.chat-messages{
  flex:1;overflow-y:auto;
  padding:16px 16px 8px;
  display:flex;flex-direction:column;gap:10px;
  background:var(--cream);
}
.chat-msg{
  max-width:82%;
  padding:10px 14px;
  border-radius:14px;
  font-size:.88rem;
  line-height:1.5;
  white-space:pre-wrap;
}
.chat-msg-bot{
  align-self:flex-start;
  background:var(--white);
  color:var(--ink);
  border:1px solid rgba(18,59,93,.08);
  border-bottom-left-radius:4px;
}
.chat-msg-user{
  align-self:flex-end;
  background:var(--brand-blue);
  color:var(--white);
  border-bottom-right-radius:4px;
}
.chat-msg-error{
  align-self:flex-start;
  background:#FCEBEA;
  color:#8A2C22;
  border:1px solid #F3C9C4;
  border-bottom-left-radius:4px;
}

.chat-typing{
  display:flex;gap:5px;
  padding:0 16px 10px;
  background:var(--cream);
}
.chat-typing span{
  width:7px;height:7px;border-radius:50%;
  background:var(--brand-blue-light);
  opacity:.5;
  animation:chat-typing-bounce 1.1s infinite ease-in-out;
}
.chat-typing span:nth-child(2){animation-delay:.15s;}
.chat-typing span:nth-child(3){animation-delay:.3s;}
@keyframes chat-typing-bounce{
  0%, 60%, 100%{transform:translateY(0);opacity:.5;}
  30%{transform:translateY(-4px);opacity:1;}
}

.chat-wa-link{
  display:flex;align-items:center;gap:8px;
  padding:10px 16px;
  font-size:.8rem;font-weight:700;
  color:#128C7E;
  background:#F0FBF8;
  border-top:1px solid rgba(18,59,93,.08);
  flex-shrink:0;
}
.chat-wa-link svg{width:17px;height:17px;flex-shrink:0;}
.chat-wa-link:hover{background:#E3F7F1;}

.chat-input-row{
  display:flex;align-items:center;gap:8px;
  padding:12px;
  border-top:1px solid rgba(18,59,93,.08);
  background:var(--white);
  flex-shrink:0;
}
.chat-input-row input{
  flex:1;
  border:1.5px solid rgba(18,59,93,.15);
  border-radius:999px;
  padding:10px 16px;
  font-size:.88rem;
  font-family:inherit;
  outline:none;
  transition:border-color .2s ease;
}
.chat-input-row input:focus{border-color:var(--brand-blue-light);}
.chat-input-row button{
  width:38px;height:38px;border-radius:50%;flex-shrink:0;
  border:none;background:var(--gold);color:var(--brand-blue);
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;transition:background .2s ease, transform .2s ease;
}
.chat-input-row button:hover{background:var(--gold-light);transform:scale(1.05);}
.chat-input-row button svg{width:18px;height:18px;}
.chat-input-row button:disabled{opacity:.5;cursor:default;transform:none;}
