/**
 * BVUNZO tooltip system — see docs/TOOLTIP.md
 * Matches bv-card / bv-notice surfaces: white card, green accent, navy copy.
 */

#bv-tooltip-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10050;
}

.bv-tooltip {
  --bv-tip-arrow: 8px;
  position: fixed;
  left: 0;
  top: 0;
  max-width: min(20rem, calc(100vw - 1.5rem));
  padding: 0;
  border-radius: var(--radius-md, 18px);
  border: 1px solid rgba(59, 181, 74, 0.32);
  background: linear-gradient(
    165deg,
    rgba(59, 181, 74, 0.1) 0%,
    rgba(255, 255, 255, 0.98) 42%,
    #ffffff 100%
  );
  color: var(--text-main, #17212b);
  font-family: var(--font-body, "Roboto", system-ui, sans-serif);
  font-size: var(--text-caption, 0.8125rem);
  font-weight: 500;
  line-height: 1.5;
  box-shadow:
    0 4px 6px rgba(15, 34, 45, 0.04),
    0 12px 28px rgba(15, 34, 45, 0.1),
    0 0 0 1px rgba(59, 181, 74, 0.08);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transition:
    opacity 0.18s ease,
    transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 10051;
  overflow: visible;
}

.bv-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  width: var(--bv-tip-arrow);
  height: var(--bv-tip-arrow);
  margin-left: calc(var(--bv-tip-arrow) / -2);
  background: #fff;
  border: 1px solid rgba(59, 181, 74, 0.28);
  transform: rotate(45deg);
  box-shadow: 2px 2px 4px rgba(15, 34, 45, 0.06);
}

.bv-tooltip--above::after {
  bottom: calc(var(--bv-tip-arrow) / -2 - 1px);
  border-bottom-color: transparent;
  border-right-color: transparent;
}

.bv-tooltip--below::after {
  top: calc(var(--bv-tip-arrow) / -2 - 1px);
  border-top-color: transparent;
  border-left-color: transparent;
  box-shadow: -1px -1px 3px rgba(15, 34, 45, 0.05);
}

.bv-tooltip__inner {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem 0.65rem;
}

.bv-tooltip__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: rgba(59, 181, 74, 0.14);
  color: var(--brand-primary-dark, #2d9a3a);
  font-size: 0.8rem;
  line-height: 1;
}

.bv-tooltip__text {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--brand-navy, #0f222d);
  font-weight: 500;
}

.bv-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── Trigger hint icons ── */

.bv-tip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  cursor: help;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
  vertical-align: baseline;
}

.bv-tip:focus-visible {
  outline: 2px solid var(--brand-primary, #3bb54a);
  outline-offset: 2px;
  border-radius: 4px;
}

.bv-tip__hint {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05em;
  height: 1.05em;
  border-radius: 50%;
  font-size: 0.75em;
  line-height: 1;
  color: var(--brand-primary-dark, #2d9a3a);
  background: rgba(59, 181, 74, 0.12);
  opacity: 0.85;
  transition:
    opacity 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.bv-tip:hover .bv-tip__hint,
.bv-tip:focus-visible .bv-tip__hint,
.bv-tip:focus .bv-tip__hint {
  opacity: 1;
  background: rgba(59, 181, 74, 0.22);
  color: var(--brand-primary, #3bb54a);
  transform: scale(1.05);
}

a.bv-tip {
  text-decoration: none;
}

a.bv-tip:hover {
  text-decoration: none;
}

.dashboard-card-dropdown-menu a.bv-tip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dashboard-card-dropdown-menu .bv-tip__hint {
  margin-left: auto;
  font-size: 0.85rem;
}

.bv-run-badge.bv-tip {
  display: inline-flex;
  align-items: center;
}

.bv-reset-pill.bv-tip .bv-tip__hint {
  margin-left: 0.15rem;
}

.landing-main .bv-tooltip {
  border-color: rgba(59, 181, 74, 0.35);
  box-shadow:
    0 8px 24px rgba(15, 34, 45, 0.12),
    0 0 0 1px rgba(59, 181, 74, 0.1);
}

@media (hover: none) {
  .bv-tip {
    cursor: pointer;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bv-tooltip {
    transition: opacity 0.01s linear;
    transform: none;
  }

  .bv-tooltip.is-visible {
    transform: none;
  }

  .bv-tip__hint {
    transition: none;
  }
}
