<%- include('../partials/header', { title: 'Change Password' }) %>

<div class="container">
  <div class="login-card">
    <h2>Change Admin Password</h2>
    <p class="subtitle">Update your admin password</p>

    <% if (typeof error !== 'undefined' && error) { %>
      <div class="alert alert-error">
        <%= error %>
      </div>
    <% } %>

    <% if (typeof success !== 'undefined' && success) { %>
      <div class="alert alert-success">
        <%= success %>
      </div>
    <% } %>

    <form method="POST" action="/admin/change-password" class="form">
      <input type="hidden" name="_csrf" value="<%= typeof csrfToken !== 'undefined' ? csrfToken : '' %>">
      <div class="form-group">
        <label for="currentPassword">Current Password</label>
        <input type="password" id="currentPassword" name="currentPassword" required
               placeholder="Enter current password" class="form-input">
      </div>

      <div class="form-group">
        <label for="newPassword">New Password</label>
        <input type="password" id="newPassword" name="newPassword" required
               placeholder="At least 8 characters" class="form-input" minlength="8">
      </div>

      <div class="form-group">
        <label for="confirmPassword">Confirm New Password</label>
        <input type="password" id="confirmPassword" name="confirmPassword" required
               placeholder="Repeat new password" class="form-input" minlength="8">
      </div>

      <button type="submit" class="btn btn-primary btn-large">Update Password</button>
    </form>

    <p class="form-note">
      <a href="/admin/dashboard">&larr; Back to Dashboard</a>
    </p>
  </div>
</div>

<%- include('../partials/footer') %>
