/**
 * Shown when a render error escapes to the app root.
 *
 * Before this existed, a render exception unmounted the tree and left the
 * customer staring at a blank white page with no way forward. The matching
 * `$exception` is reported by the surrounding PostHogErrorBoundary.
 */
export function AppErrorFallback() {
  return (
    <div className="flex min-h-screen items-center justify-center bg-slate-50 p-6">
      <div className="w-full max-w-md rounded-xl border border-slate-200 bg-white p-6 shadow-sm">
        <h2 className="text-lg font-semibold text-slate-900">
          Something went wrong
        </h2>
        <p className="mt-2 text-sm text-slate-600">
          This page failed to load. The problem has been reported. Try reloading
          — if it keeps happening, please contact support.
        </p>
        <button
          type="button"
          onClick={() => window.location.reload()}
          className="mt-4 rounded-lg bg-teal-700 px-4 py-2 text-sm font-medium text-white hover:bg-teal-800"
        >
          Reload page
        </button>
      </div>
    </div>
  );
}

export default AppErrorFallback;
