{% extends "admin_base" %}

{% block title %}Détail — {{ resource.title | default(value=resource_key) }} #{{ entry.id }}{% endblock %}

{% block breadcrumb %}
  <span class="breadcrumb-sep">/</span>
  <a href="/admin/{{ resource.key }}/list">{{ resource.title | default(value=resource_key) }}</a>
  <span class="breadcrumb-sep">/</span>
  <span>Détail #{{ entry.id }}</span>
{% endblock %}

{% block content %}

  <div class="page-header">
    <div>
      <h1 style="font-size:1.35rem; font-weight:600;">Détail — {{ resource.title | default(value=resource_key) }}</h1>
      <p style="font-size:0.82rem; color:var(--text-muted); margin-top:0.2rem;">Entrée #{{ entry.id }}</p>
    </div>
    <div style="display:flex; gap:0.6rem;">
      <a href="/admin/{{ resource.key }}/list" class="btn btn-secondary">← Liste</a>
      <a href="/admin/{{ resource.key }}/{{ entry.id }}/edit" class="btn btn-primary">Modifier</a>
      <form method="post" action="/admin/{{ resource.key }}/{{ entry.id }}/delete" style="display:inline;">
        <button type="submit" class="btn btn-danger"
                onclick="return confirm('Supprimer cette entrée ?')">Supprimer</button>
      </form>
    </div>
  </div>

  <div class="card">
    <div class="admin-table-wrapper">
      <table class="admin-table">
        <tbody>
          <tr>
            <td style="width:200px; color:var(--text-muted); font-size:0.75rem; font-weight:600; text-transform:uppercase; letter-spacing:0.05em;">id</td>
            <td><span class="id-badge">#{{ entry.id }}</span></td>
          </tr>
          {% for key, value in entry %}
            {% if key != "id" %}
            <tr>
              <td style="width:200px; color:var(--text-muted); font-size:0.75rem; font-weight:600; text-transform:uppercase; letter-spacing:0.05em;">{{ key }}</td>
              <td>
                {% if key == "password" or key == "password_hash" %}
                  <span class="id-badge">••••••••</span>
                {% elif value == true %}
                  <span class="badge badge-green">Oui</span>
                {% elif value == false %}
                  <span class="badge badge-neutral">Non</span>
                {% elif value %}
                  {{ value }}
                {% else %}
                  <span style="color:var(--text-muted);">—</span>
                {% endif %}
              </td>
            </tr>
            {% endif %}
          {% endfor %}
        </tbody>
      </table>
    </div>
  </div>

{% endblock %}