function AppointmentsTab({ appointmentSearch, appointments, filteredAppointments, handleDeleteItem, handleUpdateAppointmentStatus, lang, setAppointmentSearch, strings }) {
    return (
        <>
                            <div className="space-y-6">
                                <div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
                                    <div>
                                        <h2 className="text-2xl font-extrabold text-brand-harbor">{lang === 'ar' ? 'مواعيد العيادة وقائمة الانتظار' : 'Clinic Appointments & Queue'}</h2>
                                        <p className="text-brand-steel text-sm font-medium">{lang === 'ar' ? 'عرض المواعيد المجدولة والحجوزات القادمة من المساعدة بشكل مباشر.' : 'View real-time appointments booked by your assistant.'}</p>
                                    </div>
                                </div>

                                <div className="bg-white p-4 rounded-2xl border border-brand-dune/80 shadow-sm flex items-center space-x-3 rtl:space-x-reverse">
                                    <i data-lucide="search" className="w-5 h-5 text-brand-steel"></i>
                                    <input 
                                        type="text"
                                        value={appointmentSearch}
                                        onChange={(e) => setAppointmentSearch(e.target.value)}
                                        placeholder={strings.searchAppointments}
                                        className="w-full bg-transparent text-brand-harbor placeholder-brand-steel/70 focus:outline-none text-sm font-medium"
                                    />
                                    {appointmentSearch && (
                                        <button onClick={() => setAppointmentSearch('')} className="text-brand-steel hover:text-brand-harbor text-xs font-bold">{strings.clear}</button>
                                    )}
                                </div>

                                <div className="bg-white rounded-3xl border border-brand-dune/80 shadow-md overflow-hidden">
                                    <div className="overflow-x-auto">
                                        <table className="rt w-full text-left rtl:text-right border-collapse">
                                            <thead>
                                                <tr className="bg-brand-linen/60 border-b border-brand-dune text-brand-steel text-xs font-bold uppercase tracking-wider">
                                                    <th className="py-4 px-6">{strings.patientName}</th>
                                                    <th className="py-4 px-6">{strings.doctor}</th>
                                                    <th className="py-4 px-6">{strings.date}</th>
                                                    <th className="py-4 px-6">{strings.time}</th>
                                                    <th className="py-4 px-6">{strings.status}</th>
                                                    <th className="py-4 px-6 text-right rtl:text-left">{strings.actions}</th>
                                                </tr>
                                            </thead>
                                            <tbody className="divide-y divide-brand-dune/30 text-sm">
                                                {filteredAppointments.length === 0 ? (
                                                    <tr>
                                                        <td colSpan="6" className="py-12 text-center text-brand-steel">{lang === 'ar' ? 'لم يتم العثور على مواعيد مطابقة.' : 'No appointments found in queue.'}</td>
                                                    </tr>
                                                ) : (
                                                    filteredAppointments.map(apt => (
                                                        <tr key={apt.id} className="hover:bg-brand-linen/50 transition-colors">
                                                            <td data-label={strings.patientName} className="py-4 px-6 font-bold text-brand-harbor">{apt.patientName}</td>
                                                            <td data-label={strings.doctor} className="py-4 px-6 font-medium text-brand-steel">{apt.doctorName || 'Doctor'}</td>
                                                            <td data-label={strings.date} className="py-4 px-6 text-brand-harbor/80 font-medium">{apt.date}</td>
                                                            <td data-label={strings.time} className="py-4 px-6 font-bold text-brand-steel">{apt.time}</td>
                                                            <td data-label={strings.status} className="py-4 px-6">
                                                                <span className={`px-3.5 py-1.5 rounded-xl text-xs font-bold border ${
                                                                    apt.status === 'Confirmed' ? 'bg-brand-dune/30 text-brand-harbor border-brand-dune' :
                                                                    apt.status === 'Completed' ? 'bg-emerald-50 text-emerald-800 border-emerald-200' :
                                                                    apt.status === 'Cancelled' ? 'bg-rose-50 text-rose-800 border-rose-200' : 'bg-amber-50 text-amber-800 border-amber-200'
                                                                }`}>
                                                                    {apt.status}
                                                                </span>
                                                            </td>
                                                            <td className="py-4 px-6 text-right rtl:text-left whitespace-nowrap rt-actions"><div className="flex items-center justify-end gap-2 flex-nowrap">
                                                                <select 
                                                                    value={apt.status}
                                                                    onChange={(e) => handleUpdateAppointmentStatus(apt.id, e.target.value)}
                                                                    className="px-2.5 py-1 rounded-xl bg-brand-linen text-brand-harbor text-xs font-bold border border-brand-dune/80 focus:outline-none focus:ring-1 focus:ring-brand-sky"
                                                                >
                                                                    <option value="Waiting">Waiting</option>
                                                                    <option value="Confirmed">Confirmed</option>
                                                                    <option value="Completed">Completed</option>
                                                                    <option value="Cancelled">Cancelled</option>
                                                                </select>
                                                                <button onClick={() => handleDeleteItem("appointments", apt.id)} className="w-9 h-9 inline-flex items-center justify-center rounded-xl text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-500 hover:text-white hover:border-rose-500">
                                                                    <i data-lucide="trash-2" className="w-4 h-4"></i>
                                                                </button>
                                                            </div></td>
                                                        </tr>
                                                    ))
                                                )}
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
        </>
    );
}
