import { useEffect } from 'react';
import { motion, useScroll, useSpring } from 'framer-motion';
import Navbar from '../components/Navbar';
import Hero from '../components/Hero';
import BeforeAfter from '../components/BeforeAfter';
import VideoDemonstration from '../components/VideoDemonstration';
import Gallery from '../components/Gallery';
import HowItWorks from '../components/HowItWorks';
import Results from '../components/Results';
import Offer from '../components/Offer';
import FAQ from '../components/FAQ';
import Footer from '../components/Footer';
import StickyMobileCTA from '../components/StickyMobileCTA';
import { useUTMForwarder } from '../hooks/useUTMForwarder';

export default function LandingPage() {
  const { scrollYProgress } = useScroll();
  const scaleX = useSpring(scrollYProgress, {
    stiffness: 100,
    damping: 30,
    restDelta: 0.001
  });

  useUTMForwarder();

  useEffect(() => {
    if (typeof window !== 'undefined' && 'fbq' in window) {
      (window as any).fbq('track', 'ViewContent');
    }
  }, []);

  return (
    <div className="min-h-screen bg-pink-50 text-indigo-900 selection:bg-pink-300 selection:text-indigo-950 font-sans overflow-x-hidden">
      <motion.div
        className="fixed top-0 left-0 right-0 h-1.5 bg-gradient-to-r from-pink-400 via-violet-400 to-amber-400 origin-left z-50"
        style={{ scaleX }}
      />
      <Navbar />
      <main>
        <Hero />
        <BeforeAfter />
        <VideoDemonstration />
        <Gallery />
        <HowItWorks />
        <Results />
        <Offer />
        <FAQ />
      </main>
      <Footer />
      <StickyMobileCTA />
    </div>
  );
}
