'use client';

import { useEffect } from 'react';

export default function Error({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) {
  useEffect(() => { console.error('Unhandled error:', error); }, [error]);

  return (
    <div className="flex min-h-screen items-center justify-center p-4" style={{ background: 'var(--nl-bg-canvas, #06070A)' }}>
      <div className="text-center">
        <h1 className="text-4xl font-bold" style={{ color: 'var(--nl-danger, #FF6E6E)' }}>Something went wrong</h1>
        <p className="mt-4 text-sm" style={{ color: 'var(--nl-text-secondary, #A5B1C7)' }}>
          {error.message || 'An unexpected error occurred.'}
        </p>
        <button
          onClick={reset}
          className="mt-6 inline-flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-colors"
          style={{ background: 'var(--nl-accent-primary, #5A8CFF)', color: '#fff' }}
        >
          Try again
        </button>
      </div>
    </div>
  );
}
