/* Floating chat widget, shared by every page. Uses the same brand tokens
   already defined in index.html / offering.css (--bg, --ink, --accent, ...). */
.chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--accent) 65%, transparent);
  transition: transform 0.15s ease;
}
.chat-launcher:hover { transform: translateY(-2px); }
.chat-launcher svg { width: 26px; height: 26px; }
.chat-launcher[hidden] { display: none; }

.chat-nudge {
  position: fixed;
  right: 86px;
  bottom: 32px;
  z-index: 59;
  max-width: 220px;
  background: var(--bg-elevated);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
.chat-nudge[hidden] { display: none; }

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 90px;
  z-index: 61;
  width: min(370px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px));
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 20px;
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-panel[hidden] { display: none; }

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-elevated);
  flex: none;
}
.chat-head-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 0.98rem; }
.chat-head-title svg { width: 22px; height: 22px; flex: none; }
.chat-head-actions { display: flex; align-items: center; gap: 4px; }
.chat-icon-btn {
  width: 30px; height: 30px; border-radius: 50%; border: none; background: transparent;
  color: var(--ink-muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.chat-icon-btn:hover { background: var(--rule); color: var(--ink); }
.chat-icon-btn svg { width: 17px; height: 17px; }
.chat-icon-btn[data-muted="true"] .icon-on { display: none; }
.chat-icon-btn[data-muted="false"] .icon-off { display: none; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-row { display: flex; }
.chat-row.bot { justify-content: flex-start; }
.chat-row.user { justify-content: flex-end; }
.chat-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.45;
}
.chat-row.bot .chat-bubble { background: var(--bg-elevated); border: 1px solid var(--rule); border-bottom-left-radius: 4px; }
.chat-row.user .chat-bubble { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }

.chat-typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.chat-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-muted);
  animation: chat-typing-bounce 1.1s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-typing-bounce { 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .chat-typing span { animation: none; opacity: 0.7; } }

.chat-quick-replies { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 16px 12px; flex: none; }
.chat-chip {
  border: 1px solid var(--rule); background: var(--bg-elevated); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.chat-chip:hover { border-color: var(--ink-muted); }

.chat-input-row { display: flex; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--rule); flex: none; }
.chat-input-row[hidden] { display: none; }
.chat-input-row input {
  flex: 1; font: inherit; font-size: 0.92rem; color: var(--ink); background: var(--bg-elevated);
  border: 1px solid var(--rule); border-radius: 999px; padding: 10px 15px; min-width: 0;
}
.chat-input-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chat-input-row button {
  border: none; background: var(--accent); color: var(--accent-ink); border-radius: 999px;
  padding: 0 18px; font-weight: 700; font-size: 0.88rem; cursor: pointer; flex: none;
}
.chat-input-row button:disabled { opacity: 0.6; cursor: default; }

@media (max-width: 640px) {
  .chat-launcher { bottom: 84px; }
  .chat-nudge { bottom: 96px; }
  .chat-panel { bottom: 150px; right: 16px; left: 16px; width: auto; height: min(64vh, 520px); }
}
