'use client';

import Link from 'next/link';

export default function ErrorPage({
  error,
  reset,
}: {
  error: Error & { digest?: string };
  reset: () => void;
}) {
  return (
    <main className="min-h-screen flex items-center justify-center bg-deep-graphite text-white px-6">
      <div className="max-w-md text-center space-y-4">
        <h1 className="text-3xl font-semibold">Something went wrong</h1>
        <p className="text-sm text-gray-400">
          {error?.message ? error.message : 'An unexpected error occurred.'}
        </p>
        <div className="flex items-center justify-center gap-3 pt-2">
          <button
            type="button"
            onClick={() => reset()}
            className="inline-flex items-center justify-center rounded-md bg-primary-blue px-4 py-2 text-sm font-medium text-white hover:bg-primary-blue/80 transition-colors"
          >
            Try again
          </button>
          <Link
            href="/"
            className="inline-flex items-center justify-center rounded-md bg-iron-gray px-4 py-2 text-sm font-medium text-white hover:bg-iron-gray/80 transition-colors"
          >
            Go home
          </Link>
        </div>
      </div>
    </main>
  );
}