/* The assistant widget.
 *
 * Kept in its own file rather than folded into styles.css so the whole feature
 * is two files and can be pulled out in one commit if he ever prefers plain
 * Tidio again.
 *
 * Every colour is a token from tokens.css, so it themes with the rest of the
 * site and needs no dark-mode block of its own.
 */

.ccl-chat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9000;              /* above the page, below Tidio's own panel */
  font-family: var(--ccl-body);
}

/* ---- launcher ---- */

.ccl-launch {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: var(--ccl-blue);
  color: var(--ccl-on-brand);
  box-shadow: 0 6px 20px rgba(4, 107, 210, .32);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .15s ease, background .15s ease;
}
.ccl-launch:hover { background: var(--ccl-blue-hover); transform: translateY(-2px); }
.ccl-launch:focus-visible { outline: 3px solid var(--ccl-rust); outline-offset: 3px; }

/* ---- panel ---- */

/* The widget lives in the page, so the page's element selectors reach it.
 * styles.css sets `section { padding: 88px 0 }` for the layout bands, which
 * landed inside the chat panel as an 88px empty strip above the header and
 * another below the composer. Anything here that is a bare element selector on
 * the site gets neutralised explicitly rather than hoped about. */
.ccl-chat section,
.ccl-chat p,
.ccl-chat ul,
.ccl-chat li { padding: 0; margin: 0; }

.ccl-panel {
  position: absolute;
  right: 0;
  bottom: 68px;
  width: min(370px, calc(100vw - 32px));
  height: min(540px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--ccl-card);
  border: 1px solid var(--ccl-border);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(17, 17, 17, .18);
  overflow: hidden;
}

.ccl-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 12px;
  background: var(--ccl-bg-band);
  border-bottom: 1px solid var(--ccl-border);
}
.ccl-title {
  margin: 0;
  font-family: var(--ccl-display);
  font-size: 16px;
  color: var(--ccl-heading);
}
.ccl-sub {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ccl-muted);
}
.ccl-head-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.ccl-icon {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ccl-muted);
  font-size: 12px;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
}
.ccl-icon:hover { color: var(--ccl-heading); border-color: var(--ccl-border); }
#ccl-close { font-size: 20px; line-height: 1; padding: 0 8px 3px; }

/* ---- transcript ---- */

.ccl-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--ccl-bg);
}

.ccl-msg { display: flex; flex-direction: column; gap: 8px; max-width: 88%; }
.ccl-msg.is-bot { align-self: flex-start; }
.ccl-msg.is-you { align-self: flex-end; align-items: flex-end; }

.ccl-bubble {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  /* The bot writes paragraphs separated by blank lines. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.is-bot .ccl-bubble {
  background: var(--ccl-bg-band);
  color: var(--ccl-text);
  border: 1px solid var(--ccl-border);
  border-bottom-left-radius: 4px;
}
.is-you .ccl-bubble {
  background: var(--ccl-blue);
  color: var(--ccl-on-brand);
  border-bottom-right-radius: 4px;
}

/* ---- quick replies ---- */

.ccl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ccl-chip {
  font-family: inherit;
  font-size: 12.5px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--ccl-blue);
  background: transparent;
  color: var(--ccl-blue);
  cursor: pointer;
}
.ccl-chip:hover { background: var(--ccl-blue); color: var(--ccl-on-brand); }
.ccl-chip:focus-visible { outline: 2px solid var(--ccl-rust); outline-offset: 2px; }

.ccl-link-btn {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--ccl-radius);
  background: var(--ccl-blue);
  color: var(--ccl-on-brand);
  text-decoration: none;
}
.ccl-link-btn:hover { background: var(--ccl-blue-hover); color: var(--ccl-on-brand); }

/* ---- upload ---- */

.ccl-upload-btn {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--ccl-radius);
  border: 1px dashed var(--ccl-blue);
  color: var(--ccl-blue);
  cursor: pointer;
}
.ccl-upload-btn:hover { background: var(--ccl-bg-band); }
/* Visually hidden, not display:none — a hidden input cannot be opened by
   clicking its label in every browser. */
.ccl-upload-btn input {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- composer ---- */

.ccl-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--ccl-border);
  background: var(--ccl-card);
}
.ccl-input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--ccl-border);
  background: var(--ccl-bg);
  color: var(--ccl-text);
}
.ccl-input:focus { outline: 2px solid var(--ccl-blue); outline-offset: 1px; }
.ccl-send {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 999px;
  border: 0;
  background: var(--ccl-blue);
  color: var(--ccl-on-brand);
  cursor: pointer;
}
.ccl-send:hover { background: var(--ccl-blue-hover); }

/* ---- small screens ---- */

@media (max-width: 480px) {
  .ccl-chat { right: 14px; bottom: 14px; }

  /* Use the screen. 70vh left a third of the phone showing the page behind,
     while the conversation itself was squeezed into six visible lines. */
  .ccl-panel {
    width: calc(100vw - 28px);
    height: calc(100dvh - 104px);
    max-height: 620px;
  }

  /* The strapline wrapped to three lines next to the two buttons and turned
     the header into a block of text. The title carries it on its own here. */
  .ccl-sub { display: none; }
  .ccl-head { align-items: center; padding: 12px 12px 11px; }

  .ccl-log { padding: 12px; gap: 9px; }
  .ccl-msg { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
  .ccl-launch { transition: none; }
}
