{# Journal entries list partial #}
{% if entries %}
  <div class="list-group list-group-flush">
    {% for entry in entries %}
    <div class="list-group-item journal-entry {{ entry.outcome.value }} p-3"
         hx-get="/self-coding/journal/{{ entry.id }}/detail"
         hx-target="#journal-detail-{{ entry.id }}"
         hx-swap="innerHTML"
         style="cursor: pointer;">
      
      <div class="d-flex justify-content-between align-items-start mb-2">
        <div class="d-flex align-items-center gap-2">
          {# Outcome icon #}
          {% if entry.outcome.value == 'success' %}
            <span class="badge bg-success">✓</span>
          {% elif entry.outcome.value == 'failure' %}
            <span class="badge bg-danger">✗</span>
          {% else %}
            <span class="badge bg-warning text-dark">↩</span>
          {% endif %}
          
          <span class="text-muted small">
            #{{ entry.id }}
          </span>
        </div>
        
        <small class="text-muted">
          {{ entry.timestamp.strftime('%Y-%m-%d %H:%M') if entry.timestamp else 'Unknown' }}
        </small>
      </div>
      
      <p class="mb-1 fw-medium">{{ entry.task_description }}</p>
      
      <div class="d-flex justify-content-between align-items-center">
        <div class="small text-muted">
          {% if entry.files_modified %}
            <span class="me-2">📁 {{ entry.files_modified|length }} file(s)</span>
          {% endif %}
          
          {% if entry.retry_count > 0 %}
            <span class="me-2">🔄 {{ entry.retry_count }} retries</span>
          {% endif %}
          
          {% if entry.reflection %}
            <span title="Has reflection">💡</span>
          {% endif %}
        </div>
        
        <span class="badge {% if entry.outcome.value == 'success' %}bg-success{% elif entry.outcome.value == 'failure' %}bg-danger{% else %}bg-warning text-dark{% endif %}">
          {{ entry.outcome.value|upper }}
        </span>
      </div>
      
      {# Detail container - populated on click #}
      <div id="journal-detail-{{ entry.id }}" class="mt-3"></div>
    </div>
    {% endfor %}
  </div>
{% else %}
  <div class="text-center py-5 text-muted">
    <p class="mb-0">No journal entries found.</p>
    <small>Self-edit attempts will appear here.</small>
  </div>
{% endif %}
