/* The "Ask us" assistant. Uses the business's own colours and font (theme.css). Loaded only when chat is switched on. */
.chat-launch {
  position: fixed; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 40;
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border: 2px solid var(--accent); border-radius: 999px; background: var(--surface); color: var(--accent);
  font: inherit; font-weight: 650; cursor: pointer;
  box-shadow: var(--shadow-md, 0 6px 18px rgba(0, 0, 0, .15));
  transition: transform .16s var(--ease, ease), background-color .2s, color .2s;
}
body.no-float .chat-launch { bottom: calc(16px + env(safe-area-inset-bottom)); }
.chat-launch:hover { background: var(--accent); color: var(--accent-text); transform: translateY(-1px); }
.chat-launch[aria-expanded="true"] { opacity: 0; pointer-events: none; }

.chat-panel {
  position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column;
  width: min(380px, calc(100vw - 32px)); height: min(580px, calc(100vh - 32px)); height: min(580px, calc(100dvh - 32px));
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow-md, 0 14px 36px rgba(0, 0, 0, .22));
  animation: chat-in .22s var(--ease, ease);
}
.chat-panel[hidden] { display: none; }
@keyframes chat-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--accent); color: var(--accent-text); }
.chat-titles { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.chat-sub { font-size: .8rem; opacity: .85; }
.chat-reset, .chat-close { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.chat-reset { font-size: .85rem; text-decoration: underline; }
.chat-close { font-size: 1.6rem; line-height: 1; }
.chat-reset:hover, .chat-close:hover { background: rgba(255, 255, 255, .16); }

.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.chat-msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; animation: chat-pop .2s var(--ease, ease); }
.chat-assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-user { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.chat-msg a { color: inherit; text-decoration: underline; font-weight: 650; }
.chat-msg a[href^="tel:"] { white-space: nowrap; }
.chat-note { align-self: stretch; background: color-mix(in srgb, var(--highlight) 22%, transparent); border: 1px solid color-mix(in srgb, var(--highlight) 60%, var(--line)); border-radius: 12px; padding: 10px 12px; font-size: .92rem; overflow-wrap: anywhere; }
.chat-note a { color: inherit; font-weight: 650; }
@keyframes chat-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.chat-typing { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; }
.chat-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: chat-dot 1s infinite ease-in-out; }
.chat-typing i:nth-child(2) { animation-delay: .15s; }
.chat-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chat-starters { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 10px; }
.chat-starters:empty { display: none; }
.chat-chip { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px; font: inherit; font-size: .92rem; cursor: pointer; transition: border-color .2s, background-color .2s; }
.chat-chip:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }

.chat-form { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-input { flex: 1; min-width: 0; min-height: 46px; padding: 0 14px; border: 1px solid var(--field, var(--line)); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
.chat-input:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.chat-input:disabled { opacity: .6; }
.chat-send { min-height: 46px; padding: 0 18px; }
.chat-fine { margin: 0; padding: 0 14px 10px; background: var(--surface); color: var(--muted); font-size: .78rem; line-height: 1.3; }

.faq-chat { margin-top: 24px; }

/* Phones: the panel fills the screen */
@media (max-width: 560px) {
  .chat-panel { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; padding-bottom: env(safe-area-inset-bottom); }
}
@media (prefers-reduced-motion: reduce) {
  .chat-panel, .chat-msg { animation: none; }
  .chat-typing i { animation: none; opacity: .6; }
  .chat-launch { transition: none; }
}
