import React from 'react';
import { motion, useReducedMotion } from 'framer-motion';

const fadeUpPreset = (delay = 0, duration = 0.8) => ({
  initial: { opacity: 0, y: 20 },
  whileInView: { opacity: 1, y: 0 },
  viewport: { once: true, amount: 0.2 },
  transition: { delay, duration, ease: "easeOut" }
});

const EverythingYouNeed = () => {
  const shouldReduceMotion = useReducedMotion();
  
  const features = [
    {
      icon: "/images/puzzle.c9dfc495-1768470176521.svg",
      title: "MODULARITY",
      description: "Streamline upkeep by organizing applications into self-contained modules."
    },
    {
      icon: "/images/rocket.518dadfa-1768470176514.svg",
      title: "SCALABILITY",
      description: "Scale seamlessly with efficient, battle-tested components."
    },
    {
      icon: "/images/di.a0b12f44-1768470176529.svg",
      title: "DEPENDENCY INJECTION",
      description: "Elevate testability with a sophisticated dependency injection system."
    },
    {
      icon: "/images/type-safety.34453790-1768470176497.svg",
      title: "TYPE SAFETY",
      description: "Mitigate errors through the robust type safety features of TypeScript."
    },
    {
      icon: "/images/ecosystem.eaa69289-1768470176487.svg",
      title: "RICH ECOSYSTEM",
      description: "Explore a rich ecosystem offering versatile tools to craft solutions tailored to your needs."
    },
    {
      icon: "/images/chip.3b61cda8-1768470176549.svg",
      title: "ENTERPRISE-READY",
      description: "Trusted by thousands of leading companies and organizations worldwide."
    },
    {
      icon: "/images/microservices.e0074903-1768470176515.svg",
      title: "MICROSERVICES",
      description: "Create loosely coupled, independently deployable services for increased agility and scalability."
    },
    {
      icon: "/images/api.67807f71-1768470176521.svg",
      title: "WEB APPS",
      description: "Build REST APIs, GraphQL APIs, Queues, and real-time & event-driven applications in no time."
    }
  ];

  if (shouldReduceMotion) {
    return (
      <section className="section-padding bg-white">
        <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
          <div className="text-center mb-16">
            <h2 className="text-4xl md:text-5xl font-bold text-nest-dark mb-4">
              Everything you need..
            </h2>
            <p className="text-xl text-nest-gray max-w-3xl mx-auto">
              Build robust, powerful, and scalable server-side applications and stop reinventing the wheel.
            </p>
          </div>
          
          <div className="grid md:grid-cols-2 lg:grid-cols-4 gap-8">
            {features.map((feature, index) => (
              <div key={index} className="text-center">
                <div className="mb-6 flex justify-center">
                  <img src={feature.icon} alt="" className="w-12 h-12" />
                </div>
                <h3 className="font-bold text-nest-dark mb-3 text-sm">{feature.title}</h3>
                <p className="text-nest-gray text-sm leading-relaxed">{feature.description}</p>
              </div>
            ))}
          </div>
        </div>
      </section>
    );
  }

  return (
    <motion.section 
      {...fadeUpPreset(0.1, 1.0)}
      className="section-padding bg-white"
    >
      <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        <motion.div 
          {...fadeUpPreset(0.2, 0.8)}
          className="text-center mb-16"
        >
          <h2 className="text-4xl md:text-5xl font-bold text-nest-dark mb-4">
            Everything you need..
          </h2>
          <p className="text-xl text-nest-gray max-w-3xl mx-auto">
            Build robust, powerful, and scalable server-side applications and stop reinventing the wheel.
          </p>
        </motion.div>
        
        <div className="grid md:grid-cols-2 lg:grid-cols-4 gap-8">
          {features.map((feature, index) => (
            <motion.div 
              key={index} 
              {...fadeUpPreset(0.3 + (index * 0.05), 0.6)}
              className="text-center"
            >
              <div className="mb-6 flex justify-center">
                <img src={feature.icon} alt="" className="w-12 h-12" />
              </div>
              <h3 className="font-bold text-nest-dark mb-3 text-sm">{feature.title}</h3>
              <p className="text-nest-gray text-sm leading-relaxed">{feature.description}</p>
            </motion.div>
          ))}
        </div>
      </div>
    </motion.section>
  );
};

export default EverythingYouNeed;