<div class="section-title">{{ __('Inspecciones') }}</div>

@if(empty($inspections))
    <div class="text-center text-gray-400 py-8">
        <p>{{ __('No hay inspecciones en el rango seleccionado.') }}</p>
    </div>
@else
    <div class="overflow-x-auto">
        <table>
            <thead>
                <tr>
                    <th>ID</th>
                    <th>Elemento</th>
                    <th>Fase</th>
                    <th>Template</th>
                    <th>Inspector</th>
                    <th>Fecha</th>
                    <th>Estado</th>
                    <th>Resultado</th>
                    <th>Notas</th>
                    <th>Fotos</th>
                </tr>
            </thead>
            <tbody>
                @foreach($inspections as $inspection)
                <tr>
                    <td>{{ $inspection['id'] }}</td>
                    <td>{{ $inspection['feature'] }}</td>
                    <td>{{ $inspection['phase'] }}</td>
                    <td>{{ $inspection['template'] }}</td>
                    <td>{{ $inspection['inspector'] }}</td>
                    <td>{{ $inspection['date'] }}</td>
                    <td>
                        <span class="badge badge-{{ match($inspection['status']) {
                            'completed' => 'success',
                            'pending' => 'warning',
                            default => 'ghost'
                        } }}">
                            {{ $inspection['status'] }}
                        </span>
                    </td>
                    <td>
                        @if($inspection['result'])
                            <span class="badge {{ $inspection['result'] === 'pass' ? 'badge-success' : ($inspection['result'] === 'fail' ? 'badge-error' : 'badge-warning') }}">
                                {{ $inspection['result_label'] }}
                            </span>
                        @endif
                    </td>
                    <td class="max-w-xs truncate">{{ $inspection['notes'] ?? '—' }}</td>
                    <td>{{ $inspection['photos_count'] }}</td>
                </tr>
                @endforeach
            </tbody>
        </table>
    </div>
@endif