import { 
  UserPlus, 
  Link2, 
  Sparkles, 
  PartyPopper,
  ArrowDown 
} from 'lucide-react'
import SpotlightCard from '@/components/ui/SpotlightCard'

const steps = [
  {
    icon: UserPlus,
    step: "01",
    title: "Create account",
    description: "Sign up for free in less than 60 seconds. No credit card required.",
  },
  {
    icon: Link2,
    step: "02",
    title: "Connect email",
    description: "Sign in with Google or Microsoft. We never see your password.",
  },
  {
    icon: Sparkles,
    step: "03",
    title: "We categorize",
    description: "We read sender and subject, put each email in a category. No rules to write.",
  },
  {
    icon: PartyPopper,
    step: "04",
    title: "Inbox stays clean",
    description: "Newsletters and promos go to folders. Your inbox shows what matters first.",
  },
]

export function HowItWorks() {
  return (
    <section id="how-it-works" className="py-24 bg-white dark:bg-slate-900">
      <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        {/* Section header */}
        <div className="text-center mb-16">
          <h2 className="text-3xl sm:text-4xl font-bold text-slate-900 dark:text-slate-100 mb-4">
            4 steps to a{' '}
            <span className="text-transparent bg-clip-text bg-gradient-to-r from-primary-600 to-accent-500">
              clean inbox
            </span>
          </h2>
          <p className="text-lg text-slate-600 dark:text-slate-400 max-w-2xl mx-auto">
            Get started in minutes – no technical knowledge required.
          </p>
        </div>

        {/* Steps */}
        <div className="relative">
          {/* Connection line */}
          <div className="hidden lg:block absolute top-1/2 left-0 right-0 h-0.5 bg-gradient-to-r from-primary-200 via-primary-400 to-primary-200 -translate-y-1/2" />
          
          <div className="grid md:grid-cols-2 lg:grid-cols-4 gap-8">
            {steps.map((item, index) => (
              <StepCard key={index} {...item} />
            ))}
          </div>
        </div>

        {/* CTA */}
        <div className="mt-16 text-center">
          <div className="inline-flex flex-col items-center">
            <ArrowDown className="w-8 h-8 text-primary-400 dark:text-primary-500 animate-bounce mb-4" />
            <p className="text-slate-600 dark:text-slate-400 mb-2">Ready to get started?</p>
            <a 
              href="/register"
              className="text-primary-600 dark:text-primary-400 font-semibold hover:text-primary-700 dark:hover:text-primary-300 transition-colors"
            >
              Try it free now →
            </a>
          </div>
        </div>
      </div>
    </section>
  )
}

interface StepCardProps {
  icon: React.ElementType
  step: string
  title: string
  description: string
}

function StepCard({ icon: Icon, step, title, description }: StepCardProps) {
  return (
    <div className="relative">
      {/* Card */}
      <SpotlightCard 
        spotlightColor="rgba(34, 197, 94, 0.2)"
        className="bg-slate-50 dark:bg-slate-800 rounded-2xl p-6 text-center hover:bg-white dark:hover:bg-slate-700 hover:shadow-xl transition-all duration-300 border border-transparent hover:border-slate-200 dark:hover:border-slate-600"
      >
        {/* Step number */}
        <div className="absolute -top-4 left-1/2 -translate-x-1/2 bg-gradient-to-r from-primary-500 to-primary-600 dark:from-primary-600 dark:to-primary-700 text-white text-sm font-bold px-4 py-1 rounded-full shadow-md z-10">
          {step}
        </div>
        
        {/* Icon */}
        <div className="w-16 h-16 mx-auto mt-4 mb-4 rounded-2xl bg-white dark:bg-slate-700 shadow-md flex items-center justify-center">
          <Icon className="w-8 h-8 text-primary-600 dark:text-primary-400" />
        </div>
        
        {/* Content */}
        <h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100 mb-2">{title}</h3>
        <p className="text-slate-600 dark:text-slate-400 text-sm">{description}</p>
      </SpotlightCard>
    </div>
  )
}
