/* Chat widget */
.chat-launcher {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--btn-bg); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s, background 0.2s;
}
.chat-launcher:hover { background: var(--btn-hover); transform: scale(1.06); }
.chat-launcher svg { width: 28px; height: 28px; stroke: #fff; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.chat-panel {
  position: fixed; right: 20px; bottom: 92px; z-index: 60;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px));
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-panel[hidden] { display: none; }

.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-head img { width: 28px; height: 28px; }
.chat-head strong { flex: 1; font-size: 16px; }
.chat-close { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 26px; line-height: 1; min-width: 44px; min-height: 44px; margin: -8px -10px -8px 0; }

.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot { align-self: flex-start; background: var(--bg-alt); border-bottom-left-radius: 6px; }
.msg.user { align-self: flex-end; background: var(--btn-bg); color: #fff; border-bottom-right-radius: 6px; }
.msg a { color: inherit; text-decoration: underline; }

.typing { display: inline-flex; gap: 4px; padding: 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: 0.6; } .chat-launcher { transition: none; } }

.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.chat-chip { font: inherit; font-size: 14px; min-height: 36px; padding: 0 14px; border-radius: 980px; border: 1px solid var(--line); background: var(--card); color: var(--accent); cursor: pointer; }
.chat-chip:hover { border-color: var(--accent); }

.chat-form { display: flex; gap: 8px; padding: 12px 16px 6px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; border-radius: 980px; padding: 11px 16px; font-size: 16px; }
.chat-send { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; background: var(--btn-bg); color: #fff; display: grid; place-items: center; }
.chat-send:disabled { opacity: 0.5; cursor: default; }
.chat-send svg { width: 20px; height: 20px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-note { margin: 0; padding: 0 16px 12px; font-size: 14px; color: var(--muted); }
.chat-note a { color: var(--muted); text-decoration: underline; }

@media (max-width: 480px) {
  .chat-launcher { right: 14px; bottom: 14px; }
  .chat-panel { right: 8px; left: 8px; width: auto; bottom: 84px; height: min(560px, calc(100vh - 100px)); }
}
