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

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 CaseStudies = () => {
  const shouldReduceMotion = useReducedMotion();

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

          <div className="bg-gradient-to-r from-blue-400 to-blue-600 rounded-2xl p-8 lg:p-12 text-white">
            <div className="grid lg:grid-cols-2 gap-8 items-center">
              <div>
                <h3 className="text-2xl lg:text-3xl font-bold mb-4">Dios</h3>
                <p className="text-blue-100 mb-6">
                  A comprehensive platform for managing digital assets and workflows with advanced automation capabilities.
                </p>
                <div className="flex flex-wrap gap-4 mb-6">
                  <span className="bg-white/20 px-3 py-1 rounded-full text-sm">React</span>
                  <span className="bg-white/20 px-3 py-1 rounded-full text-sm">Node.js</span>
                  <span className="bg-white/20 px-3 py-1 rounded-full text-sm">MongoDB</span>
                </div>
                <div className="flex items-center space-x-6">
                  <div>
                    <div className="text-2xl font-bold">$2,500</div>
                    <div className="text-blue-200 text-sm">Project Value</div>
                  </div>
                  <div>
                    <div className="text-2xl font-bold">12w</div>
                    <div className="text-blue-200 text-sm">Timeline</div>
                  </div>
                </div>
              </div>
              <div className="bg-white/10 rounded-lg p-6 backdrop-blur-sm">
                <div className="w-full h-48 bg-white/20 rounded-lg flex items-center justify-center">
                  <div className="text-white/60">Project Preview</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </section>
    );
  }

  return (
    <motion.section 
      {...fadeUpPreset(0.1, 0.8)}
      className="section-padding bg-white"
    >
      <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">
            Case Studies
          </h2>
        </motion.div>

        <motion.div 
          {...fadeUpPreset(0.3, 0.8)}
          className="bg-gradient-to-r from-blue-400 to-blue-600 rounded-2xl p-8 lg:p-12 text-white"
        >
          <div className="grid lg:grid-cols-2 gap-8 items-center">
            <div>
              <h3 className="text-2xl lg:text-3xl font-bold mb-4">Dios</h3>
              <p className="text-blue-100 mb-6">
                A comprehensive platform for managing digital assets and workflows with advanced automation capabilities.
              </p>
              <div className="flex flex-wrap gap-4 mb-6">
                <span className="bg-white/20 px-3 py-1 rounded-full text-sm">React</span>
                <span className="bg-white/20 px-3 py-1 rounded-full text-sm">Node.js</span>
                <span className="bg-white/20 px-3 py-1 rounded-full text-sm">MongoDB</span>
              </div>
              <div className="flex items-center space-x-6">
                <div>
                  <div className="text-2xl font-bold">$2,500</div>
                  <div className="text-blue-200 text-sm">Project Value</div>
                </div>
                <div>
                  <div className="text-2xl font-bold">12w</div>
                  <div className="text-blue-200 text-sm">Timeline</div>
                </div>
              </div>
            </div>
            <div className="bg-white/10 rounded-lg p-6 backdrop-blur-sm">
              <div className="w-full h-48 bg-white/20 rounded-lg flex items-center justify-center">
                <div className="text-white/60">Project Preview</div>
              </div>
            </div>
          </div>
        </motion.div>
      </div>
    </motion.section>
  );
};

export default CaseStudies;