/* AIPCF site assistant. Themes can recolour it with these variables, e.g.
   .aipcf-chat { --aipcf-chat-accent: #0a7c55; } */
.aipcf-chat {
  --aipcf-chat-accent: #1d4ed8;
  --aipcf-chat-accent-ink: #ffffff;
  --aipcf-chat-bg: #ffffff;
  --aipcf-chat-ink: #1f2328;
  --aipcf-chat-muted: #5f6368;
  --aipcf-chat-line: #e2e4e8;
  --aipcf-chat-bot: #f3f4f6;
  --aipcf-chat-user: #e8efff;
  --aipcf-chat-error: #b42318;
  --aipcf-chat-radius: 14px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--aipcf-chat-ink);
}
@media (prefers-color-scheme: dark) {
  .aipcf-chat--floating {
    --aipcf-chat-accent: #8ab4ff;
    --aipcf-chat-accent-ink: #0b1220;
    --aipcf-chat-bg: #1b1d21;
    --aipcf-chat-ink: #eceef1;
    --aipcf-chat-muted: #a8adb4;
    --aipcf-chat-line: #33363c;
    --aipcf-chat-bot: #26292e;
    --aipcf-chat-user: #22324f;
    --aipcf-chat-error: #ff9b8f;
  }
}
.aipcf-chat *,
.aipcf-chat *::before,
.aipcf-chat *::after { box-sizing: border-box; }
.aipcf-chat__sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* The floating button, right (default) or left */
.aipcf-chat--floating { position: fixed; right: 20px; bottom: 20px; z-index: 99990; }
.aipcf-chat--floating.aipcf-chat--left { right: auto; left: 20px; }
.aipcf-chat--left .aipcf-chat__panel { right: auto; left: 0; }
.aipcf-chat__launcher {
  display: grid; place-items: center; width: 56px; height: 56px; margin: 0; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--aipcf-chat-accent); color: var(--aipcf-chat-accent-ink);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
}
.aipcf-chat__launcher:focus-visible,
.aipcf-chat button:focus-visible,
.aipcf-chat a:focus-visible,
.aipcf-chat__input:focus-visible { outline: 3px solid var(--aipcf-chat-accent); outline-offset: 2px; }

/* The panel */
.aipcf-chat__panel {
  display: flex; flex-direction: column;
  background: var(--aipcf-chat-bg); color: var(--aipcf-chat-ink);
}
.aipcf-chat__panel[hidden] { display: none; }
.aipcf-chat--floating .aipcf-chat__panel {
  position: absolute; right: 0; bottom: 70px;
  width: min(380px, calc(100vw - 40px)); height: min(560px, calc(100vh - 110px));
  border: 1px solid var(--aipcf-chat-line); border-radius: var(--aipcf-chat-radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22); overflow: hidden;
}
.aipcf-chat--inline .aipcf-chat__panel { height: 420px; }
.aipcf-chat__head {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border-bottom: 1px solid var(--aipcf-chat-line);
}
.aipcf-chat--inline .aipcf-chat__head { padding: 0 0 10px; }
.aipcf-chat__heading { flex: 1; min-width: 0; }
.aipcf-chat__title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; color: inherit; }
.aipcf-chat__subtitle { margin: 1px 0 0; font-size: 12px; line-height: 1.35; color: var(--aipcf-chat-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aipcf-chat--inline .aipcf-chat__title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.aipcf-chat__avatar {
  display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%;
  background: var(--aipcf-chat-bot); font-size: 20px; line-height: 1;
}
.aipcf-chat__launcher-emoji { font-size: 26px; line-height: 1; }
.aipcf-chat__new,
.aipcf-chat__close {
  margin: 0; padding: 4px 10px; border: 1px solid var(--aipcf-chat-line); border-radius: 999px;
  background: transparent; color: var(--aipcf-chat-ink); font: inherit; font-size: 13px; cursor: pointer;
}
.aipcf-chat__close { padding: 0 9px; font-size: 20px; line-height: 28px; }
.aipcf-chat--inline .aipcf-chat__new { margin-left: auto; }

/* Messages */
.aipcf-chat__log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.aipcf-chat--inline .aipcf-chat__log { padding: 4px 0 10px; }
.aipcf-chat__msg {
  max-width: 88%; margin: 0; padding: 9px 12px; border-radius: 12px;
  overflow-wrap: anywhere; word-break: normal;
}
.aipcf-chat__msg--bot { align-self: flex-start; background: var(--aipcf-chat-bot); border-bottom-left-radius: 4px; }
.aipcf-chat__msg--user { align-self: flex-end; background: var(--aipcf-chat-user); border-bottom-right-radius: 4px; }
/* Answers: paragraphs and lists, spaced for a chat bubble whatever the theme does. */
.aipcf-chat__msg > p { margin: 0 0 8px; padding: 0; font: inherit; color: inherit; }
.aipcf-chat__msg > p:last-child { margin-bottom: 0; }
.aipcf-chat__msg > ul, .aipcf-chat__msg > ol:not(.aipcf-chat__sources) { margin: 0 0 8px; padding: 0 0 0 20px; list-style-position: outside; }
.aipcf-chat__msg > ul { list-style-type: disc; }
.aipcf-chat__msg > ol:not(.aipcf-chat__sources) { list-style-type: decimal; }
.aipcf-chat__msg > ul:last-child, .aipcf-chat__msg > ol:last-child { margin-bottom: 0; }
.aipcf-chat__msg li { margin: 0 0 4px; padding: 0; }
.aipcf-chat__msg strong { font-weight: 600; }
.aipcf-chat__msg code { padding: 0 3px; border-radius: 3px; background: var(--aipcf-chat-line); font-size: .92em; }
.aipcf-chat__msg--error { color: var(--aipcf-chat-error); }
.aipcf-chat__cite {
  display: inline-block; min-width: 18px; margin: 0 1px; padding: 0 5px; border-radius: 9px;
  background: var(--aipcf-chat-accent); color: var(--aipcf-chat-accent-ink) !important;
  font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; text-decoration: none; vertical-align: 1px;
}
.aipcf-chat__sources { margin: 8px 0 0; padding: 8px 0 0 18px; border-top: 1px solid var(--aipcf-chat-line); font-size: 13px; }
.aipcf-chat__sources li { margin: 2px 0; }
.aipcf-chat__sources a { color: inherit; text-decoration: underline; }
.aipcf-chat__dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.aipcf-chat__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--aipcf-chat-muted); animation: aipcf-chat-dot 1.2s infinite ease-in-out; }
.aipcf-chat__dots i:nth-child(2) { animation-delay: .15s; }
.aipcf-chat__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes aipcf-chat-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .aipcf-chat__dots i { animation: none; } }

