/* =========================================================
   Info-tip: small circular `!` help button + tooltip bubble
   =========================================================

   Rolled out portal-wide next to dashboard widget headers,
   tab/tool titles, and field labels so new users can get a
   one-sentence explanation of what an element does.

   Design constraints (firm):
   - Light theme only — no dark backgrounds.
   - Must not disrupt flex/grid layouts — uses inline-flex.
   - Bubble must open on hover AND keyboard focus (a11y).
   - Button is 18–20 px so it reads as "help" not "delete".
*/

.info-tip-wrap {
  display: inline-flex;
  position: relative;
  vertical-align: middle;
  margin-left: 6px;
  line-height: 1;
}

.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(0, 114, 188, 0.35);
  border-radius: 50%;
  background: rgba(0, 114, 188, 0.08);
  color: #0072BC;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  user-select: none;
  transition: background 150ms ease, border-color 150ms ease,
              color 150ms ease, box-shadow 150ms ease;
  flex-shrink: 0;
}

.info-tip:hover,
.info-tip:focus-visible {
  background: #0072BC;
  border-color: #0072BC;
  color: #ffffff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 114, 188, 0.20);
}

.info-tip > span {
  display: block;
  pointer-events: none;
}

/* ── Tooltip bubble ──────────────────────────────────────── */
.info-tip-bubble {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  min-width: 220px;
  max-width: 320px;
  padding: 10px 12px;
  background: #ffffff;
  color: #1A2035;
  border: 1px solid rgba(0, 59, 122, 0.14);
  border-radius: 8px;
  box-shadow: 0 12px 32px -8px rgba(0, 59, 122, 0.18),
              0 2px 8px -2px rgba(0, 59, 122, 0.10);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease,
              visibility 0s linear 160ms;
  z-index: 1200;
  white-space: normal;
}

.info-tip-wrap:hover .info-tip-bubble,
.info-tip-wrap:focus-within .info-tip-bubble,
.info-tip:focus-visible + .info-tip-bubble {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  transition: opacity 160ms ease, transform 160ms ease,
              visibility 0s linear 0s;
}

.info-tip-bubble strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 12px;
  color: #003B7A;
  letter-spacing: 0.01em;
}

.info-tip-body {
  display: block;
  color: #475569;
  font-weight: 400;
  font-size: 12px;
  line-height: 1.5;
}

.info-tip-body--todo {
  color: #94A3B8;
  font-style: italic;
}

/* ── Arrow pointing up to the button ────────────────────── */
.info-tip-bubble::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-top: 1px solid rgba(0, 59, 122, 0.14);
  border-left: 1px solid rgba(0, 59, 122, 0.14);
}

/* ── Edge-collision fallback: near right edge, anchor right ─ */
.info-tip-wrap.info-tip-wrap--right .info-tip-bubble {
  left: auto;
  right: 0;
  transform: translateX(0) translateY(4px);
}

.info-tip-wrap.info-tip-wrap--right:hover .info-tip-bubble,
.info-tip-wrap.info-tip-wrap--right:focus-within .info-tip-bubble {
  transform: translateX(0) translateY(0);
}

.info-tip-wrap.info-tip-wrap--right .info-tip-bubble::before {
  left: auto;
  right: 8px;
  transform: rotate(45deg);
}

/* ── RTL support ─────────────────────────────────────────── */
[dir="rtl"] .info-tip-wrap {
  margin-left: 0;
  margin-right: 6px;
}

[dir="rtl"] .info-tip-bubble {
  text-align: right;
}

/* ── Print: hide the button, keep the semantics ─────────── */
@media print {
  .info-tip-wrap { display: none !important; }
}

/* ── Reduced-motion: no fade-in animation ───────────────── */
@media (prefers-reduced-motion: reduce) {
  .info-tip,
  .info-tip-bubble {
    transition: none;
  }
}
