'use client'

import { useEffect } from 'react'

export default function AdminError({
  error,
  reset,
}: {
  error: Error & { digest?: string }
  reset: () => void
}) {
  useEffect(() => {
    console.error('[Admin] 页面错误:', error)
  }, [error])

  return (
    <div className="min-h-screen flex items-center justify-center bg-[#0a1628]">
      <div className="bg-[#0f2137] border border-gray-700/50 rounded-2xl p-8 max-w-md w-full mx-4 shadow-xl">
        <div className="text-center">
          <div className="text-5xl mb-4">😞</div>
          <h2 className="text-xl font-bold text-white mb-2">哎呀，出错了</h2>
          <p className="text-gray-400 text-sm mb-6">页面遇到了一些问题，请稍后再试</p>
          <div className="flex gap-3">
            <button
              onClick={reset}
              className="flex-1 py-2.5 rounded-lg bg-[#38bdac] hover:bg-[#2da396] text-white text-sm font-medium"
            >
              重试
            </button>
            <a
              href="/admin"
              className="flex-1 py-2.5 rounded-lg bg-gray-700 hover:bg-gray-600 text-gray-200 text-sm font-medium text-center"
            >
              返回后台
            </a>
          </div>
        </div>
      </div>
    </div>
  )
}
