:root {
  --ca-primary: #d30056;
  --ca-primary-dark: #a90045;
  --ca-ink: #3d3d3d;
  --ca-muted: #6d6a64;
  --ca-line: #e3e0d8;
  --ca-bg: #f5f4f1;
  --ca-surface: #ffffff;
  --ca-cream: #e3e0d8;
  --ca-primary-soft: #fff2f7;
}

.ca-chatbot-embed,
.ca-chatbot-embed * {
  box-sizing: border-box;
}

body.chatbot-demo-page {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ca-ink);
  background: var(--ca-bg);
}

.ca-chatbot-embed {
  color: var(--ca-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.chatbot-demo-page .page {
  min-height: 100vh;
  padding: 56px clamp(20px, 5vw, 72px);
}

body.chatbot-demo-page .page__content {
  max-width: 980px;
}

body.chatbot-demo-page .page h1 {
  margin: 0 0 16px;
  font-size: clamp(36px, 6vw, 68px);
  line-height: 1.02;
  letter-spacing: 0;
}

body.chatbot-demo-page .page p {
  max-width: 680px;
  margin: 0 0 18px;
  color: var(--ca-muted);
  font-size: 18px;
  line-height: 1.65;
}

body.chatbot-demo-page .page__note {
  margin-top: 32px;
  padding: 18px 20px;
  border-left: 4px solid var(--ca-primary);
  background: var(--ca-primary-soft);
  color: var(--ca-ink);
}

.chatbot-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: auto;
  height: 60px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  color: #ffffff;
  background: var(--ca-primary);
  box-shadow: 0 18px 38px rgba(211, 0, 86, 0.26);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
  z-index: 999;
}

.chatbot-toggle:hover {
  background: var(--ca-primary-dark);
  transform: translateY(-2px);
}

.chatbot-toggle svg {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.chatbot-toggle span {
  white-space: nowrap;
}

.chatbot-window {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: min(380px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 128px));
  display: none;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
  border: 1px solid var(--ca-line);
  border-radius: 8px;
  background: var(--ca-surface);
  box-shadow: 0 28px 70px rgba(61, 61, 61, 0.18);
  z-index: 999;
}

.chatbot-window.is-open {
  display: grid;
}

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  color: #ffffff;
  background: var(--ca-primary);
}

.chatbot-header__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.chatbot-header__subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  opacity: 0.9;
}

.chatbot-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.chatbot-messages {
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  background: var(--ca-bg);
}

.chatbot-message {
  max-width: 86%;
  margin-bottom: 12px;
  padding: 11px 13px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.chatbot-message--bot {
  color: var(--ca-ink);
  background: #ffffff;
  border: 1px solid var(--ca-line);
}

.chatbot-message--bot a {
  color: var(--ca-primary-dark);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.chatbot-message--bot a:hover {
  color: var(--ca-primary);
}

.chatbot-message--user {
  margin-left: auto;
  color: #ffffff;
  background: var(--ca-primary);
}

.chatbot-message--loading {
  color: var(--ca-muted);
  font-style: italic;
}

.chatbot-quick-replies {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 12px;
}

.chatbot-quick-replies button {
  min-height: 38px;
  border: 1px solid var(--ca-cream);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ca-primary);
  background: #ffffff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.chatbot-quick-replies button:hover {
  border-color: var(--ca-primary);
  background: var(--ca-primary-soft);
}

.chatbot-quick-replies button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.chatbot-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-width: 90%;
  margin: -4px 0 14px;
}

.chatbot-sources a {
  border: 1px solid var(--ca-cream);
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--ca-primary);
  background: #ffffff;
  font-size: 12px;
  line-height: 1.2;
  text-decoration: none;
}

.chatbot-sources a:hover {
  border-color: var(--ca-primary);
  background: var(--ca-primary-soft);
}

.chatbot-form {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--ca-line);
  background: #ffffff;
}

.chatbot-input {
  min-width: 0;
  flex: 1;
  height: 44px;
  border: 1px solid var(--ca-line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ca-ink);
  font: inherit;
  outline: none;
}

.chatbot-input:focus {
  border-color: var(--ca-primary);
  box-shadow: 0 0 0 3px rgba(211, 0, 86, 0.14);
}

.chatbot-send {
  flex: 0 0 auto;
  height: 44px;
  min-width: 44px;
  border: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--ca-primary);
  cursor: pointer;
}

.chatbot-send:hover {
  background: var(--ca-primary-dark);
}

.chatbot-send:disabled,
.chatbot-input:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.chatbot-send svg {
  width: 20px;
  height: 20px;
}

.chatbot-privacy {
  margin: 0;
  padding: 0 14px 12px;
  color: var(--ca-muted);
  background: #ffffff;
  font-size: 11px;
  line-height: 1.35;
}

@media (max-width: 520px) {
  .chatbot-toggle {
    right: 16px;
    bottom: 16px;
    height: 54px;
    padding: 0 14px;
    font-size: 14px;
  }

  .chatbot-window {
    right: 16px;
    bottom: 88px;
    height: min(560px, calc(100vh - 112px));
  }
}
