import React from 'react';

export default function Modal({ children, show, onClose, maxWidth = '2xl' }) {
    if (!show) return null;

    return (
        <div className="fixed inset-0 z-50 overflow-y-auto">
            <div className="flex items-center justify-center min-h-screen p-4">
                <div
                    className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"
                    onClick={onClose}
                ></div>

                <div className={`relative bg-white rounded-lg shadow-xl w-full max-w-${maxWidth}`}>
                    {children}
                </div>
            </div>
        </div>
    );
}
