/* invita.love chat widget */
#il-chat-root{
  all:initial;
  font-family:Nunito,system-ui,-apple-system,sans-serif;
  position:fixed;
  z-index:99990;
  right:14px;
  bottom:18px;
  color:#1f191c;
}
#il-chat-root *{box-sizing:border-box}
#il-chat-btn{
  position:relative;
  border:0;
  border-radius:999px;
  cursor:pointer;
  background:linear-gradient(145deg,#e8455f,#c22540);
  color:#fff;
  box-shadow:0 12px 32px rgba(194,37,64,.42);
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:12px 16px 12px 14px;
  font:inherit;
  font-weight:800;
  font-size:14px;
  line-height:1;
  transition:transform .15s ease,box-shadow .15s,background .15s;
  animation:il-chat-pulse 2.6s ease-in-out infinite;
}
#il-chat-btn:hover{
  transform:translateY(-2px);
  box-shadow:0 16px 36px rgba(194,37,64,.5);
  filter:brightness(1.03);
  animation:none;
}
#il-chat-btn svg{width:22px;height:22px;fill:currentColor;flex-shrink:0}
#il-chat-btn .il-chat-cta{display:inline;line-height:1;white-space:nowrap;letter-spacing:.01em}
#il-chat-btn .il-chat-badge{
  position:absolute;top:-3px;right:-3px;width:12px;height:12px;border-radius:50%;
  background:#fff;border:2px solid #c22540;
  animation:il-badge-ping 1.8s ease-out infinite;
}
@keyframes il-chat-pulse{
  0%,100%{box-shadow:0 12px 32px rgba(194,37,64,.42)}
  50%{box-shadow:0 14px 36px rgba(194,37,64,.58),0 0 0 6px rgba(194,37,64,.12)}
}
@keyframes il-badge-ping{
  0%{transform:scale(1);opacity:1}
  70%{transform:scale(1.35);opacity:.35}
  100%{transform:scale(1);opacity:1}
}
@media(min-width:900px){
  #il-chat-btn{padding:13px 20px 13px 16px;font-size:15px}
  #il-chat-btn svg{width:24px;height:24px}
}

/* Panel: flex column so composer stays pinned */
#il-chat-panel{
  position:absolute;
  right:0;
  bottom:72px;
  width:min(400px,calc(100vw - 28px));
  height:min(560px,calc(100vh - 120px));
  max-height:min(560px,calc(100dvh - 120px));
  background:#fdfaf6;
  border:1px solid rgba(80,55,35,.12);
  border-radius:18px;
  box-shadow:0 22px 50px rgba(40,25,10,.22);
  display:none;
  flex-direction:column;
  overflow:hidden;
  min-height:0;
}
#il-chat-root.open #il-chat-panel{display:flex}
#il-chat-root.open #il-chat-btn{animation:none}

#il-chat-head{
  flex:0 0 auto;
  padding:14px 16px;
  background:#2a2420;
  color:#fdfaf6;
  display:flex;
  align-items:center;
  gap:10px;
}
#il-chat-head .title{
  font-family:Playfair,Georgia,serif;
  font-size:18px;
  line-height:1.25;
  font-weight:600;
}
#il-chat-head .sub{font-size:13px;opacity:.8;margin-top:3px;line-height:1.35}
#il-chat-close{
  margin-left:auto;
  background:transparent;
  border:0;
  color:#fdfaf6;
  font-size:26px;
  cursor:pointer;
  line-height:1;
  padding:6px 8px;
  min-width:44px;
  min-height:44px;
}

#il-chat-msgs{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
  background:linear-gradient(#fdfaf6,#f7f1e8);
}
.il-msg{
  max-width:92%;
  padding:12px 14px;
  border-radius:16px;
  font-size:16px;
  line-height:1.55;
  letter-spacing:.01em;
  white-space:pre-wrap;
  word-wrap:break-word;
  color:#1f191c;
}
.il-msg.bot{
  align-self:flex-start;
  background:#fff;
  border:1px solid rgba(80,55,35,.12);
  color:#1f191c;
  border-bottom-left-radius:5px;
}
.il-msg.user{
  align-self:flex-end;
  background:#c22540;
  color:#fff;
  border-bottom-right-radius:5px;
}
.il-msg.sys{
  align-self:center;
  background:transparent;
  color:#5c5048;
  font-size:13px;
  padding:4px 8px;
}
.il-msg strong{font-weight:800}

