<div class="card">
  <div class="card-body">
    <h5 class="card-title">Search results for "{{ query }}"</h5>

    {% for group_name, items in results.items %}
      {% if items.exists %}
        <h6 class="mt-3">{{ group_name|capfirst }}</h6>
        <ul class="list-unstyled">
          {% for item in items %}
            <li>
              {% if group_name == 'conditions' %}
                <a href="{% url 'atlas:condition_detail' item.pk %}">{{ item.name }}</a>
              {% elif group_name == 'findings' %}
                <a href="{% url 'atlas:finding_detail' item.pk %}">{{ item.name }}</a>
              {% elif group_name == 'structures' %}
                <a href="{% url 'atlas:structure_detail' item.pk %}">{{ item.name }}</a>
              {% elif group_name == 'subspecialties' %}
                <a href="{% url 'atlas:subspecialty_detail' item.pk %}">{{ item.name }}</a>
              {% elif group_name == 'presentations' %}
                <a href="{% url 'atlas:presentation_detail' item.pk %}">{{ item.name }}</a>
              {% elif group_name == 'procedures' %}
                <a href="{% url 'atlas:procedure_detail' item.pk %}">{{ item.name }}</a>
              {% else %}
                {{ item.name }}
              {% endif %}
            </li>
          {% endfor %}
        </ul>
      {% endif %}
    {% endfor %}

    {% if not results.conditions.exists and not results.findings.exists and not results.structures.exists and not results.subspecialties.exists and not results.presentations.exists and not results.procedures.exists %}
      <p class="text-muted">No matches found.</p>
    {% endif %}
  </div>
</div>
