{% load static %}
{% if user_obj %}
    <div class="card p-2">
        <h5>Content by {{ user_obj.get_full_name }} ({{ user_obj.username }})</h5>

        {% for app_key, info in content.items %}
            <div class="mb-2">
                <strong>{{ info.label }}</strong>
                <div class="small">
                    Questions: {{ info.questions|length }} &nbsp; Exams: {{ info.exams|length }}
                </div>
                <div class="mt-1">
                    {% if info.questions %}
                        <ul class="list-unstyled ms-3">
                            {% for q in info.questions %}
                                <li>
                                    {% comment %} Try to link to app question detail if available {% endcomment %}
                                    <a href="{% url app_key|add:':question_detail' q.pk %}" target="_blank">{{ q }}</a>
                                </li>
                            {% endfor %}
                        </ul>
                    {% endif %}

                    {% if info.exams %}
                        <ul class="list-unstyled ms-3">
                            {% for ex in info.exams %}
                                <li>{{ ex }}</li>
                            {% endfor %}
                        </ul>
                    {% endif %}
                </div>
            </div>
        {% endfor %}

        <div class="mb-2">
            <strong>Atlas Cases</strong>
            <div class="small">Cases: {{ atlas_cases|length }}</div>
            {% if atlas_cases %}
                <ul class="list-unstyled ms-3">
                    {% for case in atlas_cases %}
                        <li><a href="{% url 'atlas:case_detail' case.pk %}" target="_blank">{{ case }}</a></li>
                    {% endfor %}
                </ul>
            {% endif %}
        </div>

        <div class="mb-2">
            <strong>Atlas Collections</strong>
            <div class="small">Collections: {{ atlas_collections|length }}</div>
            {% if atlas_collections %}
                <ul class="list-unstyled ms-3">
                    {% for coll in atlas_collections %}
                        <li><a href="{% url 'atlas:collection_detail' coll.pk %}" target="_blank">{{ coll }}</a></li>
                    {% endfor %}
                </ul>
            {% endif %}
        </div>

    </div>
{% else %}
    <div>No user found</div>
{% endif %}
