@php
    $programme = $programmeSnapshot ?? null;
    $linkedItems = $linkedProgrammeItems ?? [];
    $sessionNoun = $sessionNoun ?? 'session';
@endphp

@if(is_array($programme) && ! empty($programme['days']))
    <div class="programme-panel font-sans space-y-5 text-sm">
        @if(! empty($programme['title']))
            <p class="text-xs font-medium text-slate-400">{{ $programme['title'] }}</p>
        @endif

        @if($linkedItems !== [])
            <div>
                <p class="text-[11px] font-semibold uppercase tracking-wide text-violet-400">This session</p>
                <ul class="mt-2 space-y-2">
                    @foreach($linkedItems as $item)
                        <li class="rounded-xl border border-violet-500/30 bg-violet-500/10 px-3 py-2.5">
                            @if(! empty($item['time']))
                                <p class="text-[11px] font-medium text-violet-200/90">{{ $item['time'] }}</p>
                            @endif
                            <p @class(['font-medium text-slate-100', ! empty($item['time']) ? 'mt-0.5' : ''])>{{ $item['title'] ?? 'Item' }}</p>
                            @if(! empty($item['host']))
                                <p class="mt-0.5 text-xs text-slate-400">{{ $item['host'] }}</p>
                            @endif
                        </li>
                    @endforeach
                </ul>
            </div>
        @endif

        @foreach((array) ($programme['days'] ?? []) as $day)
            <section>
                @if(! empty($day['label']) || ! empty($day['date']))
                    <h3 class="text-[11px] font-semibold uppercase tracking-wide text-slate-500">
                        {{ trim(($day['label'] ?? '').' '.($day['date'] ?? '')) }}
                    </h3>
                @endif
                <ul @class(['space-y-2', ! empty($day['label']) || ! empty($day['date']) ? 'mt-2' : ''])>
                    @foreach((array) ($day['items'] ?? []) as $item)
                        <li class="rounded-xl border border-slate-800/80 bg-slate-900/40 px-3 py-2.5">
                            @if(! empty($item['time']))
                                <p class="text-[11px] font-medium text-slate-400">{{ $item['time'] }}</p>
                            @endif
                            <p @class(['font-medium leading-snug text-slate-100', ! empty($item['time']) ? 'mt-0.5' : ''])>{{ $item['title'] ?? '' }}</p>
                            @if(! empty($item['description']))
                                <p class="mt-1 text-xs leading-relaxed text-slate-400">{{ $item['description'] }}</p>
                            @endif
                            @if(! empty($item['location']) || ! empty($item['host']))
                                <p class="mt-1 text-xs text-slate-500">
                                    @if(! empty($item['location'])){{ $item['location'] }}@endif
                                    @if(! empty($item['location']) && ! empty($item['host'])) · @endif
                                    @if(! empty($item['host'])){{ $item['host'] }}@endif
                                </p>
                            @endif
                        </li>
                    @endforeach
                </ul>
            </section>
        @endforeach
    </div>
@else
    <p class="px-2 py-4 text-center font-sans text-xs text-slate-500">No programme linked to this {{ $sessionNoun }} yet.</p>
@endif
