﻿/* ===========================================================================
   Codebyte Assistant
   Built on the Codebyte design tokens (codebyte-design-tokens.md). Brand values
   come from www.codebyte.solutions; the chat-specific ones are derived from
   them. Change a colour here, not in the rules below.
   =========================================================================== */

:root {
  /* Brand (site) */
  --cb-primary: #643ada;
  --cb-ink: #0e0b1a;
  --cb-surface: #f7f5fd;
  --cb-text: #5a5670;
  --cb-white: #ffffff;

  /* Extended (chat) */
  --cb-primary-hover: #4f28b8;
  --cb-primary-tint: #eeeafb;
  --cb-text-strong: #1f1b2e;
  --cb-text-muted: #6b6781;
  --cb-text-placeholder: #8e8aa3;
  --cb-border: #e4e0f0;
  --cb-border-subtle: #dcd6ee;
  --cb-divider: #ece8f6;
  --cb-online: #1e8e4e;
  --cb-danger: #b42318;
  --cb-online-tint: color-mix(in srgb, var(--cb-online) 14%, transparent);
  --cb-overlay: color-mix(in srgb, var(--cb-ink) 45%, transparent);

  --cb-font: "Google Sans", "Google Sans Flex", system-ui, -apple-system, "Segoe UI", sans-serif;

  --cb-radius-pill: 999px;
  --cb-radius-sm: 10px;
  --cb-radius-md: 12px;
  --cb-radius-composer: 22px;
  --cb-radius-bubble: 20px 20px 6px 20px;

  --cb-shadow-brand: 0 10px 28px -12px color-mix(in srgb, var(--cb-primary) 75%, transparent);
  --cb-shadow-nav: 0 12px 32px -18px rgba(14, 11, 26, 0.35);
  --cb-shadow-composer: 0 1px 2px rgba(14, 11, 26, 0.04), 0 12px 32px -18px rgba(14, 11, 26, 0.16);
  --cb-ring: 0 0 0 4px color-mix(in srgb, var(--cb-primary) 12%, transparent);

  --cb-column: 760px;
  --cb-ease: 140ms ease;
}

/* ---------------------------------------------------------------- base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--cb-font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--cb-text);
  background: var(--cb-surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.has-open-modal {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--cb-primary);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- layout */

.chat-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* ---------------------------------------------------------------- header */

.chat-header {
  flex-shrink: 0;
  padding: 14px 24px;
  background: var(--cb-white);
  border-bottom: 1px solid var(--cb-divider);
}

.chat-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--cb-column);
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: var(--cb-radius-pill);
  background: var(--cb-primary);
  color: var(--cb-white);
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
}

/* With a logo: the mark sits on white with a hairline edge. */
.brand-mark.has-logo {
  background: var(--cb-white);
  color: transparent;
  box-shadow: inset 0 0 0 1px var(--cb-border);
}

.brand-mark__img {
  position: absolute;
  inset: 7px;
  width: calc(100% - 14px);
  height: calc(100% - 14px);
  object-fit: contain;
}

.brand-text {
  min-width: 0;
}

.brand-title {
  margin: 0;
  color: var(--cb-ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.brand-status {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--cb-text-muted);
  font-size: 12.5px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Logo plus presence badge. The badge sits outside .brand-mark, which clips
   its contents to the circle. */
.brand-avatar {
  position: relative;
  flex-shrink: 0;
}

/* "Online" as a presence badge on the logo, ringed in white so it reads
   cleanly against the mark and the header. */
.status-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--cb-white);
  border-radius: var(--cb-radius-pill);
  background: var(--cb-online);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--cb-radius-md);
  background: transparent;
  color: var(--cb-text);
  transition: background-color var(--cb-ease), color var(--cb-ease);
}

.icon-button svg {
  width: 22px;
  height: 22px;
}

