/*
 * onboarding_tour.css — estilos do tour guiado de primeiro acesso.
 *
 * Duas partes independentes:
 *  1. Botão de ajuda no topbar (ao lado do avatar) + popover para rever passos.
 *  2. Camada do tour em si: painéis de blur ao redor do alvo (foco), anel de
 *     destaque, capturador de clique e balão explicativo.
 *
 * Toda a camada do tour vive acima de qualquer coisa da aplicação (modais
 * usam z-index ~40; aqui começamos em 99990).
 */

/* ─────────────────────────── Botão de ajuda ─────────────────────────── */
.tour-help {
  position: relative;
}

.tour-help-trigger {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  min-height: 0;
  cursor: pointer;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tour-help-trigger:hover,
.tour-help-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tour-help-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  display: grid;
  width: 268px;
  max-height: min(70vh, 460px);
  padding: 8px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  gap: 2px;
}

.tour-help-header {
  display: grid;
  padding: 8px 10px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  gap: 2px;
}

.tour-help-header strong {
  font-size: 13px;
}

.tour-help-header .muted {
  color: var(--muted);
  font-size: 12px;
}

.tour-help-item {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.tour-help-item:hover {
  background: var(--panel-soft);
}

.tour-help-item-icon {
  display: inline-flex;
  color: var(--muted);
}

.tour-help-restart {
  color: var(--accent-strong);
}

.tour-help-restart .tour-help-item-icon {
  color: var(--accent);
}

.tour-help-steps {
  display: grid;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
  gap: 1px;
}

.tour-help-group-title {
  padding: 8px 10px 3px;
  color: var(--subtle);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tour-help-step {
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  text-align: left;
}

.tour-help-step:hover {
  background: var(--panel-soft);
}

.tour-help-step.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tour-help-step-index {
  display: grid;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 10.5px;
  font-weight: 800;
  place-items: center;
}

/* ─────────────────────────── Camada do tour ─────────────────────────── */
.tour-root {
  position: fixed;
  inset: 0;
  z-index: 99990;
}

.tour-root[hidden] {
  display: none;
}

/* Overlay único de blur + escurecimento. Um "buraco" arredondado é aberto
 * sobre o alvo com uma máscara (imagem SVG gerada no JS), usando o mesmo raio
 * de borda do componente em foco — assim o recorte acompanha as bordas
 * arredondadas em vez de cortar em quadrado. Sem alvo (passo centralizado),
 * a máscara é removida e a tela inteira fica desfocada. */
.tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 18, 28, 0.44);
  -webkit-backdrop-filter: blur(2.5px);
  backdrop-filter: blur(2.5px);
  pointer-events: none;
}

/* Anel de destaque em volta do alvo. */
.tour-ring {
  position: fixed;
  z-index: 99991;
  border: 2px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.25), 0 8px 24px rgba(12, 18, 28, 0.25);
  pointer-events: none;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.tour-ring[hidden] {
  display: none;
}

/* Captura todos os cliques. Um clique dentro do alvo avança o tour; fora,
 * é ignorado (o usuário usa os botões do balão). */
.tour-catcher {
  position: fixed;
  inset: 0;
  z-index: 99992;
  background: transparent;
}

/* ─────────────────────────────── Balão ──────────────────────────────── */
.tour-balloon {
  position: fixed;
  z-index: 99993;
  width: min(340px, calc(100vw - 28px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(12, 18, 28, 0.28);
  animation: tour-balloon-in 0.2s ease;
}

@keyframes tour-balloon-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.tour-balloon.has-sample {
  width: min(430px, calc(100vw - 28px));
}

/* Amostra de dados de exemplo dentro do balão */
.tour-sample {
  margin-top: 12px;
}

.tour-sample-caption {
  margin: 0 0 6px;
  color: var(--subtle);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tour-sample-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tour-sample-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.tour-sample-table th,
.tour-sample-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.tour-sample-table thead th {
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 700;
}

.tour-sample-table tbody tr:last-child td {
  border-bottom: 0;
}

.tour-sample-table .is-hl {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.tour-balloon-arrow {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--panel);
  transform: rotate(45deg);
}

.tour-balloon-arrow.is-top { border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.tour-balloon-arrow.is-bottom { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.tour-balloon-arrow.is-left { border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.tour-balloon-arrow.is-right { border-top: 1px solid var(--line); border-right: 1px solid var(--line); }
.tour-balloon-arrow.is-hidden { display: none; }

.tour-balloon-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--subtle);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  place-items: center;
}

.tour-balloon-close:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.tour-balloon-eyebrow {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tour-balloon-title {
  margin: 0 0 6px;
  padding-right: 20px;
  font-size: 15.5px;
  font-weight: 800;
  line-height: 1.3;
}

.tour-balloon-body {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.tour-balloon-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}

.tour-balloon-progress {
  flex: 0 0 auto;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tour-count-current {
  color: var(--accent-strong);
}

.tour-balloon-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tour-btn {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.tour-btn:hover {
  background: var(--accent-strong);
}

.tour-btn-ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text);
}

.tour-btn-ghost:hover {
  background: var(--panel-soft);
}

.tour-balloon-skip {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--subtle);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
}

.tour-balloon-skip:hover {
  color: var(--muted);
}

/* Dica de "clique aqui" que pisca sobre o alvo quando o usuário clica fora. */
.tour-nudge {
  animation: tour-nudge 0.4s ease;
}

@keyframes tour-nudge {
  0%, 100% { box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.25), 0 8px 24px rgba(12, 18, 28, 0.25); }
  50% { box-shadow: 0 0 0 8px rgba(47, 111, 237, 0.45), 0 8px 24px rgba(12, 18, 28, 0.25); }
}

/* ─────────────────────────── Responsivo ─────────────────────────────── */
@media (max-width: 640px) {
  .tour-balloon {
    left: 14px !important;
    right: 14px !important;
    bottom: 14px !important;
    top: auto !important;
    width: auto;
  }
  .tour-balloon-arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tour-ring,
  .tour-balloon {
    transition: none;
    animation: none;
  }
}
