/* ============================================================================
   guided_tour.css — Tour guiado na tela (coachmarks / spotlight)
   Overlay escuro com recorte iluminado no elemento-alvo (modo forçado:
   só o alvo fica clicável), anel pulsante, balão de instrução com seta e
   seta animada apontando o botão. Pílula flutuante quando o usuário está
   fora da página do passo.

   Tema dark obrigatório. Sem neon estático (regra do design system): o
   destaque usa borda + ripple animado, não glow colorido fixo.
   Todas as cores via tokens (var(--token)) com fallback.
   ============================================================================ */

:root {
    --gt-z: 99990;
    --gt-mask: rgba(0, 0, 0, 0.74);
    --gt-accent: var(--brand, #00C215);
    --gt-accent-text: #062b12; /* texto escuro fixo p/ ler sobre o verde (não depende de token) */
}

/* Trava o scroll do body enquanto o tour aponta um alvo on-page */
body.gt-locked {
    overflow: hidden;
}

/* --- Máscara escura com buraco (clip-path definido inline pelo JS) --------- */
.gt-mask {
    position: fixed;
    inset: 0;
    z-index: var(--gt-z);
    background: var(--gt-mask);
    opacity: 0;
    transition: opacity 0.25s ease;
    /* CRÍTICO: sem .gt-show a máscara NÃO captura clique (senão bloquearia a
       página inteira mesmo invisível). A região do buraco (clip-path evenodd)
       não captura clique -> o alvo por baixo permanece clicável. */
    pointer-events: none;
    cursor: not-allowed;
}

.gt-mask.gt-show {
    opacity: 1;
    pointer-events: auto;
}

/* --- Anel pulsante em volta do alvo --------------------------------------- */
.gt-ring {
    position: fixed;
    z-index: calc(var(--gt-z) + 1);
    border: 2px solid var(--gt-accent);
    border-radius: 12px;
    pointer-events: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35);
    transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease, opacity 0.2s ease;
    opacity: 0;
}

.gt-ring.gt-show {
    opacity: 1;
}

/* ripple (eco) ao redor do alvo — sensação de "clique aqui" sem neon fixo */
.gt-ring::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    border: 2px solid var(--gt-accent);
    opacity: 0;
    animation: gt-ripple 1.8s ease-out infinite;
}

@keyframes gt-ripple {
    0% { transform: scale(1); opacity: 0.55; }
    70% { transform: scale(1.12); opacity: 0; }
    100% { opacity: 0; }
}