.icon-button:hover,
.icon-button[aria-expanded="true"] {
  background: var(--cb-primary-tint);
  color: var(--cb-primary);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

/* Shown once the message limit is reached: New Chat is the way forward. */
.icon-button.is-primary-action {
  background: var(--cb-primary);
  color: var(--cb-white);
  box-shadow: var(--cb-shadow-brand);
}

.icon-button.is-primary-action:hover {
  background: var(--cb-primary-hover);
}

/* Primary call to action in the header: book a call. */
.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-right: 4px;
  padding: 0 18px 0 14px;
  border: 0;
  border-radius: var(--cb-radius-pill);
  background: var(--cb-primary);
  color: var(--cb-white);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--cb-shadow-brand);
  transition: background-color var(--cb-ease), box-shadow var(--cb-ease), transform var(--cb-ease);
}

.cta-button:hover {
  background: var(--cb-primary-hover);
  transform: translateY(-1px);
}

.cta-button:active {
  transform: translateY(0);
}

.cta-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
  transform: none;
}

.cta-button__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.menu {
  position: relative;
}

.menu-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius-md);
  background: var(--cb-white);
  box-shadow: var(--cb-shadow-nav);
}

.menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--cb-text-strong);
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  transition: background-color var(--cb-ease);
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--cb-primary-tint);
  outline: none;
}

.menu-item:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ---------------------------------------------------------------- messages */

.message-list {
  flex: 1;
  overflow-y: auto;
  /* Centres a 760px column while the scrollbar stays at the window edge. */
  padding: 40px max(16px, calc((100% - var(--cb-column)) / 2)) 24px;
  scroll-behavior: smooth;
}

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 28px;
  animation: cbMessageIn 0.32s ease-out both;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.system {
  justify-content: center;
}

.message-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.message-stack.bot {
  flex: 1;
}

.message-stack.user {
  align-items: flex-end;
  max-width: min(80%, 560px);
}

.message-bubble {
  position: relative;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Assistant replies sit on the page, no bubble. */
.message-row.bot .message-bubble {
  padding-top: 3px;
  color: var(--cb-text-strong);
  font-size: 15.5px;
  line-height: 1.65;
}

/* Keep the line breaks a visitor typed with Shift+Enter. */
.message-row.user .message-content {
  white-space: pre-wrap;
}

.message-row.user .message-bubble {
  padding: 10px 18px;
  border-radius: var(--cb-radius-bubble);
  background: var(--cb-primary);
  color: var(--cb-white);
  font-size: 15.5px;
  line-height: 1.5;
}

.message-row.system .message-bubble {
  max-width: 560px;
  padding: 8px 14px;
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius-md);
  background: var(--cb-white);
  color: var(--cb-text-muted);
  font-size: 13px;
  text-align: center;
}

.message-row.system .message-meta {
  display: none;
}

.message-content ul,
.message-content ol {
  margin: 6px 0;
  padding-left: 22px;
}

.message-content li + li {
  margin-top: 4px;
}

.message-content strong {
  color: var(--cb-ink);
  font-weight: 600;
}

.message-content a {
  color: var(--cb-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-content a:hover {
  color: var(--cb-primary-hover);
}

/* Blinking caret while the answer streams in. */
.message-bubble.is-streaming .message-content::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: var(--cb-primary);
  animation: cbCaret 1s steps(1) infinite;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
}

.message-timestamp {
  color: var(--cb-text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.message-aux {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.message-aux:not(:empty) {
  margin-top: 14px;
}

.escalation-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: var(--cb-radius-pill);
  background: var(--cb-primary-tint);
  color: var(--cb-primary);
  font-size: 12px;
  font-weight: 500;
}

.escalation-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--cb-radius-pill);
  background: currentColor;
}

/* Copy: quiet until the reply is hovered or focused. */
.copy-button {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: -4px 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--cb-text-muted);
  opacity: 0;
  transition: opacity var(--cb-ease), background-color var(--cb-ease), color var(--cb-ease);
}

.copy-button svg {
  width: 16px;
  height: 16px;
}

.copy-button .copy-check {
  display: none;
}

.copy-button.is-copied .copy-icon {
  display: none;
}

.copy-button.is-copied .copy-check {
  display: block;
  color: var(--cb-online);
}

