<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="color-scheme" content="dark" />
    <title><%= title %></title>
    <link rel="stylesheet" href="/styles.css" />
  </head>
  <body class="admin-auth-page">
    <main class="admin-auth-main">
      <section class="admin-auth-card" aria-labelledby="admin-login-heading">
        <a class="admin-brand" href="/" aria-label="RestRight home">
          <img src="/restright-logo.svg" alt="" />
          <span>RestRight</span>
        </a>
        <div class="admin-auth-eyebrow">Secure administrator access</div>
        <h1 id="admin-login-heading">Admin Login</h1>
        <p class="admin-auth-description">Sign in with your administrator account to manage the system.</p>

        <% if (error) { %>
          <div class="alert alert-error admin-auth-error" role="alert"><%= error %></div>
        <% } %>

        <form action="/admin/login" method="POST" class="admin-auth-form">
          <input type="hidden" name="_csrf" value="<%= csrfToken %>" />
          <div class="form-group">
            <label for="identifier">Username or email</label>
            <input id="identifier" name="identifier" type="text" autocomplete="username" maxlength="254" required autofocus />
          </div>
          <div class="form-group">
            <label for="admin-password">Password</label>
            <div class="admin-password-field">
              <input id="admin-password" name="password" type="password" autocomplete="current-password" required />
              <button type="button" class="admin-password-toggle" id="toggle-admin-password" aria-controls="admin-password" aria-pressed="false">Show</button>
            </div>
          </div>
          <button class="btn btn-primary admin-login-button" type="submit">Log In</button>
        </form>
        <a class="admin-back-link" href="/login">Return to regular login</a>
      </section>
    </main>
    <script src="/admin-login.js" defer></script>
  </body>
</html>
