'use client';

import { useTranslator } from '@/contexts/TranslatorContext';
import { Button } from '@/components/ui/button';
import { motion } from 'framer-motion';

const KubernetesWindosHosting = () => {
  const { translations } = useTranslator();
  const kubernetes = {
    title:
      translations['windowsHosting.kubernetes.title'] ||
      translations?.kubernetes?.title,
    description:
      translations['windowsHosting.kubernetes.description'] ||
      translations?.kubernetes?.description,
    button:
      translations['windowsHosting.kubernetes.button'] ||
      translations?.kubernetes?.button,
    goFast:
      translations['windowsHosting.kubernetes.goFast'] ||
      translations?.kubernetes?.goFast,
    locations:
      translations['windowsHosting.kubernetes.locations'] ||
      translations?.kubernetes?.locations ||
      [],
  };

  const images = [
    '/images/Group3277.png',
    '/images/Group 3275.png',
    '/images/winds-keyAdSec.svg',
  ];

  return (
    <div className='container mx-auto px-4 sm:px-6 py-8 sm:py-10 md:py-12'>
      {/* Header Section */}
      <motion.div
        initial={{ opacity: 0, y: 100 }}
        whileInView={{
          opacity: 1,
          y: 0,
          transition: { duration: 0.4, ease: 'easeOut' },
        }}
        viewport={{ once: true, margin: '-50px' }}
        className='py-8 flex flex-col items-center justify-center text-center'>
        <p className='text-xl sm:text-2xl md:text-3xl font-semibold text-[#2B1F51]'>
          {kubernetes.title}
        </p>
        <p className='font-medium text-[#2B1F51] pt-6 max-w-2xl'>
          {kubernetes.description}
        </p>
        <div className='pt-8'>
          <Button
            variant='outline'
            className='border-[#2B1F51] text-[#2B1F51] hover:bg-[#2B1F51] hover:text-white px-6 text-base bg-transparent md:text-lg transition-colors duration-300'>
            {kubernetes.button}
          </Button>
        </div>
      </motion.div>

      {/* Sub Title */}
      <div className='py-8'>
        <p className='text-center text-xl sm:text-2xl md:text-3xl font-semibold text-[#2B1F51]'>
          {kubernetes.goFast}
        </p>
      </div>

      {/* Cards Section */}
      <div className='grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-6 w-full pt-8'>
        {kubernetes.locations.map((item, index) => (
          <motion.div
            key={index}
            initial={{ opacity: 0, y: 60 }}
            whileInView={{
              opacity: 1,
              y: 0,
              transition: { duration: 0.4, delay: index * 0.1, ease: 'easeOut' },
            }}
            viewport={{ once: true, amount: 0.2 }}
            whileHover={{ y: -4, transition: { duration: 0.2 } }}
            className='bg-white rounded-2xl border border-gray-200 shadow-md hover:shadow-lg transition-shadow p-4 sm:p-6'>
            <div className='w-full h-full text-right'>
              <img
                src={images[index]}
                alt={item.title}
                className='object-cover h-12'
              />
              <p className='font-semibold mt-10 text-xl'>{item.title}</p>
              <p className='font-normal text-sm text-gray-600 pt-4'>
                {item.description}
              </p>
            </div>
          </motion.div>
        ))}
      </div>
    </div>
  );
};

export default KubernetesWindosHosting;
