function WritePrescriptionModal({ handleAddPrescriptionSubmit, inventory, rxForm, setRxForm, setShowPrescriptionModal, 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-md w-full p-8 shadow-2xl text-brand-harbor">
                <div className="flex items-center justify-between mb-6">
                    <h3 className="text-xl font-bold text-brand-harbor">{strings.writeRx}</h3>
                    <button onClick={() => setShowPrescriptionModal(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>
                <form onSubmit={handleAddPrescriptionSubmit} className="space-y-4">
                    <div>
                        <label className="block text-xs font-bold uppercase text-brand-steel mb-1.5">{strings.itemName}</label>
                        <select 
                            value={rxForm.selectedItem} 
                            onChange={e => setRxForm({...rxForm, selectedItem: e.target.value})} 
                            required
                            className="w-full px-4 py-3 rounded-2xl bg-brand-linen/50 border border-brand-dune text-brand-harbor text-sm font-medium focus:outline-none focus:ring-2 focus:ring-brand-sky focus:bg-white"
                        >
                            <option value="">{strings.selectMedication}</option>
                            {inventory.map(i => (
                                <option key={i.id} value={i.name}>{i.name} ({strings.stockWord}: {i.stock})</option>
                            ))}
                            <option value="others">{strings.otherMedication}</option>
                        </select>
                    </div>
                    {rxForm.selectedItem === 'others' && (
                        <div>
                            <label className="block text-xs font-bold uppercase text-brand-steel mb-1.5">{strings.customMedName}</label>
                            <input 
                                type="text" 
                                required
                                value={rxForm.customMedication} 
                                onChange={e => setRxForm({...rxForm, customMedication: e.target.value})} 
                                placeholder={strings.enterMedName}
                                className="w-full px-4 py-3 rounded-2xl bg-brand-linen/50 border border-brand-dune text-brand-harbor text-sm font-medium focus:outline-none focus:ring-2 focus:ring-brand-sky focus:bg-white"
                            />
                        </div>
                    )}
                    <div>
                        <label className="block text-xs font-bold uppercase text-brand-steel mb-1.5">{strings.dosage}</label>
                        <input 
                            type="text" 
                            required
                            value={rxForm.dosage} 
                            onChange={e => setRxForm({...rxForm, dosage: e.target.value})} 
                            placeholder={strings.dosagePlaceholder}
                            className="w-full px-4 py-3 rounded-2xl bg-brand-linen/50 border border-brand-dune text-brand-harbor text-sm font-medium focus:outline-none focus:ring-2 focus:ring-brand-sky focus:bg-white"
                        />
                    </div>
                    <div>
                        <label className="block text-xs font-bold uppercase text-brand-steel mb-1.5">{strings.instructions}</label>
                        <textarea 
                            value={rxForm.instructions} 
                            onChange={e => setRxForm({...rxForm, instructions: e.target.value})} 
                            placeholder={strings.instructionsPlaceholder}
                            className="w-full px-4 py-3 rounded-2xl bg-brand-linen/50 border border-brand-dune text-brand-harbor text-sm font-medium focus:outline-none focus:ring-2 focus:ring-brand-sky focus:bg-white"
                        ></textarea>
                    </div>
                    <div className="flex justify-end space-x-3 rtl:space-x-reverse pt-4 border-t border-brand-dune/30">
                        <button type="button" onClick={() => setShowPrescriptionModal(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="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.issueRx}</button>
                    </div>
                </form>
            </div>
        </div>
        </>
    );
}
