{% extends "admin/base_admin.html" %}
{% set admin_page = "feedback" %}
{% block title %}Feedback - Admin - {{ config.APP_NAME }}{% endblock %}

{% block admin_content %}
  <header class="flex justify-between items-center mb-8">
    <div>
      <h1 class="text-2xl">Feedback</h1>
      <p class="text-sm text-slate mt-1">{{ feedback_list | length }} submissions shown</p>
    </div>
    <a href="{{ url_for('admin.index') }}" class="btn-outline">Back to Dashboard</a>
  </header>

  {% if feedback_list %}
  <div class="card">
    <table class="table">
      <thead>
        <tr>
          <th>Message</th>
          <th>Page</th>
          <th>User</th>
          <th>Date</th>
        </tr>
      </thead>
      <tbody>
        {% for f in feedback_list %}
        <tr>
          <td style="max-width:400px">
            <p class="text-sm" style="white-space:pre-wrap;word-break:break-word">{{ f.message }}</p>
          </td>
          <td class="text-xs text-slate mono">{{ f.page_url or '-' }}</td>
          <td>
            {% if f.email %}
            <a href="{{ url_for('admin.user_detail', user_id=f.user_id) }}" class="text-sm">{{ f.email }}</a>
            {% else %}
            <span class="text-xs text-slate">Anonymous</span>
            {% endif %}
          </td>
          <td class="mono text-sm">{{ f.created_at[:16] if f.created_at else '-' }}</td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
  {% else %}
  <div class="card text-center" style="padding:2rem">
    <p class="text-slate">No feedback yet.</p>
  </div>
  {% endif %}
{% endblock %}
