{% if is_generating %}
<div class="generating-banner"
     hx-get="{{ url_for('admin.scenario_results') }}"
     hx-trigger="every 3s"
     hx-target="#scenario-results"
     hx-swap="innerHTML">
  <svg class="spinner-icon" width="16" height="16" viewBox="0 0 24 24" fill="none">
    <circle cx="12" cy="12" r="10" stroke="#CBD5E1" stroke-width="3"/>
    <path d="M12 2a10 10 0 0 1 10 10" stroke="#0EA5E9" stroke-width="3" stroke-linecap="round"/>
  </svg>
  <span>Generating scenarios…</span>
</div>
{% endif %}
{% if scenarios %}
<table class="table">
  <thead>
    <tr>
      <th>Title</th>
      <th>Slug</th>
      <th>Location</th>
      <th>Config</th>
      <th>Created</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    {% for s in scenarios %}
    <tr>
      <td>{{ s.title }}</td>
      <td class="mono text-sm">{{ s.slug }}</td>
      <td>{{ s.location }}, {{ s.country }}</td>
      <td class="text-sm">{{ s.venue_type | capitalize }} · {{ s.court_config }}</td>
      <td class="mono text-sm">{{ s.created_at[:10] }}</td>
      <td class="text-right">
        <a href="{{ url_for('admin.scenario_preview', scenario_id=s.id) }}" class="btn-outline btn-sm">Preview</a>
        <a href="{{ url_for('admin.scenario_pdf', scenario_id=s.id, lang='en') }}" class="btn-outline btn-sm">PDF EN</a>
        <a href="{{ url_for('admin.scenario_pdf', scenario_id=s.id, lang='de') }}" class="btn-outline btn-sm">PDF DE</a>
        <a href="{{ url_for('admin.scenario_edit', scenario_id=s.id) }}" class="btn-outline btn-sm">Edit</a>
        <form method="post" action="{{ url_for('admin.scenario_delete', scenario_id=s.id) }}" class="m-0" style="display: inline;" hx-boost="true">
          <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
          <button type="submit" class="btn-outline btn-sm"
                  hx-confirm="Delete this scenario? This cannot be undone.">Delete</button>
        </form>
      </td>
    </tr>
    {% endfor %}
  </tbody>
</table>
{% else %}
<p class="text-slate text-sm">No scenarios match the current filters.</p>
{% endif %}
