import Link from "next/link"
import { Sparkles, BarChart3, Search, Share2, ArrowRight, CheckCircle2 } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"

const exampleComparisons = [
  {
    title: "React vs Vue vs Svelte",
    description: "Frontend framework comparison for modern web development",
    tags: ["Tech", "JavaScript"],
    items: ["React", "Vue", "Svelte"],
    scores: [8.5, 7.8, 8.2],
  },
  {
    title: "GPT-4 vs Claude vs Gemini",
    description: "Comparing top AI language models for reasoning tasks",
    tags: ["AI", "Products"],
    items: ["GPT-4", "Claude 3", "Gemini Pro"],
    scores: [8.8, 9.0, 8.4],
  },
  {
    title: "Notion vs Obsidian vs Roam",
    description: "Knowledge management tools for productivity",
    tags: ["Products", "Productivity"],
    items: ["Notion", "Obsidian", "Roam Research"],
    scores: [7.5, 8.3, 7.2],
  },
  {
    title: "AWS vs GCP vs Azure",
    description: "Cloud platform comparison for enterprise infrastructure",
    tags: ["Tech", "Cloud"],
    items: ["AWS", "Google Cloud", "Microsoft Azure"],
    scores: [9.0, 8.2, 8.5],
  },
]

const features = [
  {
    icon: BarChart3,
    title: "Rich Visualizations",
    description: "Interactive radar charts, bar graphs, and comparison tables to understand your results at a glance.",
  },
  {
    icon: Search,
    title: "Deep Research",
    description: "AI-powered research that gathers comprehensive data from multiple sources for each item.",
  },
  {
    icon: Share2,
    title: "Save & Share",
    description: "Keep your comparisons private or share them with the world. Build a library of research.",
  },
]

export default function HomePage() {
  return (
    <div className="flex flex-col min-h-screen">
      <section className="flex-1 flex flex-col items-center justify-center py-20 px-4 bg-gradient-to-b from-background to-muted/30">
        <div className="max-w-3xl mx-auto text-center space-y-8">
          <div className="inline-flex items-center gap-2 px-4 py-2 rounded-full bg-primary/10 text-primary text-sm font-medium mb-4">
            <Sparkles className="size-4" />
            AI-Powered Research
          </div>

          <h1 className="text-4xl sm:text-5xl lg:text-6xl font-bold tracking-tight leading-tight">
            Compare Anything with{" "}
            <span className="text-primary">AI-Powered</span> Deep Research
          </h1>

          <p className="text-lg sm:text-xl text-muted-foreground max-w-2xl mx-auto">
            Stop spending hours researching. Let AI do the work for you with comprehensive,
            multi-dimensional comparisons on anything you can think of.
          </p>

          <div className="flex flex-col sm:flex-row gap-4 justify-center pt-4">
            <Link href="/compare">
              <Button size="lg" className="gap-2 text-lg px-8">
                <Sparkles className="size-5" />
                Start Comparing
                <ArrowRight className="size-4" />
              </Button>
            </Link>
            <Link href="/explore">
              <Button size="lg" variant="outline" className="text-lg px-8">
                Explore Examples
              </Button>
            </Link>
          </div>
        </div>
      </section>

      <section className="py-16 px-4 bg-muted/20">
        <div className="max-w-5xl mx-auto">
          <h2 className="text-2xl font-bold text-center mb-10">Example Comparisons</h2>

          <div className="grid gap-6 sm:grid-cols-2 lg:grid-cols-4">
            {exampleComparisons.map((example) => (
              <Link key={example.title} href="/compare" className="group">
                <Card className="h-full transition-all group-hover:border-primary group-hover:shadow-md">
                  <CardHeader className="pb-3">
                    <div className="flex items-center gap-2 mb-2">
                      <span className="text-lg font-bold">{example.title}</span>
                    </div>
                    <CardDescription className="text-sm line-clamp-2">
                      {example.description}
                    </CardDescription>
                  </CardHeader>
                  <CardContent className="space-y-3">
                    <div className="flex flex-wrap gap-1.5">
                      {example.tags.map((tag) => (
                        <span
                          key={tag}
                          className="px-2 py-0.5 rounded-full bg-muted text-xs font-medium"
                        >
                          {tag}
                        </span>
                      ))}
                    </div>
                    <div className="flex items-center justify-between text-sm">
                      <span className="text-muted-foreground">
                        {example.items.slice(0, 2).join(" vs ")}
                        {example.items.length > 2 && ` vs ${example.items.length - 2}+`}
                      </span>
                    </div>
                    <div className="flex items-center gap-1">
                      {example.scores.slice(0, 3).map((score, i) => (
                        <div
                          key={i}
                          className="h-1 flex-1 rounded-full bg-primary/30"
                          style={{ width: `${score * 10}%` }}
                        />
                      ))}
                    </div>
                  </CardContent>
                </Card>
              </Link>
            ))}
          </div>
        </div>
      </section>

      <section className="py-20 px-4">
        <div className="max-w-4xl mx-auto">
          <h2 className="text-2xl font-bold text-center mb-12">Why ComparAIson?</h2>

          <div className="grid gap-8 sm:grid-cols-3">
            {features.map((feature) => (
              <div key={feature.title} className="flex flex-col items-center text-center space-y-3">
                <div className="size-12 rounded-xl bg-primary/10 flex items-center justify-center">
                  <feature.icon className="size-6 text-primary" />
                </div>
                <h3 className="font-semibold text-lg">{feature.title}</h3>
                <p className="text-muted-foreground text-sm">{feature.description}</p>
              </div>
            ))}
          </div>
        </div>
      </section>

      <section className="py-16 px-4 bg-primary text-primary-foreground">
        <div className="max-w-2xl mx-auto text-center space-y-6">
          <h2 className="text-2xl sm:text-3xl font-bold">Ready to compare?</h2>
          <p className="text-primary-foreground/80">
            Start your first comparison in seconds. It&apos;s free to get started.
          </p>
          <Link href="/compare">
            <Button size="lg" variant="secondary" className="gap-2 text-lg px-8">
              <Sparkles className="size-5" />
              Start Comparing
            </Button>
          </Link>
        </div>
      </section>

      <footer className="border-t py-8 px-4">
        <div className="max-w-4xl mx-auto flex flex-col sm:flex-row items-center justify-between gap-4 text-sm text-muted-foreground">
          <div className="flex items-center gap-2">
            <Sparkles className="size-4 text-primary" />
            <span className="font-semibold">ComparAIson</span>
          </div>
          <p>AI-powered deep research comparisons</p>
        </div>
      </footer>
    </div>
  )
}