.message-row:hover .copy-button,
.copy-button:focus-visible,
.copy-button.is-copied {
  opacity: 1;
}

.copy-button:hover {
  background: var(--cb-primary-tint);
  color: var(--cb-primary);
}

@media (hover: none) {
  .copy-button {
    opacity: 0.7;
  }
}

/* ---------------------------------------------------------------- agent avatar */

.cb-bot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--cb-primary-tint);
}

.cb-bot__antenna {
  position: absolute;
  top: 3px;
  left: 13px;
  width: 4px;
  height: 4px;
  border-radius: var(--cb-radius-pill);
  background: var(--cb-primary);
}

.cb-bot__visor {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 20px;
  height: 12px;
  margin-top: 4px;
  border-radius: 6px;
  background: var(--cb-primary);
}

.cb-bot__eye {
  width: 3px;
  height: 5px;
  border-radius: 2px;
  background: var(--cb-white);
  animation: cbBlink 4.2s infinite;
}

.cb-bot.is-working .cb-bot__visor {
  animation: cbScan 1.1s infinite ease-in-out;
}

.cb-bot.is-working .cb-bot__antenna {
  animation: cbPing 1.1s infinite ease-in-out;
}

/* ---------------------------------------------------------------- working steps */

.status-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.status-step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--cb-text-muted);
  font-size: 14.5px;
  line-height: 1.5;
  animation: cbMessageIn 0.32s ease-out both;
}

.status-step__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.status-step__icon svg {
  display: none;
  width: 14px;
  height: 14px;
  color: var(--cb-online);
}

.status-step.is-done .status-step__icon svg {
  display: block;
}

.status-step.is-active .status-step__icon::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid var(--cb-primary-tint);
  border-top-color: var(--cb-primary);
  border-radius: var(--cb-radius-pill);
  animation: cbSpin 0.8s linear infinite;
}

.status-step.is-active .status-step__label {
  background: linear-gradient(
    90deg,
    var(--cb-text-muted) 0%,
    var(--cb-text-muted) 35%,
    var(--cb-text-strong) 50%,
    var(--cb-text-muted) 65%,
    var(--cb-text-muted) 100%
  );
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: cbShimmer 1.4s linear infinite;
}

/* ---------------------------------------------------------------- chips */

.starter-prompts {
  margin-top: 26px;
}

.starter-prompts-label,
.followups-label {
  margin-bottom: 12px;
  color: var(--cb-text-muted);
  font-size: 14px;
  font-weight: 500;
}

.starter-chip-row,
.followup-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.starter-chip,
.followup-chip {
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--cb-border-subtle);
  border-radius: var(--cb-radius-pill);
  background: var(--cb-white);
  color: var(--cb-text-strong);
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
  transition: border-color var(--cb-ease), background-color var(--cb-ease), color var(--cb-ease);
}

.starter-chip:hover,
.followup-chip:hover {
  border-color: var(--cb-primary);
  background: var(--cb-primary-tint);
  color: var(--cb-primary-hover);
}

.followup-chip:disabled,
.followup-chip.is-inactive {
  cursor: default;
  opacity: 0.5;
}

.followup-chip.is-inactive:hover {
  border-color: var(--cb-border-subtle);
  background: var(--cb-white);
  color: var(--cb-text-strong);
}

/* ---------------------------------------------------------------- sources */

.sources-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 4px 4px 0;
  border: 0;
  background: transparent;
  color: var(--cb-text-muted);
  font-size: 13px;
  font-weight: 500;
}

.sources-toggle::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--cb-ease);
}

.sources-toggle[aria-expanded="true"]::after {
  transform: rotate(-135deg) translateY(-1px);
}

.sources-toggle:hover {
  color: var(--cb-primary);
}

.sources-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--cb-radius-pill);
  background: var(--cb-primary-tint);
  color: var(--cb-primary);
  font-size: 12px;
}

