@php
    $schedule = json_decode($section->getSetting('schedule_data', '[]'), true) ?? [];
    $days = ['السبت', 'الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة'];
@endphp

<div class="site-section">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        <div class="text-center mb-12 reveal">
            <h2 class="section-title mx-auto">{{ $section->title ?? 'مواعيد التدريب' }}</h2>
            @if($section->subtitle)
                <p class="mt-4 text-white/60 text-lg">{{ $section->subtitle }}</p>
            @endif
        </div>

        @if(count($schedule))
            <div class="overflow-x-auto reveal">
                <table class="w-full text-sm">
                    <thead>
                        <tr class="border-b border-white/10">
                            <th class="py-3 px-4 text-start text-white/50 font-medium">اليوم</th>
                            <th class="py-3 px-4 text-start text-white/50 font-medium">النشاط</th>
                            <th class="py-3 px-4 text-start text-white/50 font-medium">الوقت</th>
                            <th class="py-3 px-4 text-start text-white/50 font-medium">الفرع</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($schedule as $row)
                            <tr class="border-b border-white/5 hover:bg-white/5 transition-colors">
                                <td class="py-3 px-4 text-white font-medium">{{ $row['day'] ?? '' }}</td>
                                <td class="py-3 px-4 text-white/70">{{ $row['activity'] ?? '' }}</td>
                                <td class="py-3 px-4 text-white/70" dir="ltr">{{ $row['time'] ?? '' }}</td>
                                <td class="py-3 px-4 text-white/70">{{ $row['branch'] ?? '' }}</td>
                            </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        @else
            @if($section->content)
                <div class="text-center text-white/60 leading-relaxed reveal">
                    {!! nl2br(e($section->content)) !!}
                </div>
            @else
                <div class="text-center text-white/40 py-8 reveal">
                    <p>تواصل معنا للاستفسار عن مواعيد التدريب</p>
                </div>
            @endif
        @endif
    </div>
</div>
