import React from 'react'
import { X } from 'lucide-react'

interface ModalProps {
  isOpen?: boolean
  onClose: () => void
  children: React.ReactNode
  maxWidth?: string
  className?: string
}

export default function Modal({
  isOpen = true,
  onClose,
  maxWidth = "max-w-5xl",
  className = "",
  children
}: ModalProps) {
  if (!isOpen) return null

  return (
    <div
      className="fixed inset-0 z-50 flex items-center justify-center p-4"
      style={{ background: 'rgba(0,0,0,0.45)' }}
      // onClick={e => { if (e.target === e.currentTarget) onClose() }}
    >
      <div className={`bg-white rounded-2xl shadow-2xl w-full ${maxWidth} max-h-[92vh] flex flex-col ${className}`}>

        {children}
      </div>
    </div>
  )
}
