<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login</title>
    <link rel="stylesheet" href="/static/style.css">
    <link rel="icon" href="/static/logo.png" type="image/png">
    <style>
        body {
            background-image: url('/static/background.png');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            height: 100vh;
            margin: 0;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }
        .login-container {
            background: rgba(255, 255, 255, 0.6);
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            max-width: 400px;
            width: 100%;
            text-align: center;
        }
        .login-container h1 {
            margin-bottom: 20px;
        }
        .login-container form {
            margin: 5px 0;
            width: 100%;
        }
        .login-container form button {
            background-color: #007BFF;
            color: white;
            border: none;
            padding: 10px 15px;
            cursor: pointer;
            border-radius: 4px;
            width: 100%;
            margin-bottom: 5px;
        }
        .login-container form button:hover {
            background-color: #0056b3;
        }
        .login-container input {
            width: 100%;
            box-sizing: border-box;
            padding: 10px;
            margin: 0 0 10px 0;
            border-radius: 4px;
            border: 1px solid #ccc;
            display: block;
        }
        .error-message {
            color: red;
            margin-top: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
        }
        .error-message img {
            margin-right: 5px;
            width: 14px;
            height: 14px;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <h1>Login</h1>
        <form method="POST" action="{{ url_for('login') }}">
            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
            <label for="username">Benutzername:</label>
            <input type="text" id="username" name="username" value="{{ request.form.username }}" required>
            <br>
            <label for="password">Passwort:</label>
            <input type="password" id="password" name="password" required>
            <br>
            <button type="submit">Login</button>
        </form>
        {% if error %}
            <div class="error-message">
                <img src="/static/red_cross.png" alt="Error">
                <span>Du hast ein falsches Passwort bzw einen falschen Benutzernamen eingegeben!</span>
            </div>
        {% endif %}
    </div>
</body>
</html>
