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="py-20 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-3xl lg:text-4xl font-bold text-gray-900 mb-4">
              Case Studies
            </h2>
          </div>

          <div className="case-study-card max-w-4xl mx-auto">
            <div className="grid lg:grid-cols-2 gap-8 items-center">
              <div>
                <h3 className="text-2xl font-bold mb-4">Dios</h3>
                <p className="text-blue-100 mb-6">
                  A comprehensive platform for managing digital assets and workflows with advanced AI integration.
                </p>
                <div className="flex flex-wrap gap-2 mb-6">
                  <span className="bg-white/20 text-white px-3 py-1 rounded-full text-sm">React</span>
                  <span className="bg-white/20 text-white px-3 py-1 rounded-full text-sm">Node.js</span>
                  <span className="bg-white/20 text-white px-3 py-1 rounded-full text-sm">AI/ML</span>
                  <span className="bg-white/20 text-white px-3 py-1 rounded-full text-sm">Cloud</span>
                </div>
                <div className="flex items-center space-x-6">
                  <div>
                    <div className="text-2xl font-bold">$2,500</div>
                    <div className="text-blue-100 text-sm">Project Value</div>
                  </div>
                  <div>
                    <div className="text-2xl font-bold">12w</div>
                    <div className="text-blue-100 text-sm">Timeline</div>
                  </div>
                </div>
              </div>
              <div className="bg-white/10 rounded-lg p-6 h-64 flex items-center justify-center">
                <div className="text-center">
                  <div className="w-16 h-16 bg-white rounded-lg mx-auto mb-4 flex items-center justify-center">
                    <span className="text-blue-500 text-2xl font-bold">D</span>
                  </div>
                  <p className="text-white font-medium">Dios Platform</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </section>
    );
  }

  return (
    <motion.section 
      {...fadeUpPreset(0.1, 1.0)}
      className="py-20 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-3xl lg:text-4xl font-bold text-gray-900 mb-4">
            Case Studies
          </h2>
        </motion.div>

        <motion.div 
          {...fadeUpPreset(0.3, 0.8)}
          className="case-study-card max-w-4xl mx-auto"
        >
          <div className="grid lg:grid-cols-2 gap-8 items-center">
            <div>
              <h3 className="text-2xl font-bold mb-4">Dios</h3>
              <p className="text-blue-100 mb-6">
                A comprehensive platform for managing digital assets and workflows with advanced AI integration.
              </p>
              <div className="flex flex-wrap gap-2 mb-6">
                <span className="bg-white/20 text-white px-3 py-1 rounded-full text-sm">React</span>
                <span className="bg-white/20 text-white px-3 py-1 rounded-full text-sm">Node.js</span>
                <span className="bg-white/20 text-white px-3 py-1 rounded-full text-sm">AI/ML</span>
                <span className="bg-white/20 text-white px-3 py-1 rounded-full text-sm">Cloud</span>
              </div>
              <div className="flex items-center space-x-6">
                <div>
                  <div className="text-2xl font-bold">$2,500</div>
                  <div className="text-blue-100 text-sm">Project Value</div>
                </div>
                <div>
                  <div className="text-2xl font-bold">12w</div>
                  <div className="text-blue-100 text-sm">Timeline</div>
                </div>
              </div>
            </div>
            <div className="bg-white/10 rounded-lg p-6 h-64 flex items-center justify-center">
              <div className="text-center">
                <div className="w-16 h-16 bg-white rounded-lg mx-auto mb-4 flex items-center justify-center">
                  <span className="text-blue-500 text-2xl font-bold">D</span>
                </div>
                <p className="text-white font-medium">Dios Platform</p>
              </div>
            </div>
          </div>
        </motion.div>
      </div>
    </motion.section>
  );
};

export default CaseStudies;