"use client";

import React from "react";

interface Props {
  isOpen: boolean;
  threadTitle: string;
  isDeleting: boolean;
  onConfirm: () => void;
  onCancel: () => void;
}

export default function DeleteConfirmDialog({
  isOpen,
  threadTitle,
  isDeleting,
  onConfirm,
  onCancel,
}: Props) {
  if (!isOpen) return null;

  return (
    <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 px-4 py-4">
      <div className="bg-white rounded-lg shadow-lg max-w-xs w-full animate-fade-in">
        {/* Header */}
        <div className="px-4 py-3 border-b bg-slate-50">
          <h3 className="text-sm font-semibold text-gray-800">Delete Conversation?</h3>
        </div>

        {/* Content */}
        <div className="px-4 py-3">
          <p className="text-sm text-gray-600 mb-2">Are you sure you want to delete this conversation?</p>
          <p className="text-xs text-gray-500 truncate line-clamp-2 bg-gray-50 p-2 rounded">
            {threadTitle}
          </p>
        </div>

        {/* Footer */}
        <div className="px-4 py-3 border-t flex gap-2 justify-end">
          <button
            onClick={onCancel}
            disabled={isDeleting}
            className="px-3 py-1 text-sm text-gray-600 hover:bg-gray-100 rounded transition-colors disabled:opacity-50"
          >
            Cancel
          </button>
          <button
            onClick={onConfirm}
            disabled={isDeleting}
            className="px-3 py-1 text-sm text-white bg-red-600 hover:bg-red-700 rounded transition-colors disabled:opacity-50 disabled:cursor-wait"
          >
            {isDeleting ? "Deleting..." : "Delete"}
          </button>
        </div>
      </div>
    </div>
  );
}