/* The form */
.aipcf-chat__form { display: flex; align-items: flex-end; gap: 8px; margin: 0; padding: 10px 12px; border-top: 1px solid var(--aipcf-chat-line); }
.aipcf-chat--inline .aipcf-chat__form { padding: 10px 0 0; }
.aipcf-chat__input {
  flex: 1; min-height: 40px; max-height: 140px; margin: 0; padding: 9px 11px; resize: none; overflow-y: hidden;
  border: 1px solid var(--aipcf-chat-line); border-radius: 10px;
  background: var(--aipcf-chat-bg); color: var(--aipcf-chat-ink); font: inherit; line-height: 1.4;
}
.aipcf-chat__send {
  min-height: 40px; margin: 0; padding: 0 14px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--aipcf-chat-accent); color: var(--aipcf-chat-accent-ink); font: inherit; font-weight: 600;
}
.aipcf-chat__send:disabled { opacity: .55; cursor: progress; }
.aipcf-chat__note { margin: 0; padding: 0 12px 10px; color: var(--aipcf-chat-muted); font-size: 12px; }
.aipcf-chat--inline .aipcf-chat__note { padding: 8px 0 0; }

/* Phones: the panel fills the screen above the button. */
@media (max-width: 600px) {
  .aipcf-chat--floating { right: 14px; bottom: 14px; }
  .aipcf-chat--floating.is-open .aipcf-chat__panel {
    position: fixed; inset: 0 0 0 0; width: auto; height: auto; border: 0; border-radius: 0;
  }
  .aipcf-chat--floating.is-open .aipcf-chat__launcher { display: none; }
}

/* Starter questions */
.aipcf-chat__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.aipcf-chat__chip {
  margin: 0; padding: 6px 11px; border: 1px solid var(--aipcf-chat-accent); border-radius: 999px;
  background: transparent; color: var(--aipcf-chat-ink); font: inherit; font-size: 13px; line-height: 1.3; text-align: left; cursor: pointer;
}
.aipcf-chat__chip:hover { background: var(--aipcf-chat-user); }

/* Name and consent, before the first question */
.aipcf-chat__intro { display: grid; gap: 6px; margin: 0; padding: 12px; border: 1px solid var(--aipcf-chat-line); border-radius: 12px; }
.aipcf-chat__intro label { font-weight: 600; font-size: 14px; }
.aipcf-chat__name {
  margin: 0; padding: 8px 10px; border: 1px solid var(--aipcf-chat-line); border-radius: 8px;
  background: var(--aipcf-chat-bg); color: var(--aipcf-chat-ink); font: inherit;
}
.aipcf-chat__hint { margin: 0; color: var(--aipcf-chat-muted); font-size: 12px; }
.aipcf-chat__intro .aipcf-chat__consent { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: 13px; line-height: 1.4; }
.aipcf-chat__consent input { margin: 3px 0 0; flex: 0 0 auto; }
.aipcf-chat__intro .aipcf-chat__send { justify-self: start; padding: 0 16px; }
.aipcf-chat__form[hidden] { display: none; }

/* Offline: the daily limit is used up */
.aipcf-chat__msg--offline { border-left: 3px solid var(--aipcf-chat-muted); }
.aipcf-chat.is-offline .aipcf-chat__input { opacity: .6; }

/* Hidden from people; bots that fill it are refused. */
.aipcf-chat__hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.aipcf-chat__turnstile { margin-top: 8px; }
