/* Chatbot widget — reuses the site's design tokens (see styles.css :root). */
.cw-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: 1px solid var(--text, #141a1e);
  border-radius: 999px;
  background: var(--accent, #0b7a5e);
  color: #fff;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 12px 30px -12px rgba(11, 15, 20, 0.5);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.cw-fab:hover { transform: translateY(-2px); }
.cw-fab:focus-visible { outline: 2px solid var(--accent-bright, #34d7a8); outline-offset: 2px; }
.cw-fab[hidden] { display: none; }

.cw-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 40px));
  background: var(--white, #fff);
  border: 1px solid var(--line, #d5d8d2);
  border-radius: 12px;
  box-shadow: 0 30px 60px -24px rgba(11, 15, 20, 0.4);
  overflow: hidden;
  font-family: var(--font-body, system-ui, sans-serif);
}
.cw-panel[hidden] { display: none; }

.cw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  background: var(--ink, #0b0f14);
  color: #fff;
}
.cw-header-title { font-family: var(--font-display, sans-serif); font-size: 15px; font-weight: 600; }
.cw-header-sub { font-size: 11px; color: var(--muted-soft, #9aa0a6); font-family: var(--font-mono, monospace); }
.cw-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}
.cw-close:focus-visible { outline: 2px solid var(--accent-bright, #34d7a8); outline-offset: 2px; }

.cw-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--paper, #eceeea);
}
.cw-msg { max-width: 85%; padding: 10px 13px; border-radius: 12px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.cw-msg a { color: var(--accent, #0b7a5e); }
.cw-msg-user { align-self: flex-end; background: var(--accent, #0b7a5e); color: #fff; border-bottom-right-radius: 4px; }
.cw-msg-bot { align-self: flex-start; background: var(--white, #fff); color: var(--text, #141a1e); border: 1px solid var(--line-soft, #e2e4de); border-bottom-left-radius: 4px; }
.cw-msg-error { align-self: center; background: transparent; color: var(--muted, #5b636b); font-size: 12px; font-family: var(--font-mono, monospace); }

.cw-typing { display: inline-flex; gap: 4px; }
.cw-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-soft, #9aa0a6); animation: cw-blink 1.2s infinite ease-in-out; }
.cw-typing span:nth-child(2) { animation-delay: 0.2s; }
.cw-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cw-blink { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }

.cw-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line, #d5d8d2);
  background: var(--white, #fff);
}
.cw-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--line, #d5d8d2);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 14px;
  max-height: 96px;
  color: var(--text, #141a1e);
}
.cw-input:focus-visible { outline: 2px solid var(--accent, #0b7a5e); outline-offset: 1px; }
.cw-send {
  border: 0;
  border-radius: 8px;
  background: var(--accent, #0b7a5e);
  color: #fff;
  padding: 0 16px;
  cursor: pointer;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
}
.cw-send:disabled { opacity: 0.5; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
  .cw-fab, .cw-typing span { transition: none; animation: none; }
}
