.bs-chat {
  --bs-blue: #1072BA;
  --bs-blue-hover: #0C5A94;
  --bs-coral: #FF7F50;
  --bs-bar-bg: #ffffff;
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.bs-chat__btn {
  border: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.bs-chat__btn:focus-visible {
  outline: 2px solid var(--bs-blue);
  outline-offset: 2px;
}

.bs-chat__btn svg {
  display: block;
}

.bs-chat__dot {
  position: absolute;
  border-radius: 50%;
  background: var(--bs-coral);
  border: 2px solid var(--bs-bar-bg);
  display: none;
  pointer-events: none;
}

.bs-chat[data-unread="true"] .bs-chat__dot {
  display: block;
}

/* ── Outline glyph, inline in the header bar ── */
.bs-chat--bar .bs-chat__btn {
  background: none;
  color: var(--bs-blue);
  /* Padding, not width: it grows the tap target to the size of the neighbouring
     header icons while the glyph itself stays 22px as drawn. */
  padding: 6px;
  transition: color 120ms ease;
}

.bs-chat--bar .bs-chat__btn:hover {
  color: var(--bs-blue-hover);
}

.bs-chat--bar .bs-chat__btn svg {
  width: 22px;
  height: 22px;
}

.bs-chat--bar .bs-chat__dot {
  top: 4px;
  right: 4px;
  width: 9px;
  height: 9px;
}

/* ── Filled disc, pinned bottom-right ── */
.bs-chat--fixed {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
}

.bs-chat--fixed .bs-chat__btn {
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--bs-blue);
  color: #fff;
  box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2);
  transition: background-color 120ms ease;
}

.bs-chat--fixed .bs-chat__btn:hover {
  background: var(--bs-blue-hover);
}

.bs-chat--fixed .bs-chat__btn svg {
  width: 21px;
  height: 21px;
}

.bs-chat--fixed .bs-chat__dot {
  top: 0;
  right: 0;
  width: 11px;
  height: 11px;
}

/* 992px is the header's own breakpoint, where .ch-row rewraps. */
@media (min-width: 992px) {
  .bs-chat--sm-only {
    display: none;
  }
}

@media (max-width: 991px) {
  .bs-chat--lg-only {
    display: none;
  }

  /* .ch-row re-orders its children here; order 2 matches .ch-spacer so the button
     follows it in DOM order, landing left of every other header button. */
  .ch-row .bs-chat {
    order: 2;
  }
}

.bs-chat__tip {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1;
  white-space: nowrap;
  background: #26261f;
  color: #fff;
  font: 400 12px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 6px 8px;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 120ms ease, transform 120ms ease;
  pointer-events: none;
}

.bs-chat--fixed .bs-chat__tip {
  top: auto;
  bottom: calc(100% + 6px);
  transform: translateY(2px);
}

@media (pointer: fine) {
  .bs-chat:hover .bs-chat__tip,
  .bs-chat:focus-within .bs-chat__tip {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bs-chat__btn,
  .bs-chat__tip {
    transition: none;
  }
}
