/* ─── FLOATING WHATSAPP + CHATBOT ─── */
.fw-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9990;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.fw-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(16,24,40,0.22);
  transition: transform .2s ease, box-shadow .2s ease;
  text-decoration: none;
}
.fw-btn:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 28px rgba(16,24,40,0.28); }
.fw-btn svg { width: 28px; height: 28px; }
.fw-whatsapp { background: #25d366; }
.fw-whatsapp svg { fill: #fff; }
.fw-chat { background: var(--gradient-brand, linear-gradient(120deg,#1466c9,#12b886)); position: relative; }
.fw-chat svg { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fw-chat .fw-badge {
  position: absolute; top: 2px; right: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #ef4444; border: 2px solid #fff;
}
.fw-tip {
  position: absolute;
  right: 68px;
  white-space: nowrap;
  background: #101828;
  color: #fff;
  font: 500 13px/1 var(--font-body, sans-serif);
  padding: 8px 12px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.fw-item { position: relative; display: flex; align-items: center; }
.fw-item:hover .fw-tip { opacity: 1; }

/* Chat panel */
.cb-panel {
  position: fixed;
  right: 20px;
  bottom: 152px;
  z-index: 9991;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 180px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(16,24,40,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body, sans-serif);
  opacity: 0;
  transform: translateY(16px) scale(.98);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.cb-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.cb-head {
  background: var(--gradient-brand, linear-gradient(120deg,#1466c9,#12b886));
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.cb-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.cb-avatar img { width: 30px; height: 30px; object-fit: contain; }
.cb-title { flex: 1; min-width: 0; }
.cb-title strong { display: block; font-size: 15px; }
.cb-title span { font-size: 12px; opacity: .9; }
.cb-close {
  background: rgba(255,255,255,.18); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  font-size: 18px; line-height: 1;
}
.cb-close:hover { background: rgba(255,255,255,.3); }
.cb-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cb-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
  word-wrap: break-word;
}
.cb-msg a { color: inherit; text-decoration: underline; }
.cb-bot { background: #fff; color: #1c2536; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px; align-self: flex-start; }
.cb-user { background: #1466c9; color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.cb-typing { display: inline-flex; gap: 4px; }
.cb-typing i { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; animation: cbDot 1s infinite; }
.cb-typing i:nth-child(2) { animation-delay: .15s; }
.cb-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes cbDot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.cb-chips { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; }
.cb-chip {
  background: #fff; color: #1466c9; border: 1px solid #1466c9;
  border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer;
  font-family: inherit;
}
.cb-chip:hover { background: #eaf2fc; }
.cb-foot {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
.cb-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 10px 14px;
  font: 14px var(--font-body, sans-serif);
  outline: none;
}
.cb-input:focus { border-color: #1466c9; }
.cb-send {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: #1466c9; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.cb-send svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Stay out of the way of the full-screen mobile menu */
body:has(.navbar-links.open) .fw-stack,
body:has(.navbar-links.open) .cb-panel { display: none; }

@media (max-width: 480px) {
  .fw-stack { right: 14px; bottom: 14px; }
  .fw-btn { width: 52px; height: 52px; }
  .cb-panel { right: 16px; left: 16px; width: auto; bottom: 140px; }
  .fw-tip { display: none; }
}