.sources-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.source-chip {
  display: inline-flex;
  max-width: 100%;
  padding: 4px 12px;
  overflow: hidden;
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius-pill);
  background: var(--cb-white);
  color: var(--cb-text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-chip-link {
  text-decoration: none;
  transition: border-color var(--cb-ease), color var(--cb-ease);
}

.source-chip-link:hover {
  border-color: var(--cb-primary);
  color: var(--cb-primary);
}

/* ---------------------------------------------------------------- buttons */

.contact-support-button,
.schedule-open-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 22px;
  border: 1px solid transparent;
  border-radius: var(--cb-radius-pill);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--cb-ease), border-color var(--cb-ease), color var(--cb-ease);
}

/* Secondary (ink): the "Schedule a call" button inside a reply. */
.schedule-open-button {
  background: var(--cb-ink);
  color: var(--cb-white);
}

.schedule-open-button:hover {
  background: color-mix(in srgb, var(--cb-ink) 82%, var(--cb-white));
}

/* Ghost */
.contact-support-button {
  border-color: var(--cb-border-subtle);
  background: transparent;
  color: var(--cb-ink);
}

.contact-support-button:hover {
  border-color: var(--cb-ink);
  background: var(--cb-ink);
  color: var(--cb-white);
}

/* ---------------------------------------------------------------- composer */

.composer-area {
  flex-shrink: 0;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, color-mix(in srgb, var(--cb-surface) 0%, transparent), var(--cb-surface) 30%);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: var(--cb-column);
  margin: 0 auto;
  padding: 6px 6px 6px 20px;
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius-composer);
  background: var(--cb-white);
  box-shadow: var(--cb-shadow-composer);
  transition: border-color var(--cb-ease), box-shadow var(--cb-ease), opacity var(--cb-ease);
}

.composer:focus-within {
  border-color: var(--cb-primary);
  box-shadow: var(--cb-ring), var(--cb-shadow-composer);
}

.composer:has(.input-invalid) {
  border-color: var(--cb-danger);
}

.composer.is-message-limit-reached {
  opacity: 0.6;
}

/* One line by default; grows with Shift+Enter up to a cap (see autosizeInput). */
#message-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 120px;
  padding: 10.75px 0;
  border: 0;
  outline: none;
  resize: none;
  overflow-y: auto;
  scrollbar-width: none;
  background: transparent;
  color: var(--cb-text-strong);
  font-size: 15px;
  line-height: 1.5;
}

#message-input::-webkit-scrollbar {
  display: none;
}

#message-input::placeholder {
  color: var(--cb-text-placeholder);
}

#message-input:disabled {
  cursor: not-allowed;
}

#send-button {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--cb-radius-pill);
  background: var(--cb-primary);
  color: var(--cb-white);
  transition: background-color var(--cb-ease), opacity var(--cb-ease);
}

#send-button svg {
  width: 20px;
  height: 20px;
}

#send-button:hover {
  background: var(--cb-primary-hover);
}

.composer.is-empty #send-button,
#send-button:disabled {
  opacity: 0.35;
}

#send-button:disabled {
  cursor: not-allowed;
}

#send-button.is-loading {
  opacity: 1;
  cursor: progress;
}

.button-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, var(--cb-white) 35%, transparent);
  border-top-color: var(--cb-white);
  border-radius: var(--cb-radius-pill);
  animation: cbSpin 0.8s linear infinite;
}

.form-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  max-width: var(--cb-column);
  margin: 6px auto 0;
  padding: 0 20px;
  color: var(--cb-text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.form-meta p {
  margin: 0;
}

.form-meta:not(:has(p:not(:empty):not([hidden]):not(.character-counter), .near-limit, .at-limit)) {
  display: none;
}

.input-hint {
  color: var(--cb-danger);
}

/* The counter only appears once it matters. */
.character-counter {
  display: none;
  margin-left: auto !important;
}

.character-counter.near-limit,
.character-counter.at-limit {
  display: block;
}

.character-counter.at-limit,
.message-limit-counter.is-limit-reached {
  color: var(--cb-danger);
}

/* ---------------------------------------------------------------- book a call */

.icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.scheduling-launcher {
  display: flex;
}

.scheduling-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  background: var(--cb-overlay);
  animation: cbFade 0.15s ease-out both;
}

