
import React from 'react';
import { X } from 'lucide-react';
import { Button } from '@/components/ui/button';

interface SummaryPanelProps {
  summary: string;
  isVisible: boolean;
  onClose: () => void;
}

const SummaryPanel = ({ summary, isVisible, onClose }: SummaryPanelProps) => {
  if (!isVisible) return null;

  return (
    <div className="fixed top-52 left-4 z-[9999] bg-white rounded-lg shadow-lg border border-gray-200 p-4 w-80 max-h-40 overflow-auto">
      <div className="flex items-center justify-between mb-3">
        <div className="font-semibold text-sm text-gray-700">Page Summary</div>
        <Button variant="ghost" size="sm" onClick={onClose} className="p-1 h-auto">
          <X className="w-4 h-4" />
        </Button>
      </div>
      <pre className="text-xs font-mono text-gray-600 whitespace-pre-wrap bg-gray-50 p-3 rounded border-l-4 border-blue-500">
        {summary}
      </pre>
    </div>
  );
};

export default SummaryPanel;
