
<!-- src/main/resources/templates/fragments/fragment-menu.html -->
<ul class="navbar-nav bg-gradient-primary sidebar sidebar-dark accordion toggled" id="accordionSidebar" th:fragment="menu">

  <!-- Sidebar - Brand -->
  <a class="sidebar-brand d-flex align-items-center justify-content-center" th:href="@{/}">
    <div class="sidebar-brand-icon">
      <i class="fas fa-weight"></i>
    </div>
    <div class="sidebar-brand-text mx-3">Weight Tracker</div>
  </a>

  <!-- Divider -->
  <hr class="sidebar-divider my-0">

  <!-- Nav Items -->
  <li class="nav-item">
    <a class="nav-link" th:href="@{/registros}">
      <i class="fas fa-list"></i>
      <span>Ver registros</span>
    </a>
  </li>
  <li class="nav-item">
    <a class="nav-link" th:href="@{/registros/nuevo}">
      <i class="fas fa-plus"></i>
      <span>Añadir registro</span>
    </a>
  </li>
  <li class="nav-item" th:if="${#authorization.expression('hasRole(''ADMIN'')')}">
    <a class="nav-link" th:href="@{/usuarios}">
      <i class="fas fa-users-cog"></i>
      <span>Usuarios</span>
    </a>
  </li>

  <!-- Logout -->
  <li class="nav-item">
    <form th:action="@{/logout}" method="post">
      <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" />
      <button type="submit" class="nav-link btn btn-link text-start">
        <i class="fas fa-sign-out-alt"></i>
        <span>Cerrar sesión</span>
      </button>
    </form>
  </li>

  <!-- Sidebar Toggler (hamburguesa) -->
  <div class="text-center d-md-inline">
    <button class="rounded-circle border-0" id="sidebarToggle"></button>
  </div>
</ul>
