import NavbarDropdown from "@/components/ui/NavbarDropdown";
import { ReactLenis } from "lenis/react";
import LightRaysCenterBackground from "@/components/ui/LightRaysCenterBackground";
import { StyleProvider } from "@/components/ui/StyleProvider";
import HeroBillboardFloatingCards from "@/components/sections/hero/HeroBillboardFloatingCards";
import FeaturesGridSplit from "@/components/sections/features/FeaturesGridSplit";
import FeaturesMediaCards from "@/components/sections/features/FeaturesMediaCards";
import MetricsFeatureCards from "@/components/sections/metrics/MetricsFeatureCards";
import PricingLayeredCards from "@/components/sections/pricing/PricingLayeredCards";
import TestimonialDetailedCards from "@/components/sections/testimonial/TestimonialDetailedCards";
import FaqTwoColumn from "@/components/sections/faq/FaqTwoColumn";
import BlogSimpleCards from "@/components/sections/blog/BlogSimpleCards";
import ContactCta from "@/components/sections/contact/ContactCta";
import FooterSimple from "@/components/sections/footer/FooterSimple";
import "./theme.css";

const AVATARS_SRC = [
  "https://storage.googleapis.com/webild/default/templates/ai-email-platform/avatar-1.webp",
  "https://storage.googleapis.com/webild/default/templates/ai-email-platform/avatar-2.webp",
  "https://storage.googleapis.com/webild/default/templates/ai-email-platform/avatar-3.webp",
  "https://storage.googleapis.com/webild/default/templates/ai-email-platform/avatar-4.webp",
];

const BRAND_LOGOS = [
  "https://storage.googleapis.com/webild/default/templates/ai-email-platform/brand-1.webp",
  "https://storage.googleapis.com/webild/default/templates/ai-email-platform/brand-2.webp",
  "https://storage.googleapis.com/webild/default/templates/ai-email-platform/brand-3.webp",
  "https://storage.googleapis.com/webild/default/templates/ai-email-platform/brand-4.webp",
];

