{# Helper to mark active links by endpoint name #}
{% macro nav_link(endpoint, text) -%}
  {%- set href = url_for(endpoint) -%}
  {%- set active = 'active' if request.endpoint == endpoint else '' -%}
  <a href="{{ href }}" class="nav-link {{ active }}" {% if active %}aria-current="page"{% endif %}>{{ text }}</a>
{%- endmacro %}

<nav class="sidebar offcanvas-start offcanvas-xxl" id="sidebar" tabindex="-1">
  <div class="offcanvas-header bg-body-tertiary border-bottom border-opacity-25">
    <a class="sidebar-brand" href="{{ url_for('main.dashboard') }}">
      <img src="{{ url_for('static', filename='images/COC_Icon.png') }}" alt="icon" width="32" height="32"> Admin Panel
    </a>
    <small>
      <span class="version">{{ version or '' }}</span>
    </small>
  </div>

  <div class="offcanvas-body">
    <ul class="sidebar-nav">

      <li><h6 class="sidebar-header text-uppercase">Dashboard</h6></li>
      <li><hr class="sidebar-divider"></li>

      <li class="nav-item">
        {{ nav_link('main.dashboard', 'Home') }}
      </li>
      <li class="nav-item">
        {# nav_link('profile', 'Profile') #}
      </li>
      <li class="nav-item">
        {# nav_link('login', 'Login') #}
      </li>
      <li class="nav-item">
        {{ nav_link('auth.logout', 'Logout') }}
      </li>

      
    </ul>
  </div>
</nav>
