const stepIndicator = document.getElementById('stepIndicator'); const bar = document.getElementById('bar'); const prevBtn = document.getElementById('prevBtn'); const nextBtn = document.getElementById('nextBtn'); const cta = document.getElementById('cta'); const proof = document.getElementById('proof'); let i = 0; function render(){ const s = steps[i]; stepIndicator.textContent = `Etapa ${i+1}/${steps.length} – ${s.phase}`; const p = Math.round(((i) / steps.length) * 100); bar.style.width = `${p}%`; stepEl.innerHTML = `
${s.q}
${s.opts.map((opt, idx) => ` `).join('')}
${i===6 ? `
Bônus inclusos: Planilha Administrativa 2.0, Estratégia para Redes, Venda muito com Instagram, Checklist de Atendimento, 28 Scripts de WhatsApp, Planilha de Cadastros.
`: ''} ${i===7 ? `
Objeções resolvidas: funciona em qualquer celular, 100% editável, sem Canva Pro, entrega imediata por e‑mail.
`: ''} `; prevBtn.disabled = i===0; nextBtn.disabled = answers[i]===null; nextBtn.textContent = i === steps.length-1 ? 'Finalizar' : 'Próximo'; cta.style.display='none'; } function finish(){ // barra completa bar.style.width = '100%'; stepIndicator.textContent = 'Concluído ✅'; // Revela CTA e prova social cta.style.display='block'; proof.style.display='block'; // Mensagem de reforço baseada nas respostas const wantsTestimonials = answers[9] && answers[9].toLowerCase().includes('depoimentos'); if(wantsTestimonials){ proof.scrollIntoView({behavior:'smooth'}); } else { cta.scrollIntoView({behavior:'smooth'}); } // Substitui conteúdo do passo por um resumo leve const top = (answers[4]||'').toString().toLowerCase(); const foco = top.includes('tempo') ? 'ganhar tempo' : top.includes('clientes') ? 'atrair clientes' : top.includes('profissional') ? 'parecer mais profissional' : 'melhorar as redes'; stepEl.innerHTML = `
Pronto! Seu foco agora é ${foco}. Bora colocar isso pra rodar hoje?
Dica: comece postando 3 artes por semana e use Stories diários com ofertas rápidas.
`; } stepEl.addEventListener('change', (e)=>{ if(e.target && e.target.name === `q${i}`){ answers[i] = e.target.value; nextBtn.disabled = false; } }); prevBtn.addEventListener('click', ()=>{ if(i>0){ i--; render(); } }); nextBtn.addEventListener('click', ()=>{ if(i < steps.length-1){ i++; render(); } else { finish(); } }); // CTA link – Substitua pela sua URL de checkout document.getElementById('ctaBtn').addEventListener('click', (e)=>{ // e.g., window.location.href = 'https://seu-checkout.com/pacote-de-imagens'; }); document.getElementById('year').textContent = new Date().getFullYear(); render();