'use client';
import {
  Card,
  CardContent,
  CardFooter,
  CardHeader,
  CardTitle,
} from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { useTranslator } from '@/contexts/TranslatorContext';
import { useCurrency } from '@/contexts/CurrencyContext';

const SSLCertificates = () => {
  const { translations } = useTranslator();
  const { symbol, priceFor } = useCurrency();

  const sslCertificates = [
    {
      title: 'GeoTrust QuickSSL Premium',
      price: '91.30',
      period: translations['ssl.period'] || 'د.ل / ربع سنوي',
      features: [
        translations['ssl.feature.validation'] || 'التحقق من صحة',
        translations['ssl.feature.organization'] || 'Organization',
        translations['ssl.feature.siteSeal'] || 'ختم الموقع',
        translations['ssl.feature.dynamic'] || 'Dynamic',
      ],
      buttonText: translations['ssl.button'] || 'اشترِ الآن',
      borderColor: 'bg-[#fdd835]',
    },
    {
      title: 'GeoTrust True BusinessID',
      price: '91.30',
      period: translations['ssl.period'] || 'د.ل / ربع سنوي',
      features: [
        translations['ssl.feature.validation'] || 'التحقق من صحة',
        translations['ssl.feature.organization'] || 'Organization',
        translations['ssl.feature.siteSeal'] || 'ختم الموقع',
        translations['ssl.feature.dynamic'] || 'Dynamic',
      ],
      buttonText: translations['ssl.button'] || 'اشترِ الآن',
      borderColor: 'bg-[#e0e7ff]',
    },
    {
      title: 'GeoTrust True BusinessID Wildcard',
      price: '91.30',
      period: translations['ssl.period'] || 'د.ل / ربع سنوي',
      features: [
        translations['ssl.feature.validation'] || 'التحقق من صحة',
        translations['ssl.feature.organization'] || 'Organization',
        translations['ssl.feature.siteSeal'] || 'ختم الموقع',
        translations['ssl.feature.dynamic'] || 'Dynamic',
      ],
      buttonText: translations['ssl.button'] || 'اشترِ الآن',
      borderColor: 'bg-[#64b5f6]',
    },
  ];

  return (
    <section className='relative w-full min-h-screen bg-white overflow-hidden py-12 md:py-20 lg:py-24'>
      {/* Background pattern */}
      <div className='absolute inset-0 z-0'>
        <img
          src='/background-pattern.png'
          alt='Abstract background pattern'
          style={{
            objectFit: 'cover',
            width: '100%',
            height: '100%',
            opacity: 0.05,
          }}
        />
      </div>

      <div className='relative z-10 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center'>
        <h2 className='text-3xl md:text-4xl text-gray-800 mb-4 leading-tight'>
          {translations['ssl.title'] || 'شهادات SSL لحماية موقعك'}
        </h2>

        <p className='text-base md:text-lg text-gray-600 max-w-3xl mx-auto mb-12 leading-relaxed'>
          {translations['ssl.description'] ||
            'احمِ بيانات موقعك وبيانات زوارك من خلال اتصال آمن وتشفير موثوق بشهادات SSL، وأخبر زوارك أن موقعك آمن ومؤمّن بعلامة القفل المميزة https://.'}
        </p>

        <h3 className='text-2xl md:text-3xl text-gray-800 mb-10'>
          {translations['ssl.choose.title'] || 'اختر شهادة SSL المناسبة'}
        </h3>

        <p className='text-base md:text-lg text-gray-600 max-w-3xl mx-auto mb-12 leading-relaxed'>
          {translations['ssl.choose.description'] ||
            'تقدم شركة SCG تشكيلة واسعة من شهادات الحماية من أكثر الشركات الموثوقة في العالم.'}
        </p>

        <div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8'>
          {sslCertificates.map((card, index) => (
            <Card
              key={index}
              className='card-hover w-full max-w-sm mx-auto rounded-lg shadow-md overflow-hidden p-0'>
              <div className={`h-3 ${card.borderColor}`} />
              <CardHeader className='text-center pt-6 pb-4'>
                <CardTitle className='text-lg font-semibold text-gray-700'>
                  {card.title}
                </CardTitle>
              </CardHeader>
              <CardContent className='flex flex-col items-center justify-center py-4'>
                <div className='text-5xl font-bold text-gray-800 mb-2'>
                  {priceFor({ sa: card.price })}{' '}
                  <span className='text-xl'>{symbol}</span>
                </div>
                <div className='text-sm text-gray-500 mb-6'>{card.period}</div>
                <ul className='space-y-2 text-center text-gray-600 text-sm'>
                  {card.features.map((feature, i) => (
                    <li key={i}>{feature}</li>
                  ))}
                </ul>
              </CardContent>
              <CardFooter className='flex justify-center pb-6 pt-4'>
                <Button className='bg-[#4a3a80] hover:bg-[#3a2a70] text-white font-bold py-2 px-6 rounded-md text-base'>
                  {card.buttonText}
                </Button>
              </CardFooter>
            </Card>
          ))}
        </div>
      </div>
    </section>
  );
};

export default SSLCertificates;
