import { AlertTriangle } from "lucide-react";

import { Button } from "@/components/ui/button";

interface ErrorStateProps {
  title: string;
  description: string;
  actionLabel?: string;
  onAction?: () => void;
}

export function ErrorState({ title, description, actionLabel, onAction }: ErrorStateProps) {
  return (
    <section className="glass-panel panel-elevated rounded-2xl border border-red-300/25 bg-red-950/20 p-6 text-center" role="alert" aria-live="assertive">
      <span className="mx-auto inline-flex size-11 items-center justify-center rounded-xl border border-red-300/30 bg-red-500/10">
        <AlertTriangle className="size-6 text-red-300" />
      </span>
      <h3 className="mt-3 text-lg font-medium text-white">{title}</h3>
      <p className="mx-auto mt-2 max-w-2xl text-sm text-red-100/80">{description}</p>
      {actionLabel && onAction ? (
        <Button className="mt-4 focus-visible:ring-red-300/60" variant="secondary" size="sm" onClick={onAction}>
          {actionLabel}
        </Button>
      ) : null}
    </section>
  );
}
