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

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

const Services = () => {
  const shouldReduceMotion = useReducedMotion();

  if (shouldReduceMotion) {
    return (
      <section className="section-padding bg-gray-50">
        <div className="container-custom">
          <div className="text-center mb-16">
            <h2 className="text-3xl lg:text-4xl font-bold text-gray-900 mb-4">
              Explore our services
            </h2>
          </div>

          <div className="grid lg:grid-cols-2 gap-12">
            {/* Web Development */}
            <div className="service-card">
              <div className="flex items-center justify-between mb-6">
                <h3 className="text-2xl font-bold text-gray-900">Web Development</h3>
                <Globe className="w-8 h-8 text-primary-600" />
              </div>
              <p className="text-gray-600 mb-6">
                Custom web applications built with modern technologies and best practices.
              </p>
              <div className="flex items-center space-x-2 text-primary-600">
                <span className="text-sm font-medium">Learn more</span>
                <div className="w-4 h-0.5 bg-primary-600"></div>
              </div>
            </div>

            {/* Mobile Development */}
            <div className="service-card">
              <div className="flex items-center justify-between mb-6">
                <h3 className="text-2xl font-bold text-gray-900">Mobile Development</h3>
                <Package className="w-8 h-8 text-primary-600" />
              </div>
              <p className="text-gray-600 mb-6">
                Native and cross-platform mobile applications for iOS and Android.
              </p>
              <div className="flex items-center space-x-2 text-primary-600">
                <span className="text-sm font-medium">Learn more</span>
                <div className="w-4 h-0.5 bg-primary-600"></div>
              </div>
            </div>
          </div>

          {/* CTA Section */}
          <div className="mt-16 text-center">
            <div className="bg-white rounded-2xl p-8 lg:p-12 shadow-sm border border-gray-100">
              <h3 className="text-2xl lg:text-3xl font-bold text-gray-900 mb-4">
                Get the same high-quality service for a smaller task
              </h3>
              <button className="btn-primary mt-6">
                Start Your Project
              </button>
            </div>
          </div>
        </div>
      </section>
    );
  }

  return (
    <motion.section 
      {...fadeUpPreset(0.1, 0.8)}
      className="section-padding bg-gray-50"
    >
      <div className="container-custom">
        <motion.div 
          {...fadeUpPreset(0.2, 0.8)}
          className="text-center mb-16"
        >
          <h2 className="text-3xl lg:text-4xl font-bold text-gray-900 mb-4">
            Explore our services
          </h2>
        </motion.div>

        <div className="grid lg:grid-cols-2 gap-12">
          {/* Web Development */}
          <motion.div 
            {...fadeUpPreset(0.3, 0.8)}
            className="service-card"
          >
            <div className="flex items-center justify-between mb-6">
              <h3 className="text-2xl font-bold text-gray-900">Web Development</h3>
              <Globe className="w-8 h-8 text-primary-600" />
            </div>
            <p className="text-gray-600 mb-6">
              Custom web applications built with modern technologies and best practices.
            </p>
            <div className="flex items-center space-x-2 text-primary-600">
              <span className="text-sm font-medium">Learn more</span>
              <div className="w-4 h-0.5 bg-primary-600"></div>
            </div>
          </motion.div>

          {/* Mobile Development */}
          <motion.div 
            {...fadeUpPreset(0.4, 0.8)}
            className="service-card"
          >
            <div className="flex items-center justify-between mb-6">
              <h3 className="text-2xl font-bold text-gray-900">Mobile Development</h3>
              <Package className="w-8 h-8 text-primary-600" />
            </div>
            <p className="text-gray-600 mb-6">
              Native and cross-platform mobile applications for iOS and Android.
            </p>
            <div className="flex items-center space-x-2 text-primary-600">
              <span className="text-sm font-medium">Learn more</span>
              <div className="w-4 h-0.5 bg-primary-600"></div>
            </div>
          </motion.div>
        </div>

        {/* CTA Section */}
        <motion.div 
          {...fadeUpPreset(0.5, 0.8)}
          className="mt-16 text-center"
        >
          <div className="bg-white rounded-2xl p-8 lg:p-12 shadow-sm border border-gray-100">
            <h3 className="text-2xl lg:text-3xl font-bold text-gray-900 mb-4">
              Get the same high-quality service for a smaller task
            </h3>
            <button className="btn-primary mt-6">
              Start Your Project
            </button>
          </div>
        </motion.div>
      </div>
    </motion.section>
  );
};

export default Services;