<script>
  function search() {
    var searchInput = document.getElementById('navSearchBox').value;
    window.location.href = '/search?q=' + encodeURIComponent(searchInput);
  }
</script>
<nav class="navbar navbar-expand-lg bg-dark">
    <div class="container-fluid">
      <a class="navbar-brand text-light" href="/">Modding Library</a>
      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="navbar-nav me-auto mb-2 mb-lg-0">
          <li class="nav-item">
            <a class="nav-link active text-light" href="/">Home</a>
          </li>
          <li class="w-100">
            <div class="d-flex ms-4">
              <input id="navSearchBox" class="form-control me-2 text-light bg-white-50 text-input" type="search" placeholder="Search" aria-label="Search">
              <button class="btn btn-primary" onclick="search();">Search</button>
            </div>
          </li>
        </ul>
        <div class="mb-2">
          <% if (!user) { %>
            <a href="/login"><button class="btn btn-primary">Login</button></a>
          <% } else { %>
            <a href="/admin"><button class="btn btn-primary">Admin</button></a>
            <a href="/api/logout"><button class="btn btn-outline-danger">Logout</button></a>
          <% } %>
        </div>
        </div>
    </div>
</nav>