/* The form scrolls when it is taller than the screen, but without a visible
   scrollbar: scrolling by touch, wheel, and keyboard still works. */
.scheduling-modal,
.book-card {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.scheduling-modal::-webkit-scrollbar,
.book-card::-webkit-scrollbar {
  display: none;
}

.book-card {
  width: 100%;
  max-width: 640px;
  max-height: calc(100dvh - 32px);
  padding: 36px 40px;
  overflow-y: auto;
  border-radius: 24px;
  background: var(--cb-white);
  box-shadow: var(--cb-shadow-nav);
  animation: cbMessageIn 0.2s ease-out both;
}

.book-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.book-title {
  margin: 0;
  color: var(--cb-ink);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.book-subtitle {
  margin: 6px 0 0;
  color: var(--cb-text);
  font-size: 15px;
  line-height: 1.5;
}

.book-close {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin: -4px -8px 0 0;
  padding: 0;
  border: 0;
  border-radius: var(--cb-radius-md);
  background: transparent;
  color: var(--cb-text);
  transition: background-color var(--cb-ease), color var(--cb-ease);
}

.book-close:hover {
  background: var(--cb-primary-tint);
  color: var(--cb-primary);
}

.book-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.book-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.book-label {
  color: var(--cb-ink);
  font-size: 15px;
  font-weight: 500;
}

.book-label-hint {
  color: var(--cb-text-muted);
  font-weight: 400;
}

/* Day and time quick picks */
/* Equal-width chips that wrap into even rows at any width (6 across on
   desktop, 3 across on a phone). */
.book-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 10px;
}

.book-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 10px 8px;
  border: 1px solid var(--cb-border-subtle);
  border-radius: 14px;
  background: var(--cb-white);
  color: var(--cb-ink);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  transition: border-color var(--cb-ease), background-color var(--cb-ease), color var(--cb-ease);
}

.book-choices--day .book-choice {
  min-height: 72px;
}

.book-choices--time .book-choice {
  flex-direction: row;
  gap: 6px;
}

.book-choice:hover {
  border-color: var(--cb-primary);
}

.book-choice.is-selected {
  border-color: var(--cb-primary);
  background: var(--cb-primary-tint);
  color: var(--cb-primary);
  box-shadow: inset 0 0 0 1px var(--cb-primary);
}

.book-choice-sub {
  color: var(--cb-text-muted);
  font-size: 14px;
  font-weight: 400;
}

.book-choice-sub--strong {
  color: inherit;
  font-weight: 500;
}

.book-choice-main {
  font-size: 17px;
  font-weight: 600;
}

.book-choice.is-selected .book-choice-sub {
  color: var(--cb-primary);
}

.book-choice-icon {
  width: 17px;
  height: 17px;
}

/* Contact details */
.book-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 16px;
}

.book-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.book-field--wide {
  grid-column: 1 / -1;
}

.book-input {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 1px solid var(--cb-border);
  border-radius: 14px;
  background: var(--cb-white);
  color: var(--cb-text-strong);
  font-size: 15px;
  transition: border-color var(--cb-ease), box-shadow var(--cb-ease);
}

textarea.book-input {
  min-height: 92px;
  resize: vertical;
}

.book-input::placeholder {
  color: var(--cb-text-placeholder);
}

.book-input:focus {
  border-color: var(--cb-primary);
  box-shadow: var(--cb-ring);
  outline: none;
}

.book-other-input {
  max-width: 260px;
}

/* Consent */
.book-consent {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  color: var(--cb-text);
  font-size: 15px;
  line-height: 1.55;
  cursor: pointer;
}

.book-checkbox {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--cb-primary);
  cursor: pointer;
}

.book-consent a {
  color: var(--cb-primary);
  font-weight: 500;
}

.book-consent a:hover {
  color: var(--cb-primary-hover);
}

