"use client";
import React from "react";
import Button from "@/components/ui/button/Button2";

interface CustomAlertProps {
  isOpen: boolean;
  message: string;
  onClose: () => void;
  title?: string;
}

export default function CustomAlert({
  isOpen,
  message,
  onClose,
  title = "알림",
}: CustomAlertProps) {
  if (!isOpen) return null;

  return (
    <div className="fixed inset-0 z-99999 flex items-center justify-center p-4">
      <div className="absolute inset-0 bg-gray-400/50 backdrop-blur-[2px]" onClick={onClose}></div>
      <div
        className="relative z-10 w-full max-w-md rounded-2xl border border-gray-200 bg-white p-6 shadow-xl dark:border-gray-700 dark:bg-gray-900"
        onClick={(e) => e.stopPropagation()}
      >
        <h3 className="mb-3 text-lg font-semibold text-gray-800 dark:text-white/90">{title}</h3>
        <p className="mb-6 whitespace-pre-wrap text-sm text-gray-600 dark:text-gray-300">{message}</p>
        <div className="flex justify-end">
          <Button size="sm" variant="primary" onClick={onClose}>
            확인
          </Button>
        </div>
      </div>
    </div>
  );
}

