/* =============================================================================
   HELP TOOLTIP — engine global de ajuda contextual
   Extraído de app.css na Fase 8 (split CSS).
   Linhas originais: 1501-1781
   ============================================================================= */

/* ============================================================================
   HELP TOOLTIP — engine global de ajuda contextual
   ============================================================================ */

/* Ícone "i" reutilizável. Pode ser <span class="info-icon" data-help="..."></span>
   — o engine injeta o "i" automaticamente. */
.info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07);
  color: var(--txt-mut);
  font-size: 10px; font-weight: 800; font-family: serif; font-style: italic;
  cursor: help;
  vertical-align: middle;
  flex-shrink: 0;
  transition: background .15s, color .15s, transform .12s;
  user-select: none;
  margin-left: 4px;
  position: relative;
  border: 1px solid transparent;
}
.info-icon:hover,
.info-icon:focus {
  background: var(--acc-cyan, #36C5F0);
  color: #fff;
  outline: none;
  transform: scale(1.1);
}
.info-icon:focus-visible {
  border-color: var(--acc-cyan, #36C5F0);
  box-shadow: 0 0 0 2px rgba(54,197,240,.25);
}
/* Variações de tamanho */
.info-icon.sm { width: 13px; height: 13px; font-size: 9px; }
.info-icon.lg { width: 20px; height: 20px; font-size: 12px; }

/* O tooltip global (apenas 1 no DOM, reutilizado) */
.ht-tip {
  position: fixed;
  z-index: 10000;
  max-width: 360px;
  min-width: 220px;
  background: linear-gradient(180deg, rgba(15, 23, 40, .98) 0%, rgba(11, 18, 32, .98) 100%);
  color: #E8ECF4;
  border: 1px solid rgba(54, 197, 240, .28);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0,0,0,.55), 0 4px 12px rgba(0,0,0,.35);
  font-size: 12.5px;
  line-height: 1.55;
  letter-spacing: .15px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(2px) scale(.98);
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.ht-tip.ht-show {
  opacity: 1; visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Setinha — direção depende da posição */
.ht-tip .ht-arrow {
  position: absolute;
  width: 10px; height: 10px;
  background: inherit;
  border: 1px solid rgba(54, 197, 240, .28);
  transform: rotate(45deg);
}
.ht-tip.ht-pos-bottom .ht-arrow { top: -6px;    border-right: none;  border-bottom: none; }
.ht-tip.ht-pos-top    .ht-arrow { bottom: -6px; border-left: none;   border-top: none;    }
.ht-tip.ht-pos-right  .ht-arrow { left: -6px;   border-right: none;  border-top: none;    }
.ht-tip.ht-pos-left   .ht-arrow { right: -6px;  border-left: none;   border-bottom: none; }

.ht-tip .ht-body {
  padding: 12px 14px 8px;
  border-radius: 12px;
  position: relative;
  z-index: 1;
}
.ht-tip .ht-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: .1px;
  display: flex; align-items: center; gap: 6px;
}
.ht-tip .ht-title::before {
  content: ""; width: 4px; height: 14px;
  background: var(--acc-cyan, #36C5F0);
  border-radius: 2px;
  display: inline-block;
}
.ht-tip .ht-desc {
  font-size: 12.5px;
  color: #C5CCD9;
  margin-bottom: 6px;
}
.ht-tip .ht-block {
  margin-top: 8px;
  padding: 7px 9px;
  border-radius: 7px;
  font-size: 11.5px;
  color: #C5CCD9;
  background: rgba(255,255,255,.025);
  border-left: 2px solid rgba(54,197,240,.35);
  display: none; /* mostrado via JS quando há valor */
}
.ht-tip .ht-block::before {
  content: attr(data-label) ":";
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--acc-cyan, #36C5F0);
  margin-bottom: 2px;
}
.ht-tip .ht-formula { border-left-color: rgba(155, 89, 182, .55); }
.ht-tip .ht-formula::before { color: #B47CD1; }
.ht-tip .ht-source  { border-left-color: rgba(54, 197, 240, .55); }
.ht-tip .ht-source::before  { color: #36C5F0; }
.ht-tip .ht-filters { border-left-color: rgba(46, 204, 113, .55); }
.ht-tip .ht-filters::before { color: #2ECC71; }
.ht-tip .ht-example { border-left-color: rgba(241, 196, 15, .55); }
.ht-tip .ht-example::before { color: #F1C40F; }
.ht-tip .ht-warning {
  border-left-color: rgba(231, 76, 60, .65);
  background: rgba(231, 76, 60, .08);
  color: #FFB7AE;
}
.ht-tip .ht-warning::before { color: #E74C3C; }

.ht-tip .ht-foot {
  margin-top: 10px;
  padding: 6px 10px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; justify-content: space-between; align-items: center;
}
.ht-tip .ht-key {
  font-family: monospace;
  font-size: 10px;
  color: rgba(255,255,255,.35);
  letter-spacing: .3px;
}

/* Tema claro */
[data-theme="light"] .ht-tip {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,255,.98));
  color: #1A2235;
  border-color: rgba(54,197,240,.4);
  box-shadow: 0 18px 48px rgba(0,0,0,.18), 0 4px 12px rgba(0,0,0,.08);
}
[data-theme="light"] .ht-tip .ht-title { color: #0F1A2D; }
[data-theme="light"] .ht-tip .ht-desc,
[data-theme="light"] .ht-tip .ht-block { color: #364257; }
[data-theme="light"] .ht-tip .ht-warning { color: #B03A2E; }
[data-theme="light"] .ht-tip .ht-key { color: rgba(0,0,0,.35); }

/* Botão "?" no header */
.btn-help-central {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(54, 197, 240, .12);
  border: 1px solid rgba(54, 197, 240, .35);
  color: var(--acc-cyan, #36C5F0);
  cursor: pointer;
  font-size: 16px; font-weight: 700;
  transition: all .15s;
}
.btn-help-central:hover {
  background: var(--acc-cyan, #36C5F0);
  color: #fff;
  transform: scale(1.06);
}

/* Central de Ajuda — modal lateral */
.ht-central-bg {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 9000;
  align-items: stretch; justify-content: flex-end;
  backdrop-filter: blur(2px);
}
.ht-central-bg.show { display: flex; animation: htFadeIn .18s ease; }
@keyframes htFadeIn { from { opacity: 0 } to { opacity: 1 } }
.ht-central-panel {
  width: 100%;
  max-width: 540px;
  background: var(--card, #131C32);
  border-left: 1px solid var(--border, rgba(255,255,255,.08));
  display: flex; flex-direction: column;
  box-shadow: -10px 0 40px rgba(0,0,0,.4);
  animation: htSlideIn .22s ease;
}
@keyframes htSlideIn { from { transform: translateX(40px); opacity: 0 } to { transform: translateX(0); opacity: 1 } }

.ht-central-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: linear-gradient(180deg, rgba(54,197,240,.08), transparent);
}
.ht-central-head #ht-central-title {
  font-size: 16px; font-weight: 800;
  color: var(--text);
}
.ht-central-sub { font-size: 11.5px; color: var(--txt-mut); margin-top: 2px; }

.ht-central-search {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 12px; align-items: center;
}
.ht-central-search input[type="search"] {
  flex: 1;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}
.ht-central-search input[type="search"]:focus {
  outline: none; border-color: var(--acc-cyan, #36C5F0);
  box-shadow: 0 0 0 2px rgba(54,197,240,.15);
}
#ht-central-cont { font-size: 11px; color: var(--txt-mut); white-space: nowrap; }

.ht-central-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  display: flex; flex-direction: column; gap: 10px;
}
.ht-central-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  border-left: 3px solid var(--acc-cyan, #36C5F0);
}
.ht-central-card header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin-bottom: 6px;
}
.ht-central-card header h4 {
  margin: 0; font-size: 13.5px; font-weight: 700; color: var(--text);
}
.ht-central-card header code {
  font-size: 10px; color: var(--txt-mut);
  background: var(--card); padding: 1px 5px; border-radius: 3px;
  border: 1px solid var(--border);
}
.ht-central-card p { margin: 0 0 6px; font-size: 12.5px; color: var(--txt-mut); line-height: 1.5; }
.ht-central-block {
  font-size: 11.5px; line-height: 1.45; color: var(--txt-mut);
  margin-top: 4px;
}
.ht-central-block-lbl {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--text);
  display: inline-block; margin-right: 4px;
}
.ht-empty {
  padding: 40px 20px; text-align: center;
  color: var(--txt-mut); font-size: 13px;
}

@media (max-width: 600px) {
  .ht-central-panel { max-width: 100%; }
  .ht-tip           { max-width: calc(100vw - 24px); min-width: 180px; }
  .ht-tip .ht-body  { padding: 10px 12px; }
}