.book-error {
  margin: -8px 0 0;
  color: var(--cb-danger);
  font-size: 14px;
}

.book-error:empty {
  display: none;
}

/* Primary action: Request call / Back to chat */
.book-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 12px 24px;
  border: 0;
  border-radius: var(--cb-radius-pill);
  background: var(--cb-primary);
  color: var(--cb-white);
  font-size: 16px;
  font-weight: 600;
  box-shadow: var(--cb-shadow-brand);
  transition: background-color var(--cb-ease), opacity var(--cb-ease), box-shadow var(--cb-ease);
}

.book-submit:hover {
  background: var(--cb-primary-hover);
}

.book-submit:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  box-shadow: none;
}

.book-submit:disabled:hover {
  background: var(--cb-primary);
}

.book-submit.is-loading {
  cursor: progress;
  opacity: 0.75;
}

/* Success view */
.book-success {
  max-width: 420px;
  padding: 32px 28px 28px;
  text-align: center;
}

.book-success-badge {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: var(--cb-radius-pill);
  background: var(--cb-online-tint);
  color: var(--cb-online);
}

.book-success-badge .icon {
  width: 28px;
  height: 28px;
}

.book-success .book-title {
  font-size: 22px;
}

.book-success .book-subtitle {
  font-size: 14.5px;
}

.book-summary {
  margin: 22px 0 24px;
  border: 1px solid var(--cb-border);
  border-radius: 14px;
  text-align: left;
}

.book-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
}

.book-summary-row + .book-summary-row {
  border-top: 1px solid var(--cb-divider);
}

.book-summary dt {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--cb-text-muted);
  font-size: 14px;
}

.book-summary dt .icon {
  width: 16px;
  height: 16px;
}

.book-summary dd {
  margin: 0;
  color: var(--cb-ink);
  font-size: 14.5px;
  font-weight: 500;
  text-align: right;
  overflow-wrap: anywhere;
}

/* "✓ Call requested · Fri 20 Nov, 15:00 IST" line in the transcript */
.chat-event {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -4px 0 28px;
  color: var(--cb-text-muted);
  font-size: 13px;
  animation: cbMessageIn 0.32s ease-out both;
}

.chat-event::before,
.chat-event::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--cb-divider);
}

.chat-event-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-event-label .icon {
  width: 14px;
  height: 14px;
  color: var(--cb-online);
}

/* ---------------------------------------------------------------- small screens */

/* Phones: the CTA is a compact round icon button (still primary). Its
   aria-label carries the text for screen readers. */
@media (max-width: 600px) {
  .cta-button {
    justify-content: center;
    width: 40px;
    min-height: 40px;
    margin-right: 2px;
    padding: 0;
  }

  .cta-button__label {
    display: none;
  }
}

@media (max-width: 600px) {
  .chat-header {
    padding: 10px 12px 10px 16px;
  }

  .message-list {
    padding-top: 24px;
  }

  .message-row {
    gap: 12px;
    margin-bottom: 24px;
  }

  .message-stack.user {
    max-width: 85%;
  }

  .starter-prompts {
    margin-top: 20px;
  }

  .composer-area {
    padding: 10px 12px max(12px, env(safe-area-inset-bottom));
  }

  .book-card {
    padding: 24px 20px;
    border-radius: 20px;
  }

  .book-title {
    font-size: 22px;
  }

  .book-grid {
    grid-template-columns: 1fr;
  }

  .book-choices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---------------------------------------------------------------- motion */

@keyframes cbMessageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cbFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes cbBlink {
  0%,
  90%,
  100% {
    transform: scaleY(1);
  }
  94% {
    transform: scaleY(0.15);
  }
}

@keyframes cbScan {
  0%,
  100% {
    transform: translateX(-2px);
  }
  50% {
    transform: translateX(2px);
  }
}

@keyframes cbPing {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

@keyframes cbSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes cbShimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -150% 0;
  }
}

@keyframes cbCaret {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .status-step.is-active .status-step__label {
    color: var(--cb-text-muted);
    background: none;
  }
}
