:root {
  --chatbot-bg: #fffdf9;
  --chatbot-panel: #f7f4ef;
  --chatbot-border: rgba(120, 134, 156, 0.2);
  --chatbot-text: #1f2937;
  --chatbot-muted: #64748b;
  --chatbot-accent: #6d5efc;
  --chatbot-accent-hover: #5a4dee;
  --chatbot-shadow: 0 28px 60px rgba(15, 23, 42, 0.18);
}

#bba-chatbot-root {
  position: fixed;
  right: 1.25rem;
  bottom: 6.25rem;
  z-index: 55;
  font-family: Inter, sans-serif;
}

.bba-chatbot-toggle {
  width: 4rem;
  height: 4rem;
  border-radius: 1.35rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.22), transparent 45%),
    linear-gradient(135deg, #6d5efc, #7c70ff);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 18px 40px rgba(109, 94, 252, 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, border-radius 0.2s ease;
}

.bba-chatbot-toggle:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 20px 42px rgba(109, 94, 252, 0.42);
  filter: saturate(1.05);
}

#bba-chatbot-root.open .bba-chatbot-toggle {
  border-radius: 1rem;
}

.bba-chatbot-panel {
  width: min(24rem, calc(100vw - 2rem));
  height: min(35rem, calc(100vh - 8.5rem));
  border-radius: 1.7rem;
  border: 1px solid var(--chatbot-border);
  background:
    radial-gradient(circle at top right, rgba(109, 94, 252, 0.18), transparent 48%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(247, 244, 239, 0.98));
  box-shadow: var(--chatbot-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 0.9rem;
  position: relative;
}

.bba-chatbot-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(109, 94, 252, 0.24), rgba(19, 184, 166, 0.14));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

#bba-chatbot-root.open .bba-chatbot-panel {
  display: flex;
}

.bba-chatbot-header {
  padding: 1rem 1.05rem;
  background:
    radial-gradient(circle at top left, rgba(109, 94, 252, 0.12), transparent 44%),
    rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(120, 134, 156, 0.16);
  color: var(--chatbot-text);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  position: relative;
}

.bba-chatbot-header::after {
  content: "Online";
  position: absolute;
  right: 1.05rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.32rem 0.6rem;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bba-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(109, 94, 252, 0.3) transparent;
}

.bba-chatbot-messages::-webkit-scrollbar {
  width: 0.4rem;
}

.bba-chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(109, 94, 252, 0.25);
  border-radius: 9999px;
}

.bba-chatbot-message {
  max-width: 88%;
  padding: 0.85rem 0.95rem;
  border-radius: 1.15rem;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.bba-chatbot-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #6d5efc, #7c70ff);
  color: #fff;
  border-bottom-right-radius: 0.35rem;
  box-shadow: 0 10px 24px rgba(109, 94, 252, 0.18);
}

.bba-chatbot-message.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(120, 134, 156, 0.14);
  color: var(--chatbot-text);
  border-bottom-left-radius: 0.35rem;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

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

.bba-chatbot-form {
  padding: 0.8rem;
  border-top: 1px solid rgba(120, 134, 156, 0.14);
  display: flex;
  gap: 0.55rem;
  background: rgba(255, 255, 255, 0.76);
}

.bba-chatbot-input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(120, 134, 156, 0.2);
  border-radius: 1rem;
  color: var(--chatbot-text);
  padding: 0.8rem 0.9rem;
  font-size: 0.86rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bba-chatbot-input:focus {
  outline: none;
  border-color: rgba(109, 94, 252, 0.45);
  box-shadow: 0 0 0 4px rgba(109, 94, 252, 0.1);
}

.bba-chatbot-input::placeholder {
  color: var(--chatbot-muted);
}

.bba-chatbot-send {
  border: 0;
  border-radius: 1rem;
  padding: 0 1rem;
  background: var(--chatbot-accent);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 20px rgba(109, 94, 252, 0.18);
}

.bba-chatbot-send:hover {
  background: var(--chatbot-accent-hover);
  transform: translateY(-1px);
}

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

.bot-card-premium {
  background:
    radial-gradient(circle at top left, rgba(109, 94, 252, 0.09), transparent 48%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 245, 240, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.bot-card-premium:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 36px rgba(15, 23, 42, 0.12);
  border-color: rgba(109, 94, 252, 0.28);
}

.bot-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.bot-badge-live {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.24);
}

.bot-badge-preview {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
  border: 1px solid rgba(100, 116, 139, 0.24);
}

