function Modal({ isOpen, title, message, onConfirm, onCancel, confirmText = "מחק", cancelText = "ביטול", isDangerous = false, children }) {
  if (!isOpen) return null;

  return (
    <div className="modal-backdrop" onClick={onCancel}>
      <div className="modal" onClick={(e) => e.stopPropagation()}>
        <header className="modal-header">
          <h2>{title}</h2>
        </header>
        <div className="modal-body">
          {children || message}
        </div>
        {!children && (
          <footer className="modal-footer">
            <button className="btn ghost" onClick={onCancel}>
              {cancelText}
            </button>
            <button
              className={`btn ${isDangerous ? "danger" : "primary"}`}
              onClick={onConfirm}
            >
              {confirmText}
            </button>
          </footer>
        )}
      </div>
    </div>
  );
}

export default Modal;
