/**
 * WorkspaceClearModal.tsx — Dialog conferma eliminazione conversazioni (S761-5)
 * Estratto da MainWorkspace.tsx: modale "Elimina tutto".
 * Zero business logic — componente puramente presentazionale.
 */
import { memo } from "react";
import { Z_INDEX } from "@/lib/zindex";
import { modalBtnDanger, modalBtnSecondary } from "@/pages/mainWorkspaceStyles";

interface WorkspaceClearModalProps {
  open:      boolean;
  onClose:   () => void;
  onConfirm: () => void;
}

const WorkspaceClearModal = memo(function WorkspaceClearModal({
  open, onClose, onConfirm,
}: WorkspaceClearModalProps) {
  if (!open) return null;
  return (
    <div role="dialog" aria-modal="true"
      style={{ position: "fixed", inset: 0, zIndex: Z_INDEX.MODAL, background: "rgba(0,0,0,0.55)", display: "flex", alignItems: "center", justifyContent: "center", padding: "0 20px" }}
      onClick={onClose}>
      <div onClick={e => e.stopPropagation()}
        style={{ background: "rgba(8,8,22,0.82)", border: "1px solid rgba(255,255,255,0.09)", borderRadius: 14, padding: "20px 24px", maxWidth: 320, width: "100%" }}>
        <p style={{ color: "#d0d0f0", margin: "0 0 18px", fontSize: "0.9rem", lineHeight: 1.5 }}>
          Eliminare <strong>tutte</strong> le conversazioni?{" "}L&apos;azione è irreversibile.
        </p>
        <div style={{ display: "flex", gap: 10, justifyContent: "flex-end" }}>
          <button onClick={onClose} style={modalBtnSecondary}>Annulla</button>
          <button onClick={() => { onClose(); onConfirm(); }} style={modalBtnDanger}>Elimina tutto</button>
        </div>
      </div>
    </div>
  );
});

export default WorkspaceClearModal;
