.business-listing-card,
.featured-business-card {
  position: relative;
}

.bbd-trusted-badge {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  max-width: calc(100% - 0.9rem);
  padding: 0.14rem 0.42rem 0.14rem 0.28rem;
  font-size: 0.5625rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  color: #1e3a5f;
  background: linear-gradient(
    90deg,
    rgb(255 200 140 / 0.95) 0%,
    rgb(255 255 255 / 0.98) 42%,
    rgb(170 235 200 / 0.95) 100%
  );
  border: 1px solid rgb(30 58 95 / 0.28);
  border-radius: 9999px;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  box-shadow:
    0 1px 0 rgb(255 255 255 / 0.85) inset,
    0 1px 2px rgb(15 23 42 / 0.1),
    0 2px 5px rgb(15 23 42 / 0.06);
}

/* Top-center badge on listing + featured cards */
.business-listing-card:has(.bbd-trusted-badge),
.featured-business-card:has(.bbd-trusted-badge) {
  overflow: visible;
}

.featured-business-card:has(.bbd-trusted-badge) {
  padding-top: 1.25rem;
}

.business-listing-card .bbd-trusted-badge,
.featured-business-card .bbd-trusted-badge {
  top: 0;
  right: 0.75rem;
  left: auto;
  max-width: calc(100% - 1.5rem);
  transform: translateY(-50%);
}

.featured-business-card:has(.bbd-trusted-badge) .featured-business-card__head {
  padding-right: 0.25rem;
}

.bbd-trusted-badge__icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 0.75rem;
  height: 0.75rem;
  color: #1e40af;
}

.bbd-trusted-badge__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.bbd-trusted-badge__text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.bbd-trusted-badge__tooltip {
  position: absolute;
  z-index: 100;
  bottom: calc(100% + 0.45rem);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 0.4rem 0.6rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: normal;
  white-space: nowrap;
  color: #fff;
  background: #111827;
  border-radius: 0.375rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.bbd-trusted-badge__tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #111827;
}

.bbd-trusted-badge:hover .bbd-trusted-badge__tooltip,
.bbd-trusted-badge:focus-visible .bbd-trusted-badge__tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Tooltip below badge on cards (avoids top/side clipping) */
.business-listing-card .bbd-trusted-badge__tooltip,
.featured-business-card .bbd-trusted-badge__tooltip {
  top: calc(100% + 0.45rem);
  bottom: auto;
  right: 0;
  left: auto;
  width: max-content;
  max-width: min(16rem, calc(100vw - 2rem));
  white-space: normal;
  text-align: right;
  transform: translateY(-4px);
}

.business-listing-card .bbd-trusted-badge:hover .bbd-trusted-badge__tooltip,
.business-listing-card .bbd-trusted-badge:focus-visible .bbd-trusted-badge__tooltip,
.featured-business-card .bbd-trusted-badge:hover .bbd-trusted-badge__tooltip,
.featured-business-card .bbd-trusted-badge:focus-visible .bbd-trusted-badge__tooltip {
  transform: translateY(0);
}

.business-listing-card .bbd-trusted-badge__tooltip::after,
.featured-business-card .bbd-trusted-badge__tooltip::after {
  top: auto;
  bottom: 100%;
  left: auto;
  right: 0.85rem;
  transform: none;
  border-top-color: transparent;
  border-bottom-color: #111827;
}

@media (min-width: 640px) {
  .bbd-trusted-badge {
    top: 0.55rem;
    right: 0.55rem;
    padding: 0.18rem 0.5rem 0.18rem 0.32rem;
    font-size: 0.625rem;
  }

  .business-listing-card .bbd-trusted-badge,
  .featured-business-card .bbd-trusted-badge {
    top: 0;
    right: 0.875rem;
    left: auto;
    transform: translateY(-50%);
  }

  .bbd-trusted-badge__icon {
    width: 0.8125rem;
    height: 0.8125rem;
  }
}