export default function AiEmailPlatformTemplate() {
  return (
    <ReactLenis root>
      <StyleProvider buttonVariant="expand">
        <div className="fixed inset-0 -z-10 opacity-25 pointer-events-none">
          <LightRaysCenterBackground position="absolute" />
        </div>

        <NavbarDropdown
          logo="Flashly"
          navItems={[
            { name: "Features", href: "#features" },
            { name: "Pricing", href: "#pricing" },
            { name: "Integrations", href: "#integrations" },
            { name: "FAQ", href: "#faq" },
          ]}
          ctaButton={{ text: "Start Free Trial", href: "#" }}
        />

        <div id="hero" data-section="hero">
          <HeroBillboardFloatingCards
            avatarsSrc={AVATARS_SRC}
            avatarsLabel="Trusted by 10k+ users"
            title="AI-Powered Email Campaigns That Actually Convert"
            description="Create, personalize, and optimize email campaigns at scale. Powered by advanced AI that learns what your audience wants."
            primaryButton={{ text: "Start Free Trial", href: "#" }}
            secondaryButton={{ text: "Watch Demo", href: "#" }}
            note="No credit card required"
            floatingCardsSrc={[
              "https://storage.googleapis.com/webild/default/templates/ai-email-platform/brand-1.webp",
              "https://storage.googleapis.com/webild/default/templates/ai-email-platform/brand-2.webp",
              "https://storage.googleapis.com/webild/default/templates/ai-email-platform/brand-3.webp",
              "https://storage.googleapis.com/webild/default/templates/ai-email-platform/brand-4.webp",
            ]}
            imageSrc="https://storage.googleapis.com/webild/default/templates/ai-email-platform/dashboard.webp"
            logosSrc={BRAND_LOGOS}
          />
        </div>

        <div id="features" data-section="features">
          <FeaturesGridSplit
            tag="Features"
            title="Everything You Need to Scale"
            description="From team workflows to real-time analytics, Flashly gives you the tools to grow faster."
            topItems={[
              { title: "Unify and Analyze All Your Data", description: "Connect internal docs, third-party tools, and real-time inputs into a single intelligent interface. Let AI surface insights that drive smarter, more confident business decisions.", imageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/feature-collaborate.webp" },
              { title: "Automate High-Frequency Workflows", description: "AI Supply agents break down complex tasks into clear, traceable steps. Eliminate repetitive work and scale your team's output with unmatched efficiency and precision.", imageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/feature-track.webp" },
            ]}
            bottomItem={{
              title: "Accelerate Execution with Reliable Autonomy",
              description: "Our agents don't just assist — they complete tasks end-to-end with accountability and speed. Track progress, refine outputs, and get results faster.",
              imageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/feature-optimize.webp",
              primaryButton: { text: "View use cases", href: "#" },
              avatarsSrc: AVATARS_SRC,
              avatarsLabel: "Trusted by 300+ clients",
            }}
          />
        </div>

        <div id="metrics" data-section="metrics">
          <MetricsFeatureCards
            tag="By the Numbers"
            title="Results That Speak for Themselves"
            description="Flashly helps teams send smarter campaigns and see real impact."
            metrics={[
              {
                value: "98%",
                title: "Deliverability Rate",
                features: ["Advanced domain authentication", "Real-time bounce monitoring", "Automatic list hygiene"],
              },
              {
                value: "3.2x",
                title: "Higher Open Rates",
                features: ["AI-optimized subject lines", "Smart send-time prediction", "Personalized preview text"],
              },
              {
                value: "45%",
                title: "More Conversions",
                features: ["Dynamic content blocks", "Behavioral targeting", "Automated A/B testing"],
              },
            ]}
          />
        </div>

        <FeaturesMediaCards
          tag="How It Works"
          title="Built for Modern Teams"
          description="Powerful tools that help you work smarter, move faster, and deliver results."
          items={[
            {
              title: "Domains",
              description: "Get verified domains set up in minutes. Ensure maximum deliverability with proper authentication and DNS configuration.",
              imageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/how-it-works-domains.webp",
            },
            {
              title: "Emails",
              description: "Create and send beautiful, personalized email campaigns at scale with AI-powered content and smart scheduling.",
              imageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/how-it-works-emails.webp",
            },
            {
              title: "Notifications",
              description: "Track customer replies and engagement in real time. Never miss a response with instant notification alerts.",
              imageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/how-it-works-notifications.webp",
            },
          ]}
        />

        <div id="pricing" data-section="pricing">
          <PricingLayeredCards
            tag="Pricing"
            title="Simple, Transparent Pricing"
            description="Start free. Scale when you're ready. No hidden fees."
            plans={[
              { tag: "Starter", price: "$0/mo", description: "For individuals just getting started with email marketing.", primaryButton: { text: "Get Started Free", href: "#" }, features: ["1,000 emails per month", "Basic templates", "Email support", "Analytics dashboard"] },
              { tag: "Pro", price: "$29/mo", description: "For growing teams that need more power and flexibility.", primaryButton: { text: "Start Free Trial", href: "#" }, features: ["50,000 emails per month", "AI subject line optimizer", "Advanced segmentation", "A/B testing", "Priority support", "Custom templates"] },
              { tag: "Enterprise", price: "$99/mo", description: "For large organizations with advanced needs.", primaryButton: { text: "Contact Sales", href: "#" }, features: ["Unlimited emails", "Dedicated IP address", "Custom integrations", "SSO & team management", "Dedicated account manager", "SLA guarantee", "Advanced API access"] },
            ]}
          />
        </div>

        <div id="testimonials" data-section="testimonials">
          <TestimonialDetailedCards
            tag="Testimonials"
            title="Loved by Marketing Teams"
            description="See what our customers have to say about Flashly."
            testimonials={[
              {
                title: "Game-changer for our email strategy",
                quote: "We switched to Flashly six months ago and our open rates have nearly tripled. The AI suggestions are incredibly accurate and save us hours every week.",
                name: "Sarah Chen",
                role: "Head of Marketing, Lumino",
                imageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/testimonial-1.webp",
              },
              {
                title: "Best ROI on any tool we use",
                quote: "The automation workflows alone paid for the subscription in the first month. Our team can now focus on strategy instead of manual sends.",
                name: "Marcus Rivera",
                role: "Growth Lead, NovaBrand",
                imageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/testimonial-2.webp",
              },
              {
                title: "Finally, email that just works",
                quote: "Setup took 15 minutes. Within a week we had our first automated campaign running. The deliverability is the best we've ever seen.",
                name: "Erik Lindqvist",
                role: "Founder, Canopy",
                imageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/testimonial-3.webp",
              },
              {
                title: "Incredible support and product",
                quote: "Every time we've had a question, the team responds within minutes. The product keeps getting better with every update. Truly world-class.",
                name: "James Park",
                role: "CTO, AdScale",
                imageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/testimonial-1.webp",
              },
            ]}
          />
        </div>

        <div id="faq" data-section="faq">
          <FaqTwoColumn
            tag="FAQ"
            title="Frequently Asked Questions"
            description="Everything you need to know about Flashly."
            items={[
              { question: "What is Flashly?", answer: "Flashly is an AI-powered email marketing platform that helps you create, send, and optimize email campaigns at scale. From smart subject lines to automated workflows, we handle the heavy lifting so you can focus on growing your business." },
              { question: "Do I need technical skills to use it?", answer: "Not at all. Flashly is designed for marketers, not engineers. Our drag-and-drop editor and pre-built templates make it easy to create beautiful emails in minutes." },
              { question: "How does the AI optimization work?", answer: "Our AI analyzes your audience behavior, past campaign performance, and industry benchmarks to suggest the best subject lines, send times, and content variations for maximum engagement." },
              { question: "Can I import my existing contacts?", answer: "Yes. You can import contacts from CSV files, or connect directly with your CRM, Shopify store, or other platforms through our native integrations." },
              { question: "Is there a free plan?", answer: "Absolutely. Our Starter plan is completely free and includes up to 1,000 emails per month, basic templates, and access to our analytics dashboard. No credit card required." },
              { question: "What integrations do you support?", answer: "We integrate with Shopify, Stripe, Zapier, Salesforce, HubSpot, Slack, and dozens more. You can also use our API to build custom integrations." },
              { question: "How is deliverability handled?", answer: "We maintain a 98% deliverability rate through advanced domain authentication, automatic list hygiene, real-time bounce monitoring, and dedicated IP options on higher plans." },
              { question: "Can I cancel anytime?", answer: "Yes. All plans are month-to-month with no long-term contracts. You can upgrade, downgrade, or cancel at any time from your account settings." },
            ]}
          />
        </div>

        <div id="blog" data-section="blog">
          <BlogSimpleCards
            tag="Blog"
            title="Latest from the Blog"
            description="Tips, strategies, and insights to level up your email marketing."
            items={[
              {
                category: "Strategy",
                title: "How to Write Subject Lines That Get Opened",
                excerpt: "Learn the psychology behind high-performing subject lines and how AI can help you craft the perfect hook every time.",
                authorName: "Sarah Chen",
                authorImageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/testimonial-1.webp",
                date: "May 8, 2026",
                imageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/blog-subject-lines.webp",
              },
              {
                category: "Tutorial",
                title: "Setting Up Your First Automated Workflow",
                excerpt: "A step-by-step guide to creating welcome sequences, abandoned cart emails, and re-engagement campaigns.",
                authorName: "Marcus Rivera",
                authorImageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/testimonial-2.webp",
                date: "May 5, 2026",
                imageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/blog-automated-workflow.webp",
              },
              {
                category: "Insights",
                title: "Email Marketing Benchmarks for 2026",
                excerpt: "We analyzed over 10 million campaigns to bring you the latest open rate, click rate, and conversion benchmarks by industry.",
                authorName: "Priya Sharma",
                authorImageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/testimonial-3.webp",
                date: "May 1, 2026",
                imageSrc: "https://storage.googleapis.com/webild/default/templates/ai-email-platform/blog-benchmarks.webp",
              },
            ]}
          />
        </div>

        <div id="contact" data-section="contact">
          <ContactCta
            tag="Get Started"
            text="Ready to transform your email marketing? Start your free trial today and see results in minutes."
            primaryButton={{ text: "Start Free Trial", href: "#" }}
            secondaryButton={{ text: "Talk to Sales", href: "#" }}
          />
        </div>

        <FooterSimple
          brand="Flashly"
          columns={[
            {
              title: "Product",
              items: [
                { label: "Features", href: "#features" },
                { label: "Pricing", href: "#pricing" },
                { label: "Integrations", href: "#integrations" },
                { label: "Changelog", href: "#" },
              ],
            },
            {
              title: "Resources",
              items: [
                { label: "Blog", href: "#blog" },
                { label: "Documentation", href: "#" },
                { label: "API Reference", href: "#" },
                { label: "Help Center", href: "#" },
              ],
            },
            {
              title: "Company",
              items: [
                { label: "About", href: "#" },
                { label: "Careers", href: "#" },
                { label: "Contact", href: "#contact" },
              ],
            },
          ]}
          copyright="© 2026 Flashly. All rights reserved."
          links={[
            { label: "Privacy Policy", href: "#" },
            { label: "Terms of Service", href: "#" },
          ]}
        />
      </StyleProvider>
    </ReactLenis>
  );
}
