<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Login</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      margin: 0; padding: 0;
      display: flex; justify-content: center; align-items: center;
      height: 100vh; background: #f1f1f1;
    }
    .container {
      max-width: 400px; width: 100%;
      background: #fff; padding: 20px;
      border-radius: 8px; box-shadow: 0 0 10px #ccc;
    }
    h1 { text-align: center; margin-bottom: 1em; }
    label { display: block; margin-top: 1em; }
    input[type="text"], input[type="password"] {
      width: 100%; padding: 8px; margin-top: 4px;
      box-sizing: border-box;
    }
    button {
      margin-top: 1em; width: 100%; padding: 10px;
      background: #007bff; border: none; color: #fff;
      cursor: pointer; border-radius: 4px;
    }
    button:hover { background: #0056b3; }
    .links { text-align: center; margin-top: 10px; }
    .links a { color: #007bff; text-decoration: none; }
    .links a:hover { text-decoration: underline; }
    .flash-messages { margin-top: 10px; color: #b30000; text-align: center; }
  </style>
</head>
<body>
  <div class="container">
    <h1>Login</h1>
    {% with messages = get_flashed_messages(category_filter=["danger","success","info"]) %}
      {% if messages %}
        <div class="flash-messages">
          {% for message in messages %}
            <p>{{ message }}</p>
          {% endfor %}
        </div>
      {% endif %}
    {% endwith %}
    <form method="POST" action="{{ url_for('login') }}">
      <label for="username">Username:</label>
      <input type="text" name="username" id="username" required />
      <label for="password">Password:</label>
      <input type="password" name="password" id="password" required />
      <button type="submit">Log In</button>
    </form>
    <div class="links">
      <a href="{{ url_for('register') }}">Register</a>
    </div>
  </div>
</body>
</html>