import React from "react";

export default function ConfirmModal({
  open,
  title,
  message,
  confirmLabel = "Подтвердить",
  cancelLabel = "Отмена",
  onConfirm,
  onCancel
}) {
  if (!open) return null;

  return (
    <div className="modal-overlay" onClick={onCancel}>
      <div className="modal" onClick={(event) => event.stopPropagation()}>
        <div className="row-header">
          <h3>{title}</h3>
          <button className="ghost" type="button" onClick={onCancel}>Закрыть</button>
        </div>
        <div className="help-note">{message}</div>
        <div className="row-inline">
          <button className="secondary" type="button" onClick={onCancel}>{cancelLabel}</button>
          <button className="primary" type="button" onClick={onConfirm}>{confirmLabel}</button>
        </div>
      </div>
    </div>
  );
}
