/* Main app */
const { useState: useStateApp, useEffect: useEffectApp } = React;

function StickyCTA() {
  const [show, setShow] = useStateApp(false);
  useEffectApp(() => {
    const onScroll = () => setShow(window.scrollY > 800);
    window.addEventListener("scroll", onScroll, { passive: true });
    return () => window.removeEventListener("scroll", onScroll);
  }, []);
  return (
    <div style={{
      position: "fixed",
      bottom: 20,
      left: "50%",
      transform: `translateX(-50%) translateY(${show ? "0" : "120%"})`,
      transition: "transform .4s cubic-bezier(.2,.8,.2,1)",
      zIndex: 50,
      width: "calc(100% - 32px)",
      maxWidth: 420,
      background: "var(--warm-white)",
      borderRadius: 999,
      boxShadow: "var(--shadow-lg)",
      border: "1px solid var(--line)",
      padding: 6,
      display: "flex",
      alignItems: "center",
      gap: 10
    }}>
      <div style={{ paddingLeft: 14, fontSize: 12, flex: 1, lineHeight: 1.2 }}>
        <div style={{ fontWeight: 700, color: "var(--ink)" }}>R$ 47,00</div>
        <div style={{ color: "var(--muted)", fontSize: 10.5 }}>de R$ 297 · economize 84%</div>
      </div>
      <a href="#oferta" className="btn-primary" style={{ padding: "12px 22px", fontSize: 13 }}>
        Quero agora
        <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><path d="M5 12h14M13 5l7 7-7 7"/></svg>
      </a>
    </div>
  );
}

function App() {
  const { UrgencyBar, Hero, Benefits, About, ContentProof, SocialProof, Authority, Offer, Guarantee, FAQ, FinalCTA, Footer } = window;
  return (
    <>
      <UrgencyBar />
      <Hero />
      <Benefits />
      <About />
      <ContentProof />
      <SocialProof />
      <Authority />
      <Offer />
      <Guarantee />
      <FAQ />
      <FinalCTA />
      <Footer />
      <StickyCTA />
    </>
  );
}

ReactDOM.createRoot(document.getElementById("root")).render(<App />);
