import React from 'react';
import { motion, useReducedMotion } from 'framer-motion';
import { ExternalLink } 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 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="case-study-card max-w-4xl mx-auto">
            <div className="grid lg:grid-cols-2 gap-8 items-center">
              <div>
                <h3 className="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 AI integration.
                </p>
                <div className="flex items-center space-x-6 mb-6">
                  <div className="text-center">
                    <div className="text-2xl font-bold">$2,500</div>
                    <div className="text-blue-200 text-sm">Budget</div>
                  </div>
                  <div className="text-center">
                    <div className="text-2xl font-bold">12w</div>
                    <div className="text-blue-200 text-sm">Timeline</div>
                  </div>
                </div>
                <button className="flex items-center space-x-2 text-white hover:text-blue-100 transition-colors">
                  <span>View Case Study</span>
                  <ExternalLink className="w-4 h-4" />
                </button>
              </div>
              <div className="bg-white/10 rounded-lg p-6 backdrop-blur-sm">
                <div className="bg-white rounded-lg p-4">
                  <div className="h-32 bg-gradient-to-br from-gray-100 to-gray-200 rounded mb-4"></div>
                  <div className="space-y-2">
                    <div className="h-3 bg-gray-200 rounded w-3/4"></div>
                    <div className="h-3 bg-gray-200 rounded w-1/2"></div>
                  </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="case-study-card max-w-4xl mx-auto"
        >
          <div className="grid lg:grid-cols-2 gap-8 items-center">
            <div>
              <h3 className="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 AI integration.
              </p>
              <div className="flex items-center space-x-6 mb-6">
                <div className="text-center">
                  <div className="text-2xl font-bold">$2,500</div>
                  <div className="text-blue-200 text-sm">Budget</div>
                </div>
                <div className="text-center">
                  <div className="text-2xl font-bold">12w</div>
                  <div className="text-blue-200 text-sm">Timeline</div>
                </div>
              </div>
              <button className="flex items-center space-x-2 text-white hover:text-blue-100 transition-colors">
                <span>View Case Study</span>
                <ExternalLink className="w-4 h-4" />
              </button>
            </div>
            <div className="bg-white/10 rounded-lg p-6 backdrop-blur-sm">
              <div className="bg-white rounded-lg p-4">
                <div className="h-32 bg-gradient-to-br from-gray-100 to-gray-200 rounded mb-4"></div>
                <div className="space-y-2">
                  <div className="h-3 bg-gray-200 rounded w-3/4"></div>
                  <div className="h-3 bg-gray-200 rounded w-1/2"></div>
                </div>
              </div>
            </div>
          </div>
        </motion.div>
      </div>
    </motion.section>
  );
};

export default CaseStudies;