/* --- Seta animada apontando o alvo ---------------------------------------- */
.gt-pointer {
    position: fixed;
    z-index: calc(var(--gt-z) + 2);
    color: var(--gt-accent);
    font-size: 30px;
    line-height: 1;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gt-pointer.gt-show {
    opacity: 1;
}

.gt-pointer[data-dir="top"] { animation: gt-bob-y 1.1s ease-in-out infinite; }
.gt-pointer[data-dir="bottom"] { animation: gt-bob-y-rev 1.1s ease-in-out infinite; }
.gt-pointer[data-dir="left"] { animation: gt-bob-x 1.1s ease-in-out infinite; }
.gt-pointer[data-dir="right"] { animation: gt-bob-x-rev 1.1s ease-in-out infinite; }

@keyframes gt-bob-y { 0%,100% { transform: translateY(0); } 50% { transform: translateY(7px); } }
@keyframes gt-bob-y-rev { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes gt-bob-x { 0%,100% { transform: translateX(0); } 50% { transform: translateX(7px); } }
@keyframes gt-bob-x-rev { 0%,100% { transform: translateX(0); } 50% { transform: translateX(-7px); } }

/* --- Balão de instrução --------------------------------------------------- */
.gt-balloon {
    position: fixed;
    z-index: calc(var(--gt-z) + 3);
    width: min(340px, calc(100vw - 32px));
    background: var(--surface-2, #1e1e1e);
    border: 1px solid var(--line, #2a2a2a);
    border-radius: 14px;
    padding: 16px 16px 14px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
    color: var(--text, #eaf2ed);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease, top 0.2s ease, left 0.2s ease;
}

.gt-balloon.gt-show {
    opacity: 1;
    transform: translateY(0);
}

/* bico do balão (preenchido pelo JS conforme o lado) */
.gt-balloon::before {
    content: "";
    position: absolute;
    width: 0;
    height: 0;
    border: 9px solid transparent;
}

.gt-balloon[data-arrow="top"]::before {
    top: -18px; left: var(--gt-arrow-pos, 24px);
    border-bottom-color: var(--surface-2, #1e1e1e);
}
.gt-balloon[data-arrow="bottom"]::before {
    bottom: -18px; left: var(--gt-arrow-pos, 24px);
    border-top-color: var(--surface-2, #1e1e1e);
}
.gt-balloon[data-arrow="left"]::before {
    left: -18px; top: var(--gt-arrow-pos, 24px);
    border-right-color: var(--surface-2, #1e1e1e);
}
.gt-balloon[data-arrow="right"]::before {
    right: -18px; top: var(--gt-arrow-pos, 24px);
    border-left-color: var(--surface-2, #1e1e1e);
}

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

.gt-balloon-title {
    font-family: var(--font-heading, inherit);
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text, #eaf2ed);
    line-height: 1.25;
}

.gt-balloon-text {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-muted, #a6b3ad);
    margin: 0;
}

.gt-balloon-cta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--gt-accent);
}

.gt-balloon-cta i { animation: gt-nudge 1s ease-in-out infinite; }
@keyframes gt-nudge { 0%,100% { transform: translateX(0); } 50% { transform: translateX(3px); } }

.gt-balloon-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line, #2a2a2a);
}

.gt-progress {
    display: flex;
    gap: 5px;
}

.gt-progress span {
    width: 18px;
    height: 4px;
    border-radius: 2px;
    background: var(--line, #2a2a2a);
}

.gt-progress span.done { background: var(--gt-accent); }
.gt-progress span.cur { background: var(--gt-accent); opacity: 0.55; }

.gt-foot-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.gt-link {
    background: none;
    border: 0;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted, #a6b3ad);
    cursor: pointer;
}

.gt-link:hover { color: var(--text, #eaf2ed); }
.gt-link.gt-skip { color: var(--text-muted, #8a948f); }

/* "Sair da conta" — saída garantida mesmo no tutorial obrigatório */
.gt-link--danger { color: var(--error, #fca5a5); }
.gt-link[data-gt="logout"] i { font-size: 11px; margin-right: 3px; }
.gt-foot-msg { font-size: 12px; font-weight: 600; color: var(--text, #eaf2ed); }

/* --- Walker de formulário (campo a campo) --------------------------------- */
.gt-balloon-help {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-muted, #a6b3ad);
    margin: 6px 0 0;
    max-height: 190px;
    overflow: auto;
}
.gt-balloon-help p { margin: 0 0 6px; }
.gt-balloon-help ul { margin: 4px 0 6px; padding-left: 18px; }
.gt-balloon-help li { margin: 2px 0; }
.gt-balloon-help h4 { font-size: 12px; margin: 8px 0 3px; color: var(--text, #eaf2ed); }
.gt-balloon-help strong { color: var(--text, #eaf2ed); }
.gt-balloon-help .help-example {
    background: var(--code-bg, #141414);
    border: 1px solid var(--line, #2a2a2a);
    border-radius: 6px;
    padding: 5px 8px;
    margin: 5px 0;
    font-family: monospace;
    font-size: 12px;
    color: var(--gt-accent);
}

.gt-balloon-err {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--red-dim, rgba(239, 68, 68, 0.12));
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: var(--error, #fca5a5);
    font-size: 12.5px;
    line-height: 1.4;
}
.gt-balloon-err i { margin-top: 1px; }

.gt-optional {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #8a948f);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.gt-btn-next {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--gt-accent);
    color: var(--gt-accent-text);
    border: 0;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
}
.gt-btn-next:hover { filter: brightness(1.06); }

/* realce do campo com erro (aplicado ao input/select) */
.gt-field-error {
    border-color: var(--error, #ef4444) !important;
    box-shadow: 0 0 0 1px rgba(239,68,68,.5) !important;
}

/* --- Pílula "Continuar tour" (usuário fora da página do passo) ------------ */
.gt-pill {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%) translateY(8px);
    z-index: calc(var(--gt-z) + 4);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface-2, #1e1e1e);
    border: 1px solid var(--line, #2a2a2a);
    border-radius: 999px;
    padding: 8px 8px 8px 16px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.5);
    color: var(--text, #eaf2ed);
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.gt-pill.gt-show { opacity: 1; transform: translateX(-50%) translateY(0); }

.gt-pill-label { display: flex; flex-direction: column; line-height: 1.25; }
.gt-pill-label b { font-size: 13px; }
.gt-pill-label small { font-size: 11px; color: var(--text-muted, #a6b3ad); }

.gt-pill-go {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--gt-accent);
    color: var(--gt-accent-text, #04210b);
    border: 0;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.gt-pill-close {
    background: none;
    border: 0;
    color: var(--text-muted, #a6b3ad);
    cursor: pointer;
    font-size: 14px;
    padding: 6px;
    line-height: 1;
}

.gt-pill-close:hover { color: var(--text, #eaf2ed); }

/* --- Botões de ação do balão (modo explain: link x manual) ---------------- */
.gt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.gt-actions .gt-btn-next,
.gt-actions .gt-btn-alt { flex: 1 1 auto; justify-content: center; }

.gt-btn-alt {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2, #1e1e1e);
    color: var(--text, #eaf2ed);
    border: 1px solid var(--line, #2a2a2a);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}
.gt-btn-alt:hover { background: var(--row-hover, #232323); }
.gt-btn-alt i { color: var(--gt-accent); }

/* --- Botão "usar exemplo" (preenche o campo com um valor sugerido) --------- */
.gt-example {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
    max-width: 100%;
    background: var(--surface-2, #1e1e1e);
    border: 1px dashed var(--line, #2a2a2a);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-muted, #a6b3ad);
    cursor: pointer;
    text-align: left;
}
.gt-example:hover { border-style: solid; color: var(--text, #eaf2ed); }
.gt-example i { color: var(--gt-accent); }
.gt-example b { color: var(--text, #eaf2ed); font-weight: 600; }

/* --- Card central (boas-vindas / espera do link / conclusão) --------------- */
.gt-card {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -46%);
    z-index: calc(var(--gt-z) + 5);
    width: min(460px, calc(100vw - 28px));
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: var(--surface-2, #1e1e1e);
    border: 1px solid var(--line, #2a2a2a);
    border-radius: 16px;
    padding: 22px 22px 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    color: var(--text, #eaf2ed);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.gt-card.gt-show { opacity: 1; transform: translate(-50%, -50%); pointer-events: auto; }

.gt-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gt-accent);
    margin-bottom: 8px;
}
.gt-card-badge--ok { color: var(--success, #22c55e); }

.gt-card-title {
    font-family: var(--font-heading, inherit);
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1.25;
}

.gt-card-body { font-size: 13.5px; line-height: 1.6; color: var(--text-muted, #a6b3ad); }
.gt-card-body p { margin: 0 0 8px; }
.gt-card-body b, .gt-card-body strong { color: var(--text, #eaf2ed); }
.gt-card-hint { font-size: 12px; opacity: 0.85; }

.gt-card-steps { list-style: none; margin: 12px 0 4px; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.gt-card-steps li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text, #eaf2ed);
    background: var(--bg, #141414);
    border: 1px solid var(--line, #2a2a2a);
    border-radius: 10px;
    padding: 8px 11px;
}
.gt-card-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid var(--line, #2a2a2a);
    color: var(--gt-accent);
    font-size: 11.5px;
    font-weight: 700;
    flex: 0 0 auto;
}

.gt-card-nexts { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.gt-card-next {
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    background: var(--bg, #141414);
    border: 1px solid var(--line, #2a2a2a);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text, #eaf2ed);
}
.gt-card-next:hover { background: var(--row-hover, #232323); }
.gt-card-next i { color: var(--gt-accent); width: 18px; text-align: center; }
.gt-card-next span { display: flex; flex-direction: column; line-height: 1.3; }
.gt-card-next small { font-size: 11.5px; color: var(--text-muted, #a6b3ad); }

.gt-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.gt-card-actions .gt-btn-next,
.gt-card-actions .gt-btn-alt { flex: 1 1 auto; justify-content: center; padding: 10px 16px; font-size: 13px; }

.gt-card-foot { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* --- HUD fixa de progresso (visível enquanto o tutorial não termina) ------- */
.gt-hud {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    z-index: calc(var(--gt-z) - 1);
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(420px, calc(100vw - 24px));
    background: var(--surface-2, #1e1e1e);
    border: 1px solid var(--line, #2a2a2a);
    border-radius: 999px;
    padding: 6px 14px 6px 12px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    color: var(--text, #eaf2ed);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.gt-hud.gt-show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.gt-hud > i { color: var(--gt-accent); font-size: 13px; }
.gt-hud-text { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.gt-hud-text b { font-size: 12px; }
.gt-hud-text small { font-size: 10.5px; color: var(--text-muted, #a6b3ad); }
.gt-hud-bar { width: 70px; height: 4px; border-radius: 2px; background: var(--line, #2a2a2a); overflow: hidden; }
.gt-hud-bar span { display: block; height: 100%; background: var(--gt-accent); border-radius: 2px; transition: width .3s ease; }
.gt-hud-pct { font-size: 11.5px; font-weight: 700; color: var(--gt-accent); }

/* --- Mobile --------------------------------------------------------------- */
@media (max-width: 768px) {
    .gt-balloon { width: calc(100vw - 24px); }
    .gt-pill { width: calc(100vw - 24px); left: 12px; right: 12px; transform: translateY(8px); }
    .gt-pill.gt-show { transform: translateY(0); }
    /* abaixo do mobile_header.php (fixo) para não cobrir o título/voltar */
    .gt-hud { top: 66px; padding: 5px 12px 5px 10px; }
    .gt-hud-text small { display: none; }
    .gt-hud-bar { width: 54px; }
    .gt-card { padding: 18px 16px 14px; }
    .gt-card-title { font-size: 18px; }
}

/* --- Acessibilidade: respeita redução de movimento ------------------------ */
@media (prefers-reduced-motion: reduce) {
    .gt-ring::after,
    .gt-pointer,
    .gt-balloon-cta i { animation: none !important; }
    .gt-mask, .gt-ring, .gt-balloon, .gt-pill, .gt-pointer { transition: opacity 0.15s ease; }
}
