'use client';

import AppImage from '@/components/ui/AppImage';
import Link from 'next/link';
import { ArrowRight } from 'lucide-react';
import { CATEGORY_IDS } from '@/lib/constants';
import { CATEGORY_IMAGES } from '@/infrastructure/images';
import { useTranslation } from '@/hooks/useTranslation';
export default function CategoryGrid() {
  const { t } = useTranslation();

  return (
    <section className="bg-cream-50 py-20">
      <div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
        <div className="mb-12 text-center">
          <h2 className="section-heading mb-3">{t('categories.title')}</h2>
          <p className="mx-auto max-w-2xl text-gray-500">{t('categories.subtitle')}</p>
        </div>

        <div className="grid gap-6 sm:grid-cols-2 lg:grid-cols-4">
          {CATEGORY_IDS.map((id) => (
            <Link
              key={id}
              href={`/shop?category=${id}`}
              className="group relative overflow-hidden rounded-2xl shadow-premium transition-all duration-300 hover:shadow-premium-lg"
            >
              <div className="relative aspect-[3/4]">
                <AppImage
                  src={CATEGORY_IMAGES[id]}
                  alt={t(`categories.${id}.name`)}
                  fill
                  className="object-cover transition-transform duration-500 group-hover:scale-110"
                  sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 320px"
                />
                <div className="absolute inset-0 bg-gradient-to-t from-brand-950/92 via-brand-800/50 to-brand-700/10" />
              </div>
              <div className="absolute bottom-0 left-0 right-0 p-6">
                <h3 className="mb-1 font-display text-2xl font-bold text-white">
                  {t(`categories.${id}.name`)}
                </h3>
                <p className="mb-3 text-sm text-brand-200">
                  {t(`categories.${id}.description`)}
                </p>
                <span className="inline-flex items-center gap-1 text-sm font-semibold text-gold-400 transition-colors group-hover:text-gold-300">
                  {t('categories.shop', { name: t(`categories.${id}.name`) })}
                  <ArrowRight className="h-4 w-4 transition-transform group-hover:translate-x-1 rtl:rotate-180 rtl:group-hover:-translate-x-1" />
                </span>
              </div>
            </Link>
          ))}
        </div>
      </div>
    </section>
  );
}