"use client"

import { motion } from "framer-motion"
import { CheckSquare, TrendingUp, Wallet, Zap } from "lucide-react"

const steps = [
  {
    icon: Wallet,
    title: "Connect Wallet",
    description: "Link your Celo wallet to get started in seconds",
  },
  {
    icon: CheckSquare,
    title: "Complete Tasks",
    description: "Choose from available tasks and complete them",
  },
  {
    icon: Zap,
    title: "AI Verification",
    description: "Gemini AI verifies your work instantly",
  },
  {
    icon: TrendingUp,
    title: "Earn & Withdraw",
    description: "Get paid in cUSD directly to your wallet",
  },
]

export function HowItWorks() {
  return (
    <section className="py-16 px-4 sm:px-6 lg:px-8 bg-white">
      <div className="max-w-6xl mx-auto">
        <motion.div
          className="text-center mb-12"
          initial={{ opacity: 0, y: 20 }}
          whileInView={{ opacity: 1, y: 0 }}
          transition={{ duration: 0.5 }}
          viewport={{ once: true }}
        >
          <h2 className="text-3xl sm:text-4xl font-bold mb-4 text-gray-900">
            How it{" "}
            <span className="text-primary">works</span>
          </h2>
          <p className="text-base text-gray-600">Get started in 4 simple steps</p>
        </motion.div>

        <div className="grid grid-cols-1 md:grid-cols-4 gap-6">
          {steps.map((step, index) => (
            <motion.div
              key={index}
              className="relative"
              initial={{ opacity: 0, y: 20 }}
              whileInView={{ opacity: 1, y: 0 }}
              transition={{ duration: 0.5, delay: index * 0.1 }}
              viewport={{ once: true }}
            >
              {index < steps.length - 1 && (
                <div className="hidden md:block absolute top-12 left-[60%] w-[calc(100%-60px)] h-0.5 bg-gray-300" />
              )}

              <div className="relative bg-white border-2 border-gray-200 hover:border-primary p-6 text-center transition-colors">
                <div className="w-16 h-16 bg-primary flex items-center justify-center mx-auto mb-4 border-2 border-primary">
                  <step.icon className="w-8 h-8 text-white" />
                </div>

                <div className="absolute -top-3 left-1/2 transform -translate-x-1/2 bg-primary text-white text-sm font-bold w-7 h-7  flex items-center justify-center border-2 border-white">
                  {index + 1}
                </div>

                <h3 className="font-bold text-base mb-2 text-gray-900">{step.title}</h3>
                <p className="text-gray-600 text-sm leading-relaxed">{step.description}</p>
              </div>
            </motion.div>
          ))}
        </div>
      </div>
    </section>
  )
}