#il-chat-quick{
  flex:0 0 auto;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  padding:0 14px 10px;
}
#il-chat-quick button{
  border:1.5px solid rgba(80,55,35,.2);
  background:#fff;
  color:#1f191c;
  border-radius:999px;
  padding:9px 13px;
  font-size:14px;
  font-weight:700;
  line-height:1.3;
  cursor:pointer;
  min-height:40px;
}
#il-chat-quick button:hover{border-color:#c22540}

#il-chat-start{
  flex:0 0 auto;
  display:block;
  width:calc(100% - 28px);
  margin:0 14px 8px;
  border:0;
  background:transparent;
  color:#c22540;
  font-size:14px;
  font-weight:700;
  text-decoration:underline;
  cursor:pointer;
  text-align:center;
  padding:6px 0;
  min-height:36px;
}

#il-chat-form{
  flex:0 0 auto;
  display:flex;
  gap:8px;
  padding:12px 12px calc(12px + env(safe-area-inset-bottom,0px));
  border-top:1px solid rgba(80,55,35,.12);
  background:#fff;
  align-items:stretch;
}
#il-chat-form input{
  flex:1;
  min-width:0;
  border:1.5px solid rgba(80,55,35,.22);
  border-radius:14px;
  padding:12px 14px;
  font:inherit;
  font-size:16px; /* ≥16px evita zoom iOS */
  line-height:1.4;
  outline:none;
  background:#fdfaf6;
  color:#1f191c;
}
#il-chat-form input:focus{border-color:#c22540}
#il-chat-form input::placeholder{color:#7a6e66}
#il-chat-form button{
  flex:0 0 auto;
  border:0;
  border-radius:14px;
  background:#2a2420;
  color:#fdfaf6;
  padding:0 16px;
  cursor:pointer;
  font-weight:800;
  font-size:15px;
  min-width:76px;
  min-height:48px;
}
#il-chat-form button:disabled{opacity:.5;cursor:wait}

/* —— Mobile: sheet dentro del viewport (svh/dvh + safe-area) —— */
@media(max-width:899px){
  #il-chat-root{right:10px;bottom:12px}
  #il-chat-btn{padding:11px 14px 11px 12px;font-size:13.5px;gap:7px}
  #il-chat-btn svg{width:20px;height:20px}

  /* Panel cerrado/por defecto: tamaño contenido, no enorme */
  #il-chat-panel{
    width:min(100vw - 16px, 420px);
    height:min(62svh, 480px);
    max-height:min(62svh, calc(100dvh - 140px));
    bottom:64px;
    border-radius:16px;
  }

  /* Abierto: hoja casi a pantalla completa, composer fijo abajo */
  #il-chat-root.open{
    inset:0;
    right:0;
    left:0;
    top:0;
    bottom:0;
    width:100%;
    height:100%;
    height:100dvh;
    max-height:100svh;
    z-index:99999;
    padding:0;
  }
  #il-chat-root.open #il-chat-btn{display:none}
  #il-chat-root.open #il-chat-panel{
    position:fixed;
    left:0;
    right:0;
    top:0;
    bottom:0;
    width:100%;
    height:100%;
    height:100dvh;
    max-height:100svh;
    max-height:100dvh;
    border-radius:0;
    border:0;
    bottom:0;
    padding-top:env(safe-area-inset-top,0px);
  }

  #il-chat-head{padding:12px 14px}
  #il-chat-head .title{font-size:19px}
  #il-chat-head .sub{font-size:13.5px}
  #il-chat-msgs{padding:14px;gap:12px}
  .il-msg{font-size:16.5px;line-height:1.58;padding:13px 15px}
  #il-chat-quick button{font-size:14.5px;padding:10px 14px;min-height:42px}
  #il-chat-form{
    padding:10px 10px calc(10px + env(safe-area-inset-bottom,0px));
    box-shadow:0 -6px 18px rgba(40,25,10,.06);
  }
  #il-chat-form input{font-size:16.5px;padding:13px 14px;min-height:48px}
  #il-chat-form button{min-height:48px;font-size:16px;padding:0 18px}
}

/* Sit above WA float when launcher visible */
body:has(.wa-float) #il-chat-root:not(.open){bottom:90px;right:12px}
@media(min-width:900px){
  body:has(.wa-float) #il-chat-root:not(.open){bottom:96px;right:22px}
}
@media(prefers-reduced-motion:reduce){
  #il-chat-btn,#il-chat-btn .il-chat-badge{animation:none}
}
