/* chatbot.css — Krate demo conversational bot (mirrors a GHL Conversation AI
   appointment-booking flow). Brand-themable via CSS custom properties; reuses
   the GHL embed kit's tokens so it matches the rest of the conversion layer. */

.kb-chat {
  --cb-accent: var(--ghl-accent, #c96f4a);
  --cb-bg: var(--ghl-bg, #16181d);
  --cb-text: var(--ghl-text, #f4f5f7);
  --cb-radius: var(--ghl-radius, 16px);
  --cb-bot: color-mix(in srgb, var(--cb-bg) 86%, #fff 14%);
  --cb-muted: color-mix(in srgb, var(--cb-text) 55%, transparent);
  position: fixed; right: 22px; bottom: 22px; z-index: 9000;
  font-family: inherit;
}

/* launcher */
.kb-launch {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 20px 13px 16px; border: none; cursor: pointer;
  background: var(--cb-accent); color: #fff; border-radius: 999px;
  font-size: 14px; font-weight: 700; letter-spacing: 0.01em;
  box-shadow: 0 10px 34px rgba(0,0,0,0.34); transition: transform .16s ease, box-shadow .16s ease;
}
.kb-launch:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(0,0,0,0.42); }
.kb-launch svg { width: 22px; height: 22px; flex: none; }
.kb-launch .kb-pulse {
  width: 8px; height: 8px; border-radius: 50%; background: #6ee7a8; flex: none;
  box-shadow: 0 0 0 0 rgba(110,231,168,0.7); animation: kb-pulse 2s infinite;
}
@keyframes kb-pulse { 0%{box-shadow:0 0 0 0 rgba(110,231,168,.6)} 70%{box-shadow:0 0 0 9px rgba(110,231,168,0)} 100%{box-shadow:0 0 0 0 rgba(110,231,168,0)} }

/* panel */
.kb-panel {
  position: absolute; right: 0; bottom: 0; width: 384px; max-width: calc(100vw - 32px);
  height: 588px; max-height: calc(100vh - 44px);
  background: var(--cb-bg); color: var(--cb-text); border-radius: var(--cb-radius);
  box-shadow: 0 24px 70px rgba(0,0,0,0.5); overflow: hidden;
  display: flex; flex-direction: column;
  transform: translateY(14px) scale(0.98); opacity: 0; pointer-events: none;
  transition: transform .22s cubic-bezier(.2,.8,.2,1), opacity .22s ease;
}
.kb-chat.open .kb-panel { transform: none; opacity: 1; pointer-events: auto; }
.kb-chat.open .kb-launch { display: none; }

.kb-head {
  display: flex; align-items: center; gap: 11px; padding: 15px 16px;
  background: color-mix(in srgb, var(--cb-bg) 84%, #000 16%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.kb-ava { width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--cb-accent); display: grid; place-items: center; color: #fff; font-weight: 800; }
.kb-head .kb-meta { line-height: 1.25; flex: 1; min-width: 0; }
.kb-head .kb-name { font-size: 14.5px; font-weight: 700; }
.kb-head .kb-stat { font-size: 11px; color: var(--cb-muted); display: flex; align-items: center; gap: 6px; }
.kb-head .kb-dot { width: 7px; height: 7px; border-radius: 50%; background: #6ee7a8; }
.kb-demo { font-size: 9px; font-weight: 800; letter-spacing: .14em; padding: 4px 8px;
  border: 1px solid var(--cb-accent); color: var(--cb-accent); border-radius: 999px; }
.kb-x { background: none; border: none; color: var(--cb-muted); cursor: pointer; font-size: 20px; line-height: 1; padding: 4px; }
.kb-x:hover { color: var(--cb-text); }

.kb-log { flex: 1; overflow-y: auto; padding: 16px 14px 6px; display: flex; flex-direction: column; gap: 9px; scroll-behavior: smooth; }
.kb-row { display: flex; }
.kb-row.bot { justify-content: flex-start; }
.kb-row.user { justify-content: flex-end; }
.kb-bub { max-width: 80%; padding: 10px 13px; border-radius: 15px; font-size: 13.5px; line-height: 1.42; }
.kb-row.bot .kb-bub { background: var(--cb-bot); border-bottom-left-radius: 5px; }
.kb-row.user .kb-bub { background: var(--cb-accent); color: #fff; border-bottom-right-radius: 5px; }
.kb-bub a { color: inherit; }

.kb-typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.kb-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--cb-muted); animation: kb-bounce 1.2s infinite; }
.kb-typing span:nth-child(2){animation-delay:.15s} .kb-typing span:nth-child(3){animation-delay:.3s}
@keyframes kb-bounce { 0%,60%,100%{transform:translateY(0);opacity:.5} 30%{transform:translateY(-5px);opacity:1} }

.kb-quicks { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 14px 8px; }
.kb-quick { padding: 9px 14px; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 600;
  background: transparent; color: var(--cb-accent); border: 1.5px solid color-mix(in srgb, var(--cb-accent) 55%, transparent);
  transition: background .14s ease, color .14s ease; }
.kb-quick:hover { background: var(--cb-accent); color: #fff; }

.kb-foot { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid rgba(255,255,255,0.06); }
.kb-foot input { flex: 1; background: color-mix(in srgb, var(--cb-bg) 70%, #000 30%); border: 1px solid rgba(255,255,255,0.09);
  color: var(--cb-text); border-radius: 12px; padding: 11px 13px; font-size: 13.5px; font-family: inherit; outline: none; }
.kb-foot input:focus { border-color: var(--cb-accent); }
.kb-foot input::placeholder { color: var(--cb-muted); }
.kb-send { flex: none; width: 42px; border: none; border-radius: 12px; background: var(--cb-accent); color: #fff; cursor: pointer; display: grid; place-items: center; }
.kb-send svg { width: 18px; height: 18px; }
.kb-send:disabled { opacity: .4; cursor: default; }

/* lead-captured card (the demo's payoff) */
.kb-lead { margin: 6px 4px 2px; padding: 14px; border-radius: 13px;
  background: color-mix(in srgb, var(--cb-accent) 12%, var(--cb-bg)); border: 1px solid color-mix(in srgb, var(--cb-accent) 45%, transparent); }
.kb-lead h4 { margin: 0 0 9px; font-size: 12.5px; letter-spacing: .04em; display: flex; align-items: center; gap: 7px; }
.kb-lead .kb-check { width: 18px; height: 18px; border-radius: 50%; background: #2fae6a; color: #fff; display: grid; place-items: center; font-size: 11px; flex: none; }
.kb-lead dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: 12.5px; }
.kb-lead dt { color: var(--cb-muted); }
.kb-lead dd { margin: 0; font-weight: 600; }
.kb-lead .kb-note { margin-top: 10px; font-size: 10.5px; color: var(--cb-muted); line-height: 1.4; }

@media (max-width: 760px) {
  .kb-chat { right: 14px; bottom: 14px; }
  .kb-panel { width: calc(100vw - 28px); height: calc(100vh - 90px); }
}
@media (prefers-reduced-motion: reduce) {
  .kb-launch .kb-pulse, .kb-typing span { animation: none; }
  .kb-panel { transition: opacity .15s ease; }
}
