<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title><%= title %></title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.2/font/bootstrap-icons.css">
</head>
<body class="bg-light">
  <div class="container">
    <div class="row justify-content-center align-items-center min-vh-100">
      <div class="col-md-5">
        <div class="card shadow-lg">
          <div class="card-body p-5">
            <div class="text-center mb-4">
              <h2 class="fw-bold"><i class="bi bi-shop text-primary"></i> SkyArtShop</h2>
              <p class="text-muted">Admin Login</p>
            </div>
            <% if (error === 'invalid') { %>
              <div class="alert alert-danger"><i class="bi bi-exclamation-triangle"></i> Invalid email or password</div>
            <% } else if (error === 'server') { %>
              <div class="alert alert-danger"><i class="bi bi-exclamation-triangle"></i> Server error. Please try again.</div>
            <% } %>
            <form method="POST" action="/admin/login">
              <div class="mb-3">
                <label for="email" class="form-label">Email address</label>
                <div class="input-group">
                  <span class="input-group-text"><i class="bi bi-envelope"></i></span>
                  <input type="email" class="form-control" id="email" name="email" required autofocus>
                </div>
              </div>
              <div class="mb-3">
                <label for="password" class="form-label">Password</label>
                <div class="input-group">
                  <span class="input-group-text"><i class="bi bi-lock"></i></span>
                  <input type="password" class="form-control" id="password" name="password" required>
                </div>
              </div>
              <div class="d-grid">
                <button type="submit" class="btn btn-primary btn-lg"><i class="bi bi-box-arrow-in-right"></i> Login</button>
              </div>
            </form>
            <div class="text-center mt-4">
              <small class="text-muted"><a href="/" class="text-decoration-none"><i class="bi bi-arrow-left"></i> Back to website</a></small>
            </div>
          </div>
        </div>
        <div class="text-center mt-3">
          <small class="text-muted">Default: admin@example.com / password</small>
        </div>
      </div>
    </div>
  </div>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
