'use client';
import { useTranslations } from 'next-intl';
import { Container, Button, Heading } from '@/components/ui';
import Scribble from '@/components/Scribble';
import { useEffect } from 'react';
import { useAnalytics } from '@/components/analytics/useAnalytics';
import { AnalyticsEvents } from '@/components/analytics/analytics-events';

export default function NotFound() {
  const t = useTranslations('Error.notFound');
  const { trackEvent } = useAnalytics();

  useEffect(() => {
    trackEvent(AnalyticsEvents.ERROR, {
      type: '404_not_found',
      path: typeof window !== 'undefined' ? window.location.pathname : 'unknown',
    });
  }, [trackEvent]);

  return (
    <Container className="relative py-24 flex flex-col items-center justify-center text-center min-h-[70vh] overflow-hidden">
      {/* Industrial Background Element */}
      <div className="absolute inset-0 -z-10 opacity-[0.03] pointer-events-none flex items-center justify-center">
        <span className="text-[20rem] font-bold select-none">404</span>
      </div>

      <div className="relative mb-8">
        <Heading level={1} className="text-6xl md:text-8xl font-bold mb-2">
          404
        </Heading>
        <Scribble
          variant="circle"
          className="w-[150%] h-[150%] -top-[25%] -left-[25%] text-accent/40"
        />
      </div>

      <Heading level={2} className="text-2xl md:text-3xl font-bold mb-4 text-primary">
        {t('title')}
      </Heading>

      <p className="text-white/60 mb-10 max-w-md text-lg">{t('description')}</p>

      <div className="flex flex-col sm:flex-row gap-4">
        <Button href="/" variant="accent" size="lg">
          {t('cta')}
        </Button>
        <Button href="/contact" variant="outline" size="lg">
          Contact Support
        </Button>
      </div>

      {/* Decorative Industrial Line */}
      <div className="absolute bottom-0 left-1/2 -translate-x-1/2 w-px h-24 bg-gradient-to-t from-accent/50 to-transparent" />
    </Container>
  );
}
