<div class="ni-detail mb-3">
    <div><label>Client</label><p>{{ $client->name ?? $log->system_name ?? $log->integration_name ?? 'Unknown Client' }}</p></div>
    <div><label>Client Key</label><p><code>{{ $client->client_key ?? 'N/A' }}</code></p></div>
    <div><label>Status</label><p><span class="ni-badge {{ $badge }}">{{ ucfirst($status) }}</span></p></div>
    <div><label>Direction</label><p>{{ ucfirst($log->direction ?: 'outbound') }}</p></div>
    <div><label>Endpoint</label><p>{{ $log->http_method ?: 'GET' }} {{ $log->endpoint ?: '-' }}</p></div>
    <div><label>Route</label><p>{{ $log->route_name ?: 'N/A' }}</p></div>
    <div><label>HTTP Response</label><p>{{ $log->response_code ?: 'N/A' }}</p></div>
    <div><label>IP Address</label><p>{{ $log->ip_address ?: 'N/A' }}</p></div>
    <div><label>Forwarded For</label><p>{{ $log->forwarded_for ?: 'N/A' }}</p></div>
    <div><label>Where</label><p>{{ trim(($log->geo_city ?: '').' '.($log->geo_country ?: '')) ?: 'Not resolved' }}</p></div>
    <div><label>Started</label><p>{{ $log->request_started_at ? \Carbon\Carbon::parse($log->request_started_at)->format('d M Y H:i:s') : optional($log->created_at)->format('d M Y H:i:s') }}</p></div>
    <div><label>Completed</label><p>{{ $log->request_completed_at ? \Carbon\Carbon::parse($log->request_completed_at)->format('d M Y H:i:s') : 'N/A' }}</p></div>
    <div><label>Duration</label><p>{{ $log->duration_ms !== null ? number_format($log->duration_ms).' ms' : 'N/A' }}</p></div>
    <div><label>Response Size</label><p>{{ $log->response_size_bytes ? number_format($log->response_size_bytes).' bytes' : 'N/A' }}</p></div>
    <div><label>Records Returned</label><p>{{ $log->response_record_count !== null ? number_format($log->response_record_count) : 'N/A' }}</p></div>
    <div><label>Signed Request</label><p>{{ $log->is_signed_request ? 'Yes' : 'No' }} / {{ $log->signature_status ?: 'N/A' }}</p></div>
    <div><label>Encrypted Payload</label><p>{{ $log->is_encrypted_payload ? 'Yes' : 'No' }}</p></div>
    <div><label>Rate Limit</label><p>{{ $log->rate_limit_per_minute ?: 'N/A' }}/min, remaining {{ $log->rate_limit_remaining ?? 'N/A' }}</p></div>
    <div><label>Data Scope</label><p>{{ $log->data_scope ?: 'N/A' }}</p></div>
    <div><label>Allowed Districts</label><p>{{ $log->allowed_district_ids ?: 'N/A' }}</p></div>
    <div><label>Partner ID</label><p>{{ $log->partner_id ?: 'N/A' }}</p></div>
    <div><label>Request ID</label><p>{{ $log->request_id ?: 'N/A' }}</p></div>
</div>
@if(!empty($log->error_message))
    <div class="alert alert-danger"><strong>Error Message:</strong><br>{{ $log->error_message }}</div>
@endif
<div class="row">
    <div class="col-md-6 mb-3"><div class="ni-code-panel"><div class="ni-code-title">Data Accessed Summary</div><pre>{{ $log->data_accessed ?: 'No data access summary captured.' }}</pre></div></div>
    <div class="col-md-6 mb-3"><div class="ni-code-panel"><div class="ni-code-title">Request Query</div><pre>{{ $log->request_query_preview ?: 'No query captured.' }}</pre></div></div>
    <div class="col-md-6 mb-3"><div class="ni-code-panel"><div class="ni-code-title">Safe Request Headers</div><pre>{{ $log->request_headers_preview ?: 'No headers captured.' }}</pre></div></div>
    <div class="col-md-6 mb-3"><div class="ni-code-panel"><div class="ni-code-title">Response Summary</div><pre>{{ $log->response_body_preview ?: 'No response preview captured.' }}</pre></div></div>
    <div class="col-md-12 mb-3"><div class="ni-code-panel"><div class="ni-code-title">Request Payload Preview / Hash</div><pre>{{ $log->request_payload_preview ?: 'No request preview captured.' }}</pre></div></div>
</div>
