// components/PortfolioDevelopmentProcess.tsx
import { motion } from "framer-motion";
import { ReactNode } from "react";

interface Phase {
  icon: ReactNode;
  phase: string;
  duration: string;
  description: string;
}

interface PortfolioDevelopmentProcessProps {
  title: string;
  subtitle: string;
  phases: Phase[];
}

export function PortfolioDevelopmentProcess({
  title,
  subtitle,
  phases,
}: PortfolioDevelopmentProcessProps) {
  return (
    <section className="py-24 bg-card/30">
      <div className="container mx-auto px-4 lg:px-6">
        <motion.div
          initial={{ opacity: 0, y: 30 }}
          whileInView={{ opacity: 1, y: 0 }}
          transition={{ duration: 0.8 }}
          viewport={{ once: true }}
          className="max-w-6xl mx-auto"
        >
          {/* Section Heading */}
          <div className="text-center mb-16">
            <h2 className="text-3xl lg:text-5xl font-semibold text-foreground mb-6">
              {title}
            </h2>
            <p className="text-xl text-muted-foreground max-w-3xl mx-auto">
              {subtitle}
            </p>
          </div>

          {/* Phases Grid */}
          <div className="grid lg:grid-cols-5 gap-8">
            {phases.map((phase, index) => (
              <motion.div
                key={phase.phase}
                initial={{ opacity: 0, y: 20 }}
                whileInView={{ opacity: 1, y: 0 }}
                transition={{ duration: 0.6, delay: index * 0.1 }}
                viewport={{ once: true }}
                className="relative"
              >
                <div className="bg-card/50 rounded-xl p-6 border border-border/50 hover:border-accent/30 transition-all duration-300 h-full">
                  <div className="text-accent mb-4">{phase.icon}</div>
                  <h3 className="text-lg font-semibold text-foreground mb-2">
                    {phase.phase}
                  </h3>
                  <div className="text-accent font-medium mb-3">
                    {phase.duration}
                  </div>
                  <p className="text-muted-foreground text-sm leading-relaxed">
                    {phase.description}
                  </p>
                </div>

                {/* Connector Line */}
                {index < phases.length - 1 && (
                  <div className="hidden lg:block absolute top-1/2 -right-4 w-8 h-0.5 bg-border transform -translate-y-1/2" />
                )}
              </motion.div>
            ))}
          </div>
        </motion.div>
      </div>
    </section>
  );
}
