{# New Post + Drafts toggle — shown in aside (desktop + mobile) #}
<div class="flex flex-wrap gap-2 px-4 py-3">
  {% if has_access('blog.new_post') %}
    {% set new_href = url_for('blog.new_post')|host %}
    <a
      href="{{ new_href }}"
      hx-get="{{ new_href }}"
      hx-target="#main-panel"
      hx-select="{{hx_select_search}}"
      hx-swap="outerHTML"
      hx-push-url="true"
      class="px-3 py-1 rounded bg-stone-700 text-white text-sm hover:bg-stone-800 transition-colors"
      title="New Post"
    >
      <i class="fa fa-plus mr-1"></i> New Post
    </a>
  {% endif %}
  {% if g.user and (draft_count or drafts) %}
    {% if drafts %}
      {% set drafts_off_href = (current_local_href ~ {'drafts': None}|qs)|host %}
      <a
        href="{{ drafts_off_href }}"
        hx-get="{{ drafts_off_href }}"
        hx-target="#main-panel"
        hx-select="{{hx_select_search}}"
        hx-swap="outerHTML"
        hx-push-url="true"
        class="px-3 py-1 rounded bg-stone-700 text-white text-sm hover:bg-stone-800 transition-colors"
        title="Hide Drafts"
      >
        <i class="fa fa-file-text-o mr-1"></i> Drafts
        <span class="inline-block bg-stone-500 text-white px-1.5 py-0.5 text-xs font-medium rounded ml-1">{{ draft_count }}</span>
      </a>
    {% else %}
      {% set drafts_on_href = (current_local_href ~ {'drafts': '1'}|qs)|host %}
      <a
        href="{{ drafts_on_href }}"
        hx-get="{{ drafts_on_href }}"
        hx-target="#main-panel"
        hx-select="{{hx_select_search}}"
        hx-swap="outerHTML"
        hx-push-url="true"
        class="px-3 py-1 rounded bg-amber-600 text-white text-sm hover:bg-amber-700 transition-colors"
        title="Show Drafts"
      >
        <i class="fa fa-file-text-o mr-1"></i> Drafts
        <span class="inline-block bg-amber-500 text-white px-1.5 py-0.5 text-xs font-medium rounded ml-1">{{ draft_count }}</span>
      </a>
    {% endif %}
  {% endif %}
</div>
