"use client";

import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingInline from "@/components/navbar/NavbarLayoutFloatingInline";
import HeroLogo from "@/components/sections/hero/HeroLogo";
import FeatureCardMedia from "@/components/sections/feature/FeatureCardMedia";
import PricingCardOne from "@/components/sections/pricing/PricingCardOne";
import MetricCardOne from "@/components/sections/metrics/MetricCardOne";
import TestimonialCardFive from "@/components/sections/testimonial/TestimonialCardFive";
import FaqDouble from "@/components/sections/faq/FaqDouble";
import ContactFaq from "@/components/sections/contact/ContactFaq";
import FooterLogoEmphasis from "@/components/sections/footer/FooterLogoEmphasis";
import Link from "next/link";
import {
  Zap,
  Sparkles,
  Crown,
  Users,
  Trophy,
  Award,
} from "lucide-react";

export default function HomePage() {
  const navItems = [
    { name: "Home", id: "home" },
    { name: "How It Works", id: "how-it-works" },
    { name: "Leagues", id: "leagues" },
    { name: "Stats", id: "stats" },
  ];

  const footerColumns = [
    {
      items: [
        { label: "Home", href: "/" },
        { label: "How It Works", href: "/how-it-works" },
        { label: "Pricing", href: "/pricing" },
        { label: "Leagues", href: "/leagues" },
      ],
    },
    {
      items: [
        { label: "About Us", href: "#" },
        { label: "Blog", href: "#" },
        { label: "Community", href: "#" },
        { label: "Careers", href: "#" },
      ],
    },
    {
      items: [
        { label: "Contact", href: "#" },
        { label: "Support", href: "#" },
        { label: "Privacy Policy", href: "#" },
        { label: "Terms of Service", href: "#" },
      ],
    },
    {
      items: [
        { label: "Twitter", href: "https://twitter.com" },
        { label: "Facebook", href: "https://facebook.com" },
        { label: "Instagram", href: "https://instagram.com" },
        { label: "Discord", href: "https://discord.com" },
      ],
    },
  ];

  return (
    <ThemeProvider
      defaultButtonVariant="directional-hover"
      defaultTextAnimation="entrance-slide"
      borderRadius="pill"
      contentWidth="compact"
      sizing="largeSmallSizeLargeTitles"
      background="aurora"
      cardStyle="inset"
      primaryButtonStyle="double-inset"
      secondaryButtonStyle="radial-glow"
      headingFontWeight="light"
    >
      <div id="nav" data-section="nav">
        <NavbarLayoutFloatingInline
          brandName="FantasyRugby"
          navItems={navItems}
          button={{
            text: "Start Your Squad",
            href: "#cta",
          }}
        />
      </div>

      <div id="hero" data-section="hero">
        <HeroLogo
          logoText="Build Your Championship Team Compete Win"
          description="Draft elite rugby players from Championship and Premiership, manage transfers within budget, and climb the leaderboard in realtime. Compete solo or create private leagues with friends and rivals."
          buttons={[
            {
              text: "Start Your Squad Now",
              href: "#cta",
            },
            {
              text: "Explore Leagues",
              href: "/how-it-works",
            },
          ]}
          buttonAnimation="slide-up"
          imageSrc="http://img.b2bpic.net/free-photo/american-football-player-wearing-equipment_23-2151117495.jpg"
          imageAlt="Rugby stadium with live match data overlay"
          showDimOverlay={true}
          ariaLabel="Fantasy rugby hero section"
        />
      </div>

      <div id="features" data-section="features">
        <FeatureCardMedia
          title="Master Your Fantasy Rugby Strategy"
          description="Everything you need to dominate the leaderboard with powerful tools designed for casual fans and competitive strategists alike."
          tag="Platform Capabilities"
          tagAnimation="blur-reveal"
          features={[
            {
              id: "draft",
              title: "Smart Squad Drafting",
              description: "Build your 15-player squad within salary cap constraints. Real-time player availability, price indicators, and position balance guidance make squad construction intuitive and strategic.",
              tag: "Core Mechanic",
              imageSrc: "http://img.b2bpic.net/free-photo/closeup-woman-uses-smartphone-while-sitting-stadium-stands_169016-48649.jpg",
              imageAlt: "Draft interface showing player selection and budget management",
              buttons: [],
            },
            {
              id: "transfers",
              title: "Dynamic Transfer Market",
              description: "Manage transfers each matchweek with intelligent budget allocation. Swap underperforming players for hot-form rookies, or hold steady with your core squad. Real-time price tracking keeps you ahead of market trends.",
              tag: "Ongoing Management",
              imageSrc: "http://img.b2bpic.net/free-photo/woman-working-with-finance-diagrams-table-laptop-papers_1268-17477.jpg",
              imageAlt: "Transfer market interface with player swap options",
              buttons: [],
            },
            {
              id: "live-scoring",
              title: "Live Match Scoring",
              description: "Watch your squad earn points in real-time as matches unfold. Instant notifications for key events—tries, tackles, penalties—keep the action flowing. WebSocket-powered updates mean zero delays.",
              tag: "Real-Time Engagement",
              imageSrc: "http://img.b2bpic.net/free-vector/flat-fitness-mobile-app-infographic_23-2148203348.jpg",
              imageAlt: "Live scoring dashboard with real-time point tracking",
              buttons: [],
            },
            {
              id: "analytics",
              title: "Advanced Player Analytics",
              description: "Unlock detailed form tracking, position-specific stats, and historical performance data. Compare players across seasons, identify breakout stars, and make data-driven squad decisions with confidence.",
              tag: "Competitive Edge",
              imageSrc: "http://img.b2bpic.net/free-photo/african-american-staff-gathers-examines-monthly-revenue-balance_482257-130896.jpg",
              imageAlt: "Player analytics dashboard with performance metrics",
              buttons: [],
            },
            {
              id: "leagues",
              title: "Public & Private Leagues",
              description: "Compete in open global leagues or create branded private leagues for your club, group, or office. Weekly leaderboards, monthly achievements, and custom scoring rules keep competition fresh and engaging.",
              tag: "Community Features",
              imageSrc: "http://img.b2bpic.net/free-photo/joyful-close-friends-joking-arguing_1262-21176.jpg",
              imageAlt: "League management interface with leaderboard and rankings",
              buttons: [],
            },
          ]}
          animationType="slide-up"
          textboxLayout="default"
          useInvertedBackground={false}
          carouselMode="buttons"
          ariaLabel="Core fantasy rugby features"
        />
      </div>

      <div id="pricing" data-section="pricing">
        <PricingCardOne
          title="Choose Your Play Level"
          description="Whether you're a casual rugby fan or a competitive strategist, we have a plan that matches your ambitions and budget."
          tag="Transparent Pricing"
          tagAnimation="opacity"
          plans={[
            {
              id: "free",
              badge: "Free",
              badgeIcon: Zap,
              price: "£0",
              subtitle: "Perfect for casual fans",
              features: [
                "1 public league entry",
                "Basic squad drafting tools",
                "Live match scoring",
                "Weekly leaderboards",
                "Community access",
              ],
            },
            {
              id: "pro",
              badge: "Most Popular",
              badgeIcon: Sparkles,
              price: "£4.99/month",
              subtitle: "For serious competitors",
              features: [
                "Unlimited public leagues",
                "5 private league entries",
                "Advanced player analytics",
                "Transfer recommendations",
                "Historical form data",
                "Priority match notifications",
                "Export squad & stats",
              ],
            },
            {
              id: "elite",
              badge: "Premium",
              badgeIcon: Crown,
              price: "£9.99/month",
              subtitle: "Competitive edge included",
              features: [
                "Everything in Pro",
                "Unlimited private leagues",
                "AI-powered squad optimization",
                "Real-time market alerts",
                "Advanced forecasting tools",
                "Custom league branding",
                "API access for integrations",
                "24/7 priority support",
              ],
            },
          ]}
          animationType="scale-rotate"
          textboxLayout="default"
          useInvertedBackground={true}
          carouselMode="buttons"
          buttons={[
            {
              text: "View All Plans",
              href: "/pricing",
            },
          ]}
          buttonAnimation="slide-up"
          ariaLabel="Fantasy rugby pricing plans"
        />
      </div>

      <div id="metrics" data-section="metrics">
        <MetricCardOne
          title="Trusted by Rugby's Fantasy Community"
          description="Join thousands of players who've made FantasyRugby their hub for Championship and Premiership competition."
          tag="By The Numbers"
          tagAnimation="blur-reveal"
          metrics={[
            {
              id: "users",
              value: "45K+",
              title: "Active Players",
              description: "Growing community of fantasy rugby enthusiasts",
              icon: Users,
            },
            {
              id: "leagues",
              value: "8,200+",
              title: "Active Leagues",
              description: "Public and private competitions running weekly",
              icon: Trophy,
            },
            {
              id: "matches",
              value: "1.2M+",
              title: "Live Updates",
              description: "Real-time scoring events processed daily",
              icon: Zap,
            },
            {
              id: "badges",
              value: "180K+",
              title: "Achievements Earned",
              description: "Milestones unlocked by our competitive community",
              icon: Award,
            },
          ]}
          animationType="slide-up"
          gridVariant="uniform-all-items-equal"
          textboxLayout="default"
          useInvertedBackground={false}
          ariaLabel="Fantasy rugby platform metrics"
        />
      </div>

      <div id="testimonials" data-section="testimonials">
        <TestimonialCardFive
          title="Loved by Competitive Players & League Organizers"
          description="Hear from the rugby community who've transformed their fantasy experience with FantasyRugby."
          tag="Player Stories"
          tagAnimation="opacity"
          testimonials={[
            {
              id: "1",
              name: "James Mitchell",
              date: "2 weeks ago",
              title: "Championship Enthusiast",
              quote: "The live scoring is addictive. Watching my squad rack up points in real-time during matches has completely changed how I engage with rugby. Plus, the analytics tools help me make smarter transfer decisions every week.",
              tag: "Casual Competitor",
              avatarSrc: "http://img.b2bpic.net/free-photo/black-white-portrait-athlete-competing-paralympics-championship-games_23-2151492688.jpg",
              avatarAlt: "James Mitchell profile",
            },
            {
              id: "2",
              name: "Sarah Johnson",
              date: "3 weeks ago",
              title: "League Manager",
              quote: "Our office league has been running for 8 weeks now. The platform makes managing 20 people effortless. Leaderboards update automatically, achievements keep everyone engaged, and the mobile experience is seamless.",
              tag: "League Organizer",
              avatarSrc: "http://img.b2bpic.net/free-photo/confident-young-pretty-sporty-girl-wearing-headband-wristbands-keeping-hands-waist_141793-117644.jpg",
              avatarAlt: "Sarah Johnson profile",
            },
            {
              id: "3",
              name: "Tom Clarke",
              date: "1 month ago",
              title: "Premiership Fan",
              quote: "The transfer recommendations and form tracking are game-changers. I went from mid-table to finishing 2nd in my league using the advanced analytics. Absolutely worth the Pro subscription.",
              tag: "Analytics Advocate",
              avatarSrc: "http://img.b2bpic.net/free-photo/portrait-man-holding-rugby-ball_53876-20496.jpg",
              avatarAlt: "Tom Clarke profile",
            },
            {
              id: "4",
              name: "Emma Rodriguez",
              date: "6 weeks ago",
              title: "Community Builder",
              quote: "Created 3 private leagues for different friend groups. The customization options and clear UI make it dead simple. Everyone's hooked, and the live updates keep the engagement high throughout match day.",
              tag: "Social Advocate",
              avatarSrc: "http://img.b2bpic.net/free-photo/american-football-player-neon-style_23-2151827437.jpg",
              avatarAlt: "Emma Rodriguez profile",
            },
            {
              id: "5",
              name: "Marcus Thompson",
              date: "2 months ago",
              title: "Competitive Player",
              quote: "Finally, a fantasy rugby platform that takes strategy seriously. The salary cap mechanics are tight, the market moves feel real, and the competition level is actually challenging. I'm in 4 leagues now.",
              tag: "Competitive Tier",
              avatarSrc: "http://img.b2bpic.net/free-photo/close-up-smiley-man-posing_23-2148747394.jpg",
              avatarAlt: "Marcus Thompson profile",
            },
            {
              id: "6",
              name: "Lucy Bennett",
              date: "3 months ago",
              title: "Casual Player",
              quote: "I'm not a data person, but the interface is so intuitive I picked it up immediately. My first squad is competitive, and I'm actually enjoying the weekly management aspect. Highly recommend for newcomers.",
              tag: "Accessibility",
              avatarSrc: "http://img.b2bpic.net/free-photo/front-view-woman-outdoors-portrait_23-2150828878.jpg",
              avatarAlt: "Lucy Bennett profile",
            },
          ]}
          animationType="opacity"
          textboxLayout="default"
          useInvertedBackground={true}
          ariaLabel="Fantasy rugby player testimonials"
        />
      </div>

      <div id="faq" data-section="faq">
        <FaqDouble
          title="Frequently Asked Questions"
          description="Everything you need to know about building squads, managing transfers, live scoring, and competing in leagues."
          tag="Support"
          tagAnimation="slide-up"
          faqs={[
            {
              id: "1",
              title: "What's the salary cap and how does it work?",
              content: "Each season, you have a total budget (typically £50M) to draft your 15-player squad. Players are priced based on form, position scarcity, and historical performance. Your squad's total salary must not exceed the cap. You manage wages week-to-week via transfers, and prices fluctuate based on market demand and player performance.",
            },
            {
              id: "2",
              title: "How are points calculated during live matches?",
              content: "Points are awarded in real-time as events occur: Tries = 5 pts, Conversions = 2 pts, Penalties = 1 pt, Tackles = 0.5 pts, Assists = 1 pt, Turnovers Won = 0.5 pts, Clean Sheets (defenders) = 1 pt. Bonus points are awarded for man-of-the-match and high performance thresholds. Full scoring rules are available in your league settings.",
            },
            {
              id: "3",
              title: "Can I create a private league with my friends?",
              content: "Absolutely! Both Free and Pro users can create private leagues. Free users get 1 private league slot, Pro users get 5, and Elite users get unlimited. You can set custom league names, scoring rules, entry fees (optional), and manage members directly. Invite links make it easy to add friends.",
            },
            {
              id: "4",
              title: "When can I make transfers and are there limits?",
              content: "Transfers are open each matchweek until the first game kicks off. Free users can make unlimited transfers with no penalty. Pro and Elite users get early transfer windows (24 hours before the free tier) and advanced recommendations. You can swap out entire squads or make surgical changes—it's your choice.",
            },
            {
              id: "5",
              title: "What leagues are included—Championship or Premiership only?",
              content: "We support both Championship and Premiership squads. You can draft players from either or mix both in your squad (within salary cap). Matches from both leagues score simultaneously, and you can create single-league or multi-league competitions depending on your preference.",
            },
            {
              id: "6",
              title: "Is there a mobile app or just web?",
              content: "Currently, FantasyRugby is web-first with full mobile responsiveness. You can manage your squad, check live scores, and trade on your phone via any browser. A native iOS and Android app is on our roadmap for Q2 2024. All features work identically on mobile.",
            },
            {
              id: "7",
              title: "How do rankings and leaderboards work?",
              content: "Leaderboards update in real-time during match days and refresh fully after each matchweek. Rankings are based on total squad points. In private leagues, you can toggle between overall season rank, weekly rank, and custom filters (e.g., by position, transfer activity). Ties are broken by head-to-head record.",
            },
            {
              id: "8",
              title: "What's included in the Elite plan?",
              content: "Elite ($9.99/month) includes unlimited private leagues, AI-powered squad optimization, real-time market alerts, advanced forecasting tools, custom league branding, API access for integrations, and 24/7 priority support. It's designed for league organizers and competitive players who want maximum flexibility and tools.",
            },
          ]}
          faqsAnimation="blur-reveal"
          animationType="slide-up"
          textboxLayout="default"
          useInvertedBackground={false}
          ariaLabel="Frequently asked questions about fantasy rugby"
        />
      </div>

      <div id="contact" data-section="contact">
        <ContactFaq
          ctaTitle="Ready to Build Your Squad?"
          ctaDescription="Join thousands of players competing in real-time. Start your fantasy rugby journey today—whether you're a casual fan or a competitive strategist, there's a place for you."
          ctaButton={{
            text: "Start Your Squad Now",
            href: "#cta",
          }}
          ctaIcon={Zap}
          faqs={[
            {
              id: "faq-contact-1",
              title: "How do I reset my password?",
              content: "Click 'Forgot Password' on the login page, enter your email, and we'll send a reset link within 2 minutes. If you don't see it, check your spam folder or contact support.",
            },
            {
              id: "faq-contact-2",
              title: "Can I cancel my Pro subscription anytime?",
              content: "Yes, absolutely. Cancel anytime from your account settings—no cancellation fees or long-term commitments. Your access continues until the end of your current billing cycle.",
            },
            {
              id: "faq-contact-3",
              title: "How often are player prices updated?",
              content: "Player prices update weekly after each matchweek concludes (typically Monday morning). Prices reflect performance, injury news, and transfer market demand. Price changes are notified in real-time.",
            },
            {
              id: "faq-contact-4",
              title: "What happens if a player gets injured?",
              content: "Injured players are flagged immediately in the app and on leaderboards. You can swap them out during the open transfer window without penalty. If a player misses a match, they score no points that week.",
            },
          ]}
          animationType="slide-up"
          showCard={true}
          ariaLabel="Contact and support FAQ section"
        />
      </div>

      <div id="footer" data-section="footer">
        <FooterLogoEmphasis
          logoText="FantasyRugby"
          columns={footerColumns}
          ariaLabel="Site footer"
        />
      </div>
    </ThemeProvider>
  );
}