:root {
  --bb-ai-blue: #2563eb;
  --bb-ai-blue-2: #3b82f6;
  --bb-ai-ink: #0f172a;
  --bb-ai-muted: #64748b;
  --bb-ai-border: rgba(15, 23, 42, 0.09);
  --bb-ai-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}

.bb-ai-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999999;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.bb-ai-fab {
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bb-ai-blue), #1d4ed8);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.35);
  position: relative;
  display: grid;
  place-items: center;
  transition: transform .2s ease, box-shadow .2s ease;
}

.bb-ai-fab:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.42);
}

.bb-ai-fab-icon {
  font-size: 28px;
  line-height: 1;
}

.bb-ai-fab-pulse {
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(37, 99, 235, .35);
  border-radius: 50%;
  animation: bb-ai-pulse 2.2s infinite;
  pointer-events: none;
}

@keyframes bb-ai-pulse {
  0%, 60%, 100% { transform: scale(1); opacity: .55; }
  30% { transform: scale(1.12); opacity: 0; }
}

/* Ensure the close button can actually hide the panel even if a theme/plugin overrides [hidden]. */
.bb-ai-panel[hidden] {
  display: none !important;
}

.bb-ai-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(390px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px));
  background: rgba(255,255,255,.98);
  border: 1px solid var(--bb-ai-border);
  border-radius: 24px;
  box-shadow: var(--bb-ai-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(18px);
  animation: bb-ai-in .22s ease both;
}

@keyframes bb-ai-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.bb-ai-header {
  padding: 16px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--bb-ai-border);
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.bb-ai-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.bb-ai-avatar,
.bb-ai-mini-avatar {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--bb-ai-blue), #60a5fa);
  box-shadow: 0 7px 20px rgba(37, 99, 235, .22);
}

.bb-ai-avatar {
  width: 40px;
  height: 40px;
  border-radius: 13px;
}

.bb-ai-brand strong {
  display: block;
  color: var(--bb-ai-ink);
  font-size: 15px;
  letter-spacing: -.2px;
}

.bb-ai-brand span {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--bb-ai-muted);
  font-size: 11px;
}

.bb-ai-brand i {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
}

.bb-ai-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  font-size: 23px;
  line-height: 1;
}

.bb-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 15px 8px;
  background:
    radial-gradient(circle at 0 0, rgba(59,130,246,.07), transparent 28%),
    #fbfdff;
}

.bb-ai-message {
  margin: 0 0 13px;
}

.bb-ai-user {
  display: flex;
  justify-content: flex-end;
}

.bb-ai-bubble {
  max-width: 84%;
  padding: 11px 13px;
  border-radius: 16px;
  color: #1e293b;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.bb-ai-user .bb-ai-bubble {
  background: linear-gradient(135deg, var(--bb-ai-blue), #3b82f6);
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .15);
}

.bb-ai-bot-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.bb-ai-bot .bb-ai-bubble {
  background: #fff;
  border: 1px solid var(--bb-ai-border);
  border-bottom-left-radius: 5px;
}

.bb-ai-bubble a {
  color: var(--bb-ai-blue);
}

.bb-ai-mini-avatar {
  flex: 0 0 27px;
  width: 27px;
  height: 27px;
  border-radius: 9px;
  font-size: 12px;
}

.bb-ai-typing .bb-ai-bubble {
  color: var(--bb-ai-muted);
  animation: bb-ai-blink 1.2s infinite;
}

@keyframes bb-ai-blink {
  50% { opacity: .45; }
}

.bb-ai-suggestions {
  display: flex;
  gap: 7px;
  padding: 7px 12px 9px;
  overflow-x: auto;
  background: #fbfdff;
  scrollbar-width: none;
}

.bb-ai-suggestions::-webkit-scrollbar { display: none; }

.bb-ai-suggestions button {
  flex: 0 0 auto;
  border: 1px solid rgba(37, 99, 235, .15);
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 7px 10px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.bb-ai-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid var(--bb-ai-border);
}

.bb-ai-form textarea {
  flex: 1;
  min-height: 42px;
  max-height: 110px;
  resize: none;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 14px;
  padding: 11px 12px;
  outline: none;
  font: inherit;
  font-size: 13px;
  color: var(--bb-ai-ink);
  background: #f8fafc;
  box-sizing: border-box;
}

.bb-ai-form textarea:focus {
  border-color: rgba(37, 99, 235, .5);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.bb-ai-form button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 0;
  border-radius: 13px;
  background: var(--bb-ai-blue);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
}

.bb-ai-form button:disabled {
  opacity: .55;
  cursor: wait;
}

.bb-ai-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px 9px;
  color: #94a3b8;
  background: #fff;
  font-size: 9px;
}

.bb-ai-footer a {
  color: #16a34a;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .bb-ai-root {
    right: 14px;
    bottom: 96px; /* stays above the site's fixed mobile bottom navigation */
  }

  .bb-ai-fab {
    width: 58px;
    height: 58px;
  }

  .bb-ai-panel {
    right: -2px;
    bottom: 70px;
    width: min(390px, calc(100vw - 28px));
    height: min(560px, calc(100vh - 155px));
    border-radius: 22px;
  }
}


/* Initial chat area: keep it comfortable instead of looking like a broken/empty panel. */
.bb-ai-messages {
  min-height: 180px;
  scrollbar-width: thin;
}
