{# partial: list of questions for HTMX search results #}
<div class="list-group">
{% if questions %}
  {% for question in questions %}
    <a href="{{ question.get_absolute_url }}" class="list-group-item list-group-item-action">
      <div class="d-flex w-100 justify-content-between">
        <h6 class="mb-1">{{ question.title|default:question.get_stem_stripped|truncatechars:80 }}</h6>
        <small class="text-muted">#{{ question.pk }}</small>
      </div>

      <div class="mb-1">
        {% if question.author.all %}
          <small class="text-muted me-2">By {{ question.author.all|join:", " }}</small>
        {% endif %}
        {% if question.category %}<span class="badge bg-secondary me-1">{{ question.category.category }}</span>{% endif %}
        {% if question.frcr_appropriate %}<span class="badge bg-info text-dark me-1">FRCR</span>{% endif %}
      </div>

      <div class="mb-1">
        {% for c in question.condition.all|slice:":3" %}
          <span class="badge bg-light text-dark me-1">{{ c.name }}</span>
        {% endfor %}
        {% for p in question.presentation.all|slice:":3" %}
          <span class="badge bg-light text-dark me-1">{{ p.name }}</span>
        {% endfor %}
        {% for s in question.subspecialty.all|slice:":3" %}
          <span class="badge bg-light text-dark me-1">{{ s.name }}</span>
        {% endfor %}
      </div>

      <p class="mb-1 text-truncate">{{ question.stem|striptags|truncatechars:160 }}</p>
    </a>
  {% endfor %}
{% else %}
  <div class="list-group-item">No questions found</div>
{% endif %}
</div>
