function AssessmentModal({ assessmentData, handlePrintAssessment, handleSaveAndPrintAssessment, handleSaveAssessment, lang, selectedPatient, setAssessmentData, setShowAssessmentModal, strings }) {
    return (
        <>
        <div className="fixed inset-0 bg-brand-harbor/60 backdrop-blur-md z-50 flex items-center justify-center p-4">
            <div className="bg-white border border-brand-dune/80 rounded-3xl max-w-4xl w-full p-8 shadow-2xl text-brand-harbor max-h-[90vh] overflow-y-auto">
                <div className="flex items-center justify-between mb-6 border-b border-brand-dune/30 pb-4">
                    <div>
                        <h3 className="text-2xl font-extrabold text-brand-harbor">{strings.patientAssessment}</h3>
                        <p className="text-xs text-brand-steel font-medium">{selectedPatient.name} • {selectedPatient.age} yrs • {selectedPatient.phone}</p>
                    </div>
                    <div className="flex items-center gap-2">
                        <button type="button" onClick={handlePrintAssessment} className="px-3.5 h-8 bg-brand-harbor text-white rounded-xl text-xs font-bold hover:bg-brand-sky transition-all inline-flex items-center gap-1.5">
                            <i data-lucide="printer" className="w-4 h-4"></i>
                            <span>{strings.print}</span>
                        </button>
                        <button onClick={() => setShowAssessmentModal(false)} className="w-8 h-8 rounded-full bg-brand-linen hover:bg-brand-dune/40 flex items-center justify-center text-brand-steel">✕</button>
                    </div>
                </div>

                <form onSubmit={handleSaveAssessment} className="space-y-6">
                    <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
                        <div className="p-4 rounded-2xl bg-brand-linen/50 border border-brand-dune/70 space-y-2">
                            <h4 className="text-xs font-extrabold uppercase text-brand-harbor tracking-wider border-b border-brand-dune/40 pb-1">01 | BODY COMPOSITION</h4>
                            <div className="grid grid-cols-2 gap-2 text-xs">
                                <input placeholder="Weight" value={assessmentData.bodyComp.weight} onChange={e => setAssessmentData({...assessmentData, bodyComp: {...assessmentData.bodyComp, weight: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Height" value={assessmentData.bodyComp.height} onChange={e => setAssessmentData({...assessmentData, bodyComp: {...assessmentData.bodyComp, height: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="BMI" value={assessmentData.bodyComp.bmi} onChange={e => setAssessmentData({...assessmentData, bodyComp: {...assessmentData.bodyComp, bmi: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Body Fat" value={assessmentData.bodyComp.bodyFat} onChange={e => setAssessmentData({...assessmentData, bodyComp: {...assessmentData.bodyComp, bodyFat: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Muscle Mass" value={assessmentData.bodyComp.muscleMass} onChange={e => setAssessmentData({...assessmentData, bodyComp: {...assessmentData.bodyComp, muscleMass: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Visceral Fat" value={assessmentData.bodyComp.visceralFat} onChange={e => setAssessmentData({...assessmentData, bodyComp: {...assessmentData.bodyComp, visceralFat: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Waist" value={assessmentData.bodyComp.waist} onChange={e => setAssessmentData({...assessmentData, bodyComp: {...assessmentData.bodyComp, waist: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs col-span-2" />
                            </div>
                        </div>

                        <div className="p-4 rounded-2xl bg-brand-linen/50 border border-brand-dune/70 space-y-2">
                            <h4 className="text-xs font-extrabold uppercase text-brand-harbor tracking-wider border-b border-brand-dune/40 pb-1">02 | WEIGHT HISTORY</h4>
                            <div className="space-y-2 text-xs">
                                <input placeholder="Current Weight" value={assessmentData.weightHistory.currentWeight} onChange={e => setAssessmentData({...assessmentData, weightHistory: {...assessmentData.weightHistory, currentWeight: e.target.value}})} className="w-full p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Highest Weight" value={assessmentData.weightHistory.highestWeight} onChange={e => setAssessmentData({...assessmentData, weightHistory: {...assessmentData.weightHistory, highestWeight: e.target.value}})} className="w-full p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Previous Weight Loss" value={assessmentData.weightHistory.previousLoss} onChange={e => setAssessmentData({...assessmentData, weightHistory: {...assessmentData.weightHistory, previousLoss: e.target.value}})} className="w-full p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Weight Regain" value={assessmentData.weightHistory.regain} onChange={e => setAssessmentData({...assessmentData, weightHistory: {...assessmentData.weightHistory, regain: e.target.value}})} className="w-full p-2 rounded-xl border border-brand-dune text-xs" />
                            </div>
                        </div>

                        <div className="p-4 rounded-2xl bg-brand-linen/50 border border-brand-dune/70 space-y-2">
                            <h4 className="text-xs font-extrabold uppercase text-brand-harbor tracking-wider border-b border-brand-dune/40 pb-1">03 | MEDICAL HISTORY</h4>
                            <div className="space-y-2 text-xs">
                                <input placeholder="Medical Conditions" value={assessmentData.medicalHistory.conditions} onChange={e => setAssessmentData({...assessmentData, medicalHistory: {...assessmentData.medicalHistory, conditions: e.target.value}})} className="w-full p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Surgeries" value={assessmentData.medicalHistory.surgeries} onChange={e => setAssessmentData({...assessmentData, medicalHistory: {...assessmentData.medicalHistory, surgeries: e.target.value}})} className="w-full p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Current Medications" value={assessmentData.medicalHistory.medications} onChange={e => setAssessmentData({...assessmentData, medicalHistory: {...assessmentData.medicalHistory, medications: e.target.value}})} className="w-full p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Allergies" value={assessmentData.medicalHistory.allergies} onChange={e => setAssessmentData({...assessmentData, medicalHistory: {...assessmentData.medicalHistory, allergies: e.target.value}})} className="w-full p-2 rounded-xl border border-brand-dune text-xs" />
                            </div>
                        </div>

                        <div className="p-4 rounded-2xl bg-brand-linen/50 border border-brand-dune/70 space-y-2">
                            <h4 className="text-xs font-extrabold uppercase text-brand-harbor tracking-wider border-b border-brand-dune/40 pb-1">04 | LIFESTYLE & NUTRITION</h4>
                            <div className="grid grid-cols-2 gap-2 text-xs">
                                <input placeholder="Meals" value={assessmentData.lifestyle.meals} onChange={e => setAssessmentData({...assessmentData, lifestyle: {...assessmentData.lifestyle, meals: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Snacks" value={assessmentData.lifestyle.snacks} onChange={e => setAssessmentData({...assessmentData, lifestyle: {...assessmentData.lifestyle, snacks: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Water Intake" value={assessmentData.lifestyle.water} onChange={e => setAssessmentData({...assessmentData, lifestyle: {...assessmentData.lifestyle, water: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Physical Activity" value={assessmentData.lifestyle.activity} onChange={e => setAssessmentData({...assessmentData, lifestyle: {...assessmentData.lifestyle, activity: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Sleep" value={assessmentData.lifestyle.sleep} onChange={e => setAssessmentData({...assessmentData, lifestyle: {...assessmentData.lifestyle, sleep: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Eating Habits" value={assessmentData.lifestyle.habits} onChange={e => setAssessmentData({...assessmentData, lifestyle: {...assessmentData.lifestyle, habits: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                            </div>
                        </div>

                        <div className="p-4 rounded-2xl bg-brand-linen/50 border border-brand-dune/70 space-y-2">
                            <h4 className="text-xs font-extrabold uppercase text-brand-harbor tracking-wider border-b border-brand-dune/40 pb-1">05 | PREVIOUS TREATMENT</h4>
                            <div className="space-y-2 text-xs">
                                <input placeholder="Previous Diets" value={assessmentData.prevTreatment.diets} onChange={e => setAssessmentData({...assessmentData, prevTreatment: {...assessmentData.prevTreatment, diets: e.target.value}})} className="w-full p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Weight-loss Medications" value={assessmentData.prevTreatment.meds} onChange={e => setAssessmentData({...assessmentData, prevTreatment: {...assessmentData.prevTreatment, meds: e.target.value}})} className="w-full p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Response" value={assessmentData.prevTreatment.response} onChange={e => setAssessmentData({...assessmentData, prevTreatment: {...assessmentData.prevTreatment, response: e.target.value}})} className="w-full p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Side Effects" value={assessmentData.prevTreatment.sideEffects} onChange={e => setAssessmentData({...assessmentData, prevTreatment: {...assessmentData.prevTreatment, sideEffects: e.target.value}})} className="w-full p-2 rounded-xl border border-brand-dune text-xs" />
                            </div>
                        </div>

                        <div className="p-4 rounded-2xl bg-brand-linen/50 border border-brand-dune/70 space-y-2">
                            <h4 className="text-xs font-extrabold uppercase text-brand-harbor tracking-wider border-b border-brand-dune/40 pb-1">06 | LABS & RISK FACTORS</h4>
                            <div className="grid grid-cols-2 gap-2 text-xs">
                                <input placeholder="HbA1c" value={assessmentData.labs.hba1c} onChange={e => setAssessmentData({...assessmentData, labs: {...assessmentData.labs, hba1c: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Glucose" value={assessmentData.labs.glucose} onChange={e => setAssessmentData({...assessmentData, labs: {...assessmentData.labs, glucose: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Lipids" value={assessmentData.labs.lipids} onChange={e => setAssessmentData({...assessmentData, labs: {...assessmentData.labs, lipids: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="TSH" value={assessmentData.labs.tsh} onChange={e => setAssessmentData({...assessmentData, labs: {...assessmentData.labs, tsh: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs" />
                                <input placeholder="Liver/Kidney Func" value={assessmentData.labs.organFunc} onChange={e => setAssessmentData({...assessmentData, labs: {...assessmentData.labs, organFunc: e.target.value}})} className="p-2 rounded-xl border border-brand-dune text-xs col-span-2" />
                            </div>
                        </div>
                    </div>

                    <div className="grid grid-cols-1 md:grid-cols-2 gap-6 pt-4 border-t border-brand-dune/40">
                        <div className="space-y-3">
                            <h4 className="text-xs font-extrabold uppercase text-brand-harbor">DOCTOR'S ASSESSMENT</h4>
                            <div>
                                <label className="text-[11px] font-bold text-brand-steel">Main Concern:</label>
                                <textarea value={assessmentData.doctorAssessment.mainConcern} onChange={e => setAssessmentData({...assessmentData, doctorAssessment: {...assessmentData.doctorAssessment, mainConcern: e.target.value}})} className="w-full p-2.5 rounded-xl border border-brand-dune text-xs"></textarea>
                            </div>
                            <div>
                                <label className="text-[11px] font-bold text-brand-steel">Patient Goal:</label>
                                <textarea value={assessmentData.doctorAssessment.patientGoal} onChange={e => setAssessmentData({...assessmentData, doctorAssessment: {...assessmentData.doctorAssessment, patientGoal: e.target.value}})} className="w-full p-2.5 rounded-xl border border-brand-dune text-xs"></textarea>
                            </div>
                            <div>
                                <label className="text-[11px] font-bold text-brand-steel">Clinical Assessment:</label>
                                <textarea value={assessmentData.doctorAssessment.clinicalAssessment} onChange={e => setAssessmentData({...assessmentData, doctorAssessment: {...assessmentData.doctorAssessment, clinicalAssessment: e.target.value}})} className="w-full p-2.5 rounded-xl border border-brand-dune text-xs"></textarea>
                            </div>
                        </div>

                        <div className="space-y-3">
                            <h4 className="text-xs font-extrabold uppercase text-brand-harbor">MANAGEMENT PLAN</h4>
                            <div className="grid grid-cols-2 gap-2 text-xs">
                                <label className="flex items-center space-x-2 rtl:space-x-reverse bg-brand-linen/40 p-2 rounded-xl border border-brand-dune/60">
                                    <input type="checkbox" checked={assessmentData.managementPlan.nutritionPlan} onChange={e => setAssessmentData({...assessmentData, managementPlan: {...assessmentData.managementPlan, nutritionPlan: e.target.checked}})} />
                                    <span>Nutrition Plan</span>
                                </label>
                                <label className="flex items-center space-x-2 rtl:space-x-reverse bg-brand-linen/40 p-2 rounded-xl border border-brand-dune/60">
                                    <input type="checkbox" checked={assessmentData.managementPlan.lifestyleMod} onChange={e => setAssessmentData({...assessmentData, managementPlan: {...assessmentData.managementPlan, lifestyleMod: e.target.checked}})} />
                                    <span>Lifestyle Modification</span>
                                </label>
                                <label className="flex items-center space-x-2 rtl:space-x-reverse bg-brand-linen/40 p-2 rounded-xl border border-brand-dune/60">
                                    <input type="checkbox" checked={assessmentData.managementPlan.pharmacotherapy} onChange={e => setAssessmentData({...assessmentData, managementPlan: {...assessmentData.managementPlan, pharmacotherapy: e.target.checked}})} />
                                    <span>Pharmacotherapy</span>
                                </label>
                                <label className="flex items-center space-x-2 rtl:space-x-reverse bg-brand-linen/40 p-2 rounded-xl border border-brand-dune/60">
                                    <input type="checkbox" checked={assessmentData.managementPlan.nutritionPharm} onChange={e => setAssessmentData({...assessmentData, managementPlan: {...assessmentData.managementPlan, nutritionPharm: e.target.checked}})} />
                                    <span>Nutrition + Pharm</span>
                                </label>
                                <label className="flex items-center space-x-2 rtl:space-x-reverse bg-brand-linen/40 p-2 rounded-xl border border-brand-dune/60">
                                    <input type="checkbox" checked={assessmentData.managementPlan.investigations} onChange={e => setAssessmentData({...assessmentData, managementPlan: {...assessmentData.managementPlan, investigations: e.target.checked}})} />
                                    <span>Further Investigations</span>
                                </label>
                                <label className="flex items-center space-x-2 rtl:space-x-reverse bg-brand-linen/40 p-2 rounded-xl border border-brand-dune/60">
                                    <input type="checkbox" checked={assessmentData.managementPlan.followUp} onChange={e => setAssessmentData({...assessmentData, managementPlan: {...assessmentData.managementPlan, followUp: e.target.checked}})} />
                                    <span>Follow-up</span>
                                </label>
                            </div>
                            <div>
                                <label className="text-[11px] font-bold text-brand-steel">Treatment Plan:</label>
                                <textarea value={assessmentData.managementPlan.treatmentPlan} onChange={e => setAssessmentData({...assessmentData, managementPlan: {...assessmentData.managementPlan, treatmentPlan: e.target.value}})} className="w-full p-2.5 rounded-xl border border-brand-dune text-xs"></textarea>
                            </div>
                            <div>
                                <label className="text-[11px] font-bold text-brand-steel">Follow-up Period / Date:</label>
                                <input value={assessmentData.managementPlan.followUpDays} onChange={e => setAssessmentData({...assessmentData, managementPlan: {...assessmentData.managementPlan, followUpDays: e.target.value}})} placeholder="e.g. 14 days" className="w-full p-2 rounded-xl border border-brand-dune text-xs" />
                            </div>
                        </div>
                    </div>

                    <div className="flex flex-wrap justify-end gap-2 pt-4 border-t border-brand-dune/30">
                        <button type="button" onClick={() => setShowAssessmentModal(false)} className="px-5 py-2.5 rounded-2xl text-sm font-semibold text-brand-steel hover:bg-brand-linen">{strings.cancel}</button>
                        <button type="button" onClick={handlePrintAssessment} className="px-5 py-2.5 rounded-2xl text-sm font-bold bg-white border border-brand-dune text-brand-harbor hover:bg-brand-linen inline-flex items-center gap-1.5"><i data-lucide="printer" className="w-4 h-4"></i><span>{strings.print}</span></button>
                        <button type="button" onClick={handleSaveAndPrintAssessment} className="px-5 py-2.5 rounded-2xl text-sm font-bold bg-white border border-brand-harbor text-brand-harbor hover:bg-brand-linen">{lang === 'ar' ? 'حفظ وطباعة' : 'Save & Print'}</button>
                        <button type="submit" className="px-5 py-2.5 rounded-2xl text-sm font-bold bg-brand-harbor hover:bg-brand-sky text-white shadow-md">{strings.saveAssessment}</button>
                    </div>
                </form>
            </div>
        </div>
        </>
    );
}
