// ProjectTimelineModal - Modal for viewing/editing project workflow timeline

function ProjectTimelineModal({ project, onClose, onStepChange, canEdit = true, isAssigned = false }) {
    return (
        <div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4">
            <div className="bg-white rounded-xl shadow-xl max-w-5xl w-full max-h-[90vh] flex flex-col">
                <div className="flex items-center justify-between p-6 border-b border-slate-200">
                    <div>
                        <h3 className="text-lg font-semibold text-slate-800">Workflow Pratica</h3>
                        <p className="text-sm text-slate-500 mt-1">{project.name}</p>
                    </div>
                    <button onClick={onClose} className="text-slate-400 hover:text-slate-600">
                        <svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
                        </svg>
                    </button>
                </div>

                <div className="flex-1 overflow-hidden p-6">
                    <ProjectTimeline
                        key={project.id}
                        projectId={project.id}
                        canEdit={canEdit}
                        isAssigned={isAssigned}
                        isCancelled={project.is_cancelled || project.status === 'completed'}
                        onStepChange={onStepChange}
                    />
                </div>

                <div className="p-4 border-t border-slate-200 bg-slate-50">
                    <button
                        onClick={onClose}
                        className="w-full px-4 py-2 bg-slate-200 text-slate-700 font-medium rounded-lg hover:bg-slate-300 transition-colors"
                    >
                        Chiudi
                    </button>
                </div>
            </div>
        </div>
    );
}

window.ProjectTimelineModal = ProjectTimelineModal;

