'use client';

import { motion } from 'framer-motion';
import { useTranslator } from '@/contexts/TranslatorContext';
import { HardDrive, Zap, MousePointer, Globe } from 'lucide-react';
import Image from 'next/image';

const WordpressFeatures = () => {
  const { translations } = useTranslator() || {};

  const features = [
    { 
      text: translations?.feature_ssd || 'تخزين SSD & NVMe',
      icon: HardDrive
    },
    { 
      text: translations?.feature_unlimited_bandwidth || 'نطاق تردد غير محدودة',
      icon: Zap
    },
    { 
      text: translations?.feature_one_click || 'تثبيت بنقرة واحدة',
      icon: MousePointer
    },
    { 
      text: translations?.feature_wordpress_support || 'دعم ووردبريس متخصص',
      icon: Globe
    },
  ];

  return (
    <section className='w-full py-12 sm:py-16 md:py-20 lg:py-24 mt-8 sm:mt-4 md:-mt-12 lg:-mt-24 bg-white flex items-center justify-center overflow-hidden px-4 sm:px-6'>
      <div className='container px-4 md:px-6'>
        <div className='grid gap-10 lg:grid-cols-2 lg:gap-20 items-center'>
          
          {/* النص */}
          <motion.div
            initial={{ opacity: 0, x: -50 }}
            whileInView={{
              opacity: 1,
              x: 0,
              transition: { duration: 0.5, ease: 'easeOut' },
            }}
            className='space-y-6 text-right order-2 lg:order-1'>
            <h2 className='text-xl sm:text-2xl lg:text-3xl font-bold text-[#2B1F51] leading-tight'>
              {translations?.wordpress_features_title ||
                'منصة ووردبريس محسنة وبسرعة فائقة'}
            </h2>
            <p className='text-gray-600 text-sm sm:text-base leading-relaxed max-w-full lg:max-w-[90%] ml-auto'>
              {translations?.wordpress_features_description ||
                'نقدم لكم خطط استضافة ووردبريس ممتازة قابلة للتطوير وجاهزة لتلبية احتياجاتك المتزايدة مع نمو عملك. لن تضطر لدفع ثمن الخدمات والأجهزة الافتراضية التي لا تحتاجها، لأننا قمنا بتخصيص الخطط لتكون مناسبة لجميع الأعمال، من نقطة البداية المثالية لمعظم الشركات إلى الخطط المتقدمة التي تتعامل مع حركة زيارات العالية.'}
            </p>
            <div className='grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-3 pt-4 w-full'>
              {features.map((feature, idx) => {
                const IconComponent = feature.icon;
                return (
                  <div
                    key={idx}
                    className='flex items-center gap-2 w-full'>
                    <IconComponent size={20} className="text-blue-600 flex-shrink-0" />
                    <span className='text-[#2B1F51] font-medium text-sm sm:text-base text-right'>{feature.text}</span>
                  </div>
                );
              })}
            </div>
          </motion.div>

          {/* الصورة */}
          <motion.div
            initial={{ opacity: 0, x: 50 }}
            whileInView={{
              opacity: 1,
              x: 0,
              transition: { duration: 0.5, ease: 'easeOut' },
            }}
            className='flex justify-center order-1 lg:order-2'>
            <div className="relative w-full max-w-[500px]">
                <Image
                src='/images/download7.png'
                width={600}
                height={450}
                alt='WordPress Platform'
                className='w-full h-auto object-contain drop-shadow-lg'
                priority
                />
            </div>
          </motion.div>
        </div>
      </div>
    </section>
  );
};

export default WordpressFeatures;
