@php
    $items = $survey->media ?? [];
@endphp
@if(is_array($items) && count($items) > 0)
    <div class="survey-media-gallery mb-4">
        @foreach($items as $item)
            @php
                $path = is_array($item) ? ($item['path'] ?? '') : $item;
                $type = is_array($item) ? ($item['type'] ?? 'image') : 'image';
                if ($path === '') {
                    continue;
                }
                $url = \Illuminate\Support\Facades\Storage::disk('public')->url($path);
            @endphp
            <div class="survey-media-item mb-3">
                @if($type === 'video')
                    <video class="w-100 rounded" controls playsinline preload="metadata" style="max-height: 320px;">
                        <source src="{{ $url }}" type="video/mp4">
                    </video>
                @else
                    <img src="{{ $url }}" alt="" class="w-100 rounded" style="max-height: 320px; object-fit: contain;">
                @endif
            </div>
        @endforeach
    </div>
@endif
