{{-- Completed questionnaire detail modal: item-by-item answers + score/severity. --}}
@php
    $q = $response->questionnaire;
    $items = $q ? (array) $q->items : [];
    $answers = (array) $response->answers;
@endphp
<div class="modal-dialog modal-lg" role="document">
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal">&times;</button>
      <h4 class="modal-title">{{ optional($q)->title }} — {{ $patientName }}</h4>
    </div>
    <div class="modal-body">
      <p>
        <strong>@lang('medportal::lang.score'):</strong> {{ $response->score ?? '—' }}
        &nbsp;|&nbsp;
        <strong>@lang('medportal::lang.severity'):</strong>
        {{ $response->severity ? __('medportal::lang.sev_' . $response->severity) : '—' }}
      </p>
      <table class="table table-bordered table-condensed">
        <thead><tr><th>#</th><th>@lang('medportal::lang.questionnaire')</th><th>@lang('medportal::lang.value')</th></tr></thead>
        <tbody>
        @foreach($items as $idx => $item)
          <tr>
            <td>{{ $idx + 1 }}</td>
            <td>{{ $item['q'] ?? '' }}</td>
            <td>{{ $answers[$idx] ?? '—' }}</td>
          </tr>
        @endforeach
        </tbody>
      </table>
    </div>
    <div class="modal-footer">
      <button type="button" class="btn btn-default" data-dismiss="modal">@lang('medportal::lang.cancel')</button>
    </div>
  </div>
</div>
