{% extends "base.html" %}
{% load static %}

{% block title %}Login - EventKasse{% endblock %}

{% block content %}
<style>
    .login-container {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 80vh;
    }
    .login-form {
        background-color: var(--sidebar-bg);
        padding: 3rem;
        border-radius: 12px;
        width: 100%;
        max-width: 450px;
        border: 1px solid #374151;
        box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    }
    .login-title {
        color: var(--primary-color);
        font-size: 2rem;
        font-weight: 700;
        text-align: center;
        margin-bottom: 2rem;
    }
    .form-group {
        margin-bottom: 1.5rem;
    }
    .form-label {
        color: var(--text-muted);
        display: block;
        margin-bottom: 0.5rem;
    }
    .form-control {
        background-color: var(--bg-color);
        border: 1px solid #475569;
        color: var(--text-color);
        border-radius: 8px;
        padding: 0.75rem 1rem;
        width: 100%;
    }
    .form-control:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.3);
    }
    .btn-login {
        background-color: var(--primary-color);
        color: var(--bg-color);
        font-weight: 700;
        padding: 0.75rem 1.5rem;
        border-radius: 8px;
        width: 100%;
        border: none;
        transition: background-color 0.2s ease;
    }
    .btn-login:hover {
        background-color: var(--primary-hover);
    }
    .error-message {
        color: #fca5a5;
        background-color: #450a0a;
        border: 1px solid #7f1d1d;
        padding: 1rem;
        border-radius: 8px;
        margin-bottom: 1.5rem;
        text-align: center;
    }
</style>

<div class="login-container">
    <div class="login-form">
        <h2 class="login-title">Kassen-Login</h2>
        
        {% if form.errors %}
            <div class="error-message">
                <p>Benutzername oder Passwort ist falsch. Bitte versuchen Sie es erneut.</p>
            </div>
        {% endif %}

        <form method="post" action="{% url 'login' %}">
            {% csrf_token %}
            <div class="form-group">
                <label for="id_username" class="form-label">Benutzername</label>
                <input type="text" name="username" id="id_username" class="form-control" required>
            </div>
            <div class="form-group">
                <label for="id_password" class="form-label">Passwort</label>
                <input type="password" name="password" id="id_password" class="form-control" required>
            </div>
            <button type="submit" class="btn-login">Anmelden</button>
        </form>
    </div>
</div>
{% endblock %}
