/* ──────────────────────────────────────────────────────────────────────────
   IPSYSTEM Help Tooltip (v1.23.1)
   - Subtle "?" icon next to labels/titles, hover/focus reveals styled tooltip
   - Auto-positioning, keyboard accessible, mobile-friendly
   ────────────────────────────────────────────────────────────────────────── */

/* The "?" icon */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: transparent;
  color: #9ca3af;
  font-size: 11px;
  margin-left: 4px;
  cursor: help;
  vertical-align: 1px;
  transition: background-color .12s ease, color .12s ease;
  flex-shrink: 0;
  user-select: none;
  border: 0;
  padding: 0;
}
.help-icon:hover,
.help-icon:focus,
.help-icon[aria-expanded="true"] {
  background: #e5e7eb;
  color: #374151;
  outline: none;
}
.help-icon:focus-visible {
  box-shadow: 0 0 0 2px rgba(64, 81, 137, 0.35);
}
.help-icon i { font-size: 11px; line-height: 1; }

/* The tooltip floating element (built once per page, repositioned per show) */
.help-tooltip {
  position: fixed;            /* fixed so it works inside scroll containers, modals, etc */
  z-index: 99999;
  max-width: 320px;
  min-width: 180px;
  background: #1f2937;
  color: #f3f4f6;
  font-size: 12.5px;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18),
              0 2px 4px  rgba(15, 23, 42, 0.10);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease;
  pointer-events: none;
  white-space: normal;
}
.help-tooltip.help-tooltip-show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.help-tooltip-title {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 4px;
  letter-spacing: -0.005em;
}
.help-tooltip-body {
  color: #d1d5db;
}
.help-tooltip-body strong { color: #ffffff; font-weight: 600; }
.help-tooltip-body em {
  display: block;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-style: normal;
  color: #9ca3af;
  font-size: 11.5px;
}
.help-tooltip-body code {
  background: rgba(255,255,255,0.10);
  color: #e5e7eb;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}

/* Arrow — positioned by JS via class */
.help-tooltip::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border: 6px solid transparent;
}
.help-tooltip[data-pos="top"]::after {
  bottom: -12px; left: 50%; margin-left: -6px;
  border-top-color: #1f2937;
}
.help-tooltip[data-pos="bottom"]::after {
  top: -12px; left: 50%; margin-left: -6px;
  border-bottom-color: #1f2937;
}
.help-tooltip[data-pos="left"]::after {
  right: -12px; top: 50%; margin-top: -6px;
  border-left-color: #1f2937;
}
.help-tooltip[data-pos="right"]::after {
  left: -12px; top: 50%; margin-top: -6px;
  border-right-color: #1f2937;
}

/* Mobile — full-width tooltip below the icon */
@media (max-width: 480px) {
  .help-tooltip {
    max-width: calc(100vw - 32px);
    left: 16px !important;
    right: 16px !important;
    width: auto;
  }
  .help-tooltip::after { display: none; }
}

/* When a help icon is inline inside table headers, vcard titles, etc.,
   ensure it inherits a sensible color. */
.vcard-hd .help-icon,
.vcard-title .help-icon,
.page-title .help-icon,
.vlabel .help-icon,
label .help-icon,
th .help-icon {
  color: #b0b6bf;
}
.vcard-hd .help-icon:hover,
.vcard-title .help-icon:hover,
.page-title .help-icon:hover,
.vlabel .help-icon:hover,
label .help-icon:hover,
th .help-icon:hover {
  background: #e5e7eb;
  color: #374151;
}