.demo-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1rem;
  width: 100%;
  border-radius: 0.95rem;
  padding: 0.72rem 0.9rem;
  background: linear-gradient(135deg, #6d5efc, #7c70ff);
  color: #fff;
  font-weight: 700;
  font-size: 0.86rem;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.demo-action:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.preview-snippet {
  margin-top: 0.9rem;
  padding: 0.8rem;
  border-radius: 0.95rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.preview-line {
  display: block;
  margin-top: 0.35rem;
  padding: 0.42rem 0.6rem;
  border-radius: 0.7rem;
  font-size: 0.78rem;
  line-height: 1.4;
}

.preview-line:first-child {
  margin-top: 0;
}

.preview-line.user {
  background: rgba(109, 94, 252, 0.14);
  color: #4338ca;
}

.preview-line.bot {
  background: rgba(148, 163, 184, 0.14);
  color: #334155;
}

.demo-page {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: #1f2937;
  background:
    radial-gradient(circle at top right, rgba(109, 94, 252, 0.14), transparent 38%),
    radial-gradient(circle at bottom left, rgba(19, 184, 166, 0.1), transparent 30%),
    #f7f4ef;
}

.demo-wrap {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 2.25rem 1rem 2.5rem;
}

.demo-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #4f46e5;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.86rem;
  margin-bottom: 1.2rem;
}

.demo-back:hover {
  text-decoration: underline;
}

.demo-hero {
  background:
    radial-gradient(circle at top left, rgba(109, 94, 252, 0.1), transparent 44%),
    rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1.6rem;
  padding: 1.4rem;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
}

.demo-kicker {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.09);
  color: #047857;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.demo-hero h1 {
  margin: 0.8rem 0 0.55rem;
  font-size: clamp(1.85rem, 3vw, 2.4rem);
  letter-spacing: -0.02em;
  color: #0f172a;
}

.demo-hero p {
  margin: 0;
  color: #475569;
  line-height: 1.6;
  max-width: 70ch;
}

.demo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.demo-tags span {
  padding: 0.34rem 0.66rem;
  border-radius: 999px;
  background: rgba(109, 94, 252, 0.12);
  border: 1px solid rgba(109, 94, 252, 0.22);
  color: #4f46e5;
  font-size: 0.72rem;
  font-weight: 600;
}

.demo-chat-shell {
  margin-top: 1rem;
}

#bba-demo-chat {
  max-width: 100%;
}

.bba-demo-panel {
  background:
    radial-gradient(circle at top right, rgba(109, 94, 252, 0.14), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 244, 239, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 1.6rem;
  box-shadow: 0 24px 46px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.bba-demo-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1rem 0.95rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.86);
}

.bba-demo-kicker {
  margin: 0;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 700;
}

.bba-demo-title {
  margin: 0.24rem 0 0;
  font-size: 1.05rem;
  color: #0f172a;
}

.bba-demo-status {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.62rem;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.24);
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.bba-demo-messages {
  height: min(58vh, 520px);
  overflow-y: auto;
  padding: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.68rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(109, 94, 252, 0.24) transparent;
}

.bba-demo-message {
  max-width: 88%;
  border-radius: 1rem;
  padding: 0.7rem 0.86rem;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.bba-demo-message.user {
  align-self: flex-end;
  color: #fff;
  background: linear-gradient(135deg, #6d5efc, #7c70ff);
  border-bottom-right-radius: 0.35rem;
  box-shadow: 0 10px 22px rgba(109, 94, 252, 0.2);
}

.bba-demo-message.assistant {
  align-self: flex-start;
  color: #1f2937;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-bottom-left-radius: 0.35rem;
}

.bba-demo-message.typing {
  color: #64748b;
  font-style: italic;
}

.bba-demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 0.95rem 0.9rem;
}

.bba-demo-quick-button {
  border: 1px solid rgba(109, 94, 252, 0.24);
  background: rgba(109, 94, 252, 0.1);
  color: #4338ca;
  border-radius: 999px;
  padding: 0.36rem 0.68rem;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.bba-demo-quick-button:hover {
  background: rgba(109, 94, 252, 0.16);
  transform: translateY(-1px);
}

.bba-demo-form {
  display: flex;
  gap: 0.55rem;
  padding: 0.8rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.82);
}

.bba-demo-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 0.96rem;
  padding: 0.75rem 0.85rem;
  font-size: 0.86rem;
  color: #1f2937;
  background: rgba(255, 255, 255, 0.96);
}

.bba-demo-input:focus {
  outline: none;
  border-color: rgba(109, 94, 252, 0.45);
  box-shadow: 0 0 0 4px rgba(109, 94, 252, 0.1);
}

.bba-demo-send {
  border: 0;
  border-radius: 0.96rem;
  background: linear-gradient(135deg, #6d5efc, #7c70ff);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0 0.95rem;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(109, 94, 252, 0.2);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.bba-demo-send:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.bba-demo-input:disabled,
.bba-demo-send:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  #bba-chatbot-root {
    right: 1rem;
    bottom: 6rem;
  }

  .bba-chatbot-panel {
    width: min(23rem, calc(100vw - 1.4rem));
    height: min(31rem, calc(100vh - 8rem));
  }

  .bba-chatbot-header::after {
    display: none;
  }

  .bba-demo-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .bba-demo-status {
    white-space: normal;
  }

  .bba-demo-messages {
    height: 52vh;
  }
}
