/* CricMotion public chatbot widget
   ===============================
   Scoped to .cm-cb-* classes so we never collide with the rest of
   the marketing-site CSS. Uses existing CSS tokens from style.css. */

#cm-chatbot {
  /* Hydration anchor — script.js fills this on DOMContentLoaded. */
  position: fixed;
  z-index: 1100;
  pointer-events: none;
}

/* Launcher button — floating green circle bottom-right */
.cm-cb-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--green, #22c55e);
  color: #0a0f0d;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  z-index: 1101;
  pointer-events: auto;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.cm-cb-launcher:hover,
.cm-cb-launcher:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(34, 197, 94, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  outline: none;
}
.cm-cb-launcher svg {
  width: 26px;
  height: 26px;
}
.cm-cb-launcher[aria-expanded="true"] {
  /* Hide launcher when drawer is open — same anchor point */
  transform: scale(0.85);
  opacity: 0;
  pointer-events: none;
}

/* Drawer container */
.cm-cb-drawer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 64px);
  background: #0e1714;
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1102;
  pointer-events: auto;
  transform: translateY(16px);
  opacity: 0;
  transition: transform 0.22s ease-out, opacity 0.22s ease-out;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  color: #e8ece9;
}
.cm-cb-drawer.cm-cb-open {
  transform: translateY(0);
  opacity: 1;
}

/* Header */
.cm-cb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, #142019, #0e1714);
}
.cm-cb-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14.5px;
  color: #e8ece9;
}
.cm-cb-title-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green, #22c55e);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}
.cm-cb-close {
  background: transparent;
  border: none;
  color: #8a9b8f;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.cm-cb-close:hover,
.cm-cb-close:focus-visible {
  color: #e8ece9;
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}

/* Messages list */
.cm-cb-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.cm-cb-body::-webkit-scrollbar {
  width: 6px;
}
.cm-cb-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.cm-cb-msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}
.cm-cb-msg-bot {
  align-self: flex-start;
  background: #1a2520;
  color: #e8ece9;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom-left-radius: 4px;
}
.cm-cb-msg-user {
  align-self: flex-end;
  background: var(--green, #22c55e);
  color: #0a0f0d;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.cm-cb-msg-bot a {
  color: var(--green, #22c55e);
  text-decoration: underline;
}
.cm-cb-msg-bot a:hover {
  text-decoration: none;
}
.cm-cb-msg-error {
  color: #f59e0b;
  font-size: 13px;
  font-style: italic;
}
.cm-cb-msg-streaming::after {
  content: "▍";
  display: inline-block;
  color: var(--green, #22c55e);
  animation: cm-cb-blink 1.1s infinite;
  margin-left: 2px;
}
@keyframes cm-cb-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Suggested-question chips */
.cm-cb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0;
}
.cm-cb-chip {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--green, #22c55e);
  padding: 7px 11px;
  border-radius: 14px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.15s;
}
.cm-cb-chip:hover,
.cm-cb-chip:focus-visible {
  background: rgba(34, 197, 94, 0.16);
  outline: none;
}
.cm-cb-chip:active {
  transform: scale(0.97);
}

/* Input row */
.cm-cb-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: #0e1714;
}
.cm-cb-input {
  flex: 1;
  min-height: 38px;
  max-height: 96px;
  background: #1a2520;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #e8ece9;
  padding: 9px 12px;
  font: inherit;
  resize: none;
  line-height: 1.45;
}
.cm-cb-input:focus {
  outline: none;
  border-color: rgba(34, 197, 94, 0.45);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}
.cm-cb-input::placeholder {
  color: #6a7a70;
}
.cm-cb-send {
  background: var(--green, #22c55e);
  color: #0a0f0d;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.cm-cb-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.cm-cb-send:not(:disabled):hover {
  background: #16a34a;
}

/* Tier 2 — email follow-up pill */
.cm-cb-followup {
  align-self: stretch;
  background: rgba(34, 197, 94, 0.06);
  border: 1px solid rgba(34, 197, 94, 0.22);
  border-radius: 12px;
  padding: 12px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.cm-cb-followup-text {
  font-size: 13.5px;
  line-height: 1.45;
  color: #e8ece9;
}
.cm-cb-followup-text b {
  color: var(--green, #22c55e);
}
.cm-cb-followup-form {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.cm-cb-followup-input {
  flex: 1;
  min-width: 0;
  background: #1a2520;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #e8ece9;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
}
.cm-cb-followup-input:focus {
  outline: none;
  border-color: rgba(34, 197, 94, 0.45);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.12);
}
.cm-cb-followup-input::placeholder {
  color: #6a7a70;
}
.cm-cb-followup-submit {
  background: var(--green, #22c55e);
  color: #0a0f0d;
  border: none;
  border-radius: 8px;
  padding: 0 11px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.cm-cb-followup-submit:hover { background: #16a34a; }
.cm-cb-followup-skip {
  background: transparent;
  color: #8a9b8f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0 10px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.cm-cb-followup-skip:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #e8ece9;
}
.cm-cb-followup-status {
  font-size: 12px;
  color: #8a9b8f;
  min-height: 14px;
}
.cm-cb-followup-status-error {
  color: #f59e0b;
}

/* Footer micro-text */
.cm-cb-foot {
  text-align: center;
  font-size: 11.5px;
  color: #6a7a70;
  padding: 4px 12px 10px;
}
.cm-cb-foot a {
  color: #8a9b8f;
}

/* Mobile / narrow viewport */
@media (max-width: 480px) {
  .cm-cb-drawer {
    bottom: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    height: 70vh;
  }
  .cm-cb-launcher {
    bottom: 16px;
    right: 16px;
  }
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .cm-cb-launcher,
  .cm-cb-drawer,
  .cm-cb-chip {
    transition: none;
  }
  .cm-cb-msg-streaming::after {
    animation: none;
  }
}
