'use client';

import { useTranslator } from '@/contexts/TranslatorContext';
import { motion } from 'framer-motion';

export default function Advantages() {
  const { translations } = useTranslator();

  // Animation variants
  const container = {
    hidden: { opacity: 0 },
    visible: {
      opacity: 1,
      transition: {
        staggerChildren: 0.2
      }
    }
  };

  const item = {
    hidden: { opacity: 0, y: 30 },
    visible: {
      opacity: 1,
      y: 0,
      transition: { duration: 0.6 }
    }
  };

  return (
    <div className='w-full mt-20 lg:mt-32 px-4 mb-20'>
      {/* Parent container */}
      <div className='max-w-7xl mx-auto text-center'>
        {/* Heading */}
        <motion.div
           initial={{ opacity: 0, y: -20 }}
           whileInView={{ opacity: 1, y: 0 }}
           transition={{ duration: 0.8 }}
           viewport={{ once: true }}
        >
            <h1 className='lg:text-4xl text-2xl mb-6 font-bold text-[#092346]'>
              {translations['advantages.title']}
            </h1>
            <p className='text-gray-600 max-w-2xl mx-auto'>
                {translations['advantages.description']}
            </p>
        </motion.div>

        {/* Cards */}
        <motion.div 
            className='grid lg:grid-cols-4 md:grid-cols-2 grid-cols-1 gap-8 mt-16'
            variants={container}
            initial="hidden"
            whileInView="visible"
            viewport={{ once: true }}
        >
          {/* Card 1 */}
          <motion.div 
            variants={item}
            whileHover={{ y: -10 }}
            className='bg-white rounded-xl p-8 w-full max-w-xs mx-auto flex items-center justify-center gap-6 flex-col shadow-lg border border-gray-100 hover:shadow-xl transition-all duration-300'
          >
            <div className="w-20 h-20 flex items-center justify-center bg-blue-50 rounded-full mb-2">
                <img
                  src='/images/Group%202578-D7likXqi.svg'
                  alt={translations['advantages.card1.title']}
                  className="w-10 h-10"
                />
            </div>
            <h1 className='text-center text-lg font-bold text-[#092346]'>
              {translations['advantages.card1.title']}
            </h1>
          </motion.div>

          {/* Card 2 */}
          <motion.div 
            variants={item}
            whileHover={{ y: -10 }}
            className='bg-white rounded-xl p-8 w-full max-w-xs mx-auto flex items-center justify-center gap-6 flex-col shadow-lg border border-gray-100 hover:shadow-xl transition-all duration-300'
          >
            <div className="w-20 h-20 flex items-center justify-center bg-blue-50 rounded-full mb-2">
                <img
                  src='/images/Group%202589-opip1_NG.svg'
                  alt={translations['advantages.card2.title']}
                  className="w-10 h-10"
                />
            </div>
            <h1 className='text-center text-lg font-bold text-[#092346]'>
              {translations['advantages.card2.title']}
            </h1>
          </motion.div>

          {/* Card 3 */}
          <motion.div 
            variants={item}
            whileHover={{ y: -10 }}
            className='bg-white rounded-xl p-8 w-full max-w-xs mx-auto flex items-center justify-center gap-6 flex-col shadow-lg border border-gray-100 hover:shadow-xl transition-all duration-300'
          >
            <div className="w-20 h-20 flex items-center justify-center bg-blue-50 rounded-full mb-2">
                <img
                  src='/images/Group%202590-CX4IN7Eu.svg'
                  alt={translations['advantages.card3.title']}
                  className="w-10 h-10"
                />
            </div>
            <h1 className='text-center text-lg font-bold text-[#092346]'>
              {translations['advantages.card3.title']}
            </h1>
          </motion.div>

          {/* Card 4 */}
          <motion.div 
            variants={item}
            whileHover={{ y: -10 }}
            className='bg-white rounded-xl p-8 w-full max-w-xs mx-auto flex items-center justify-center gap-6 flex-col shadow-lg border border-gray-100 hover:shadow-xl transition-all duration-300'
          >
            <div className="w-20 h-20 flex items-center justify-center bg-blue-50 rounded-full mb-2">
                <img
                  src='/images/Group%202591-Bb5tZFtO.svg'
                  alt={translations['advantages.card4.title']}
                  className="w-10 h-10"
                />
            </div>
            <h1 className='text-center text-lg font-bold text-[#092346]'>
              {translations['advantages.card4.title']}
            </h1>
          </motion.div>
        </motion.div>
      </div>
    </div>
  );
}
