<!DOCTYPE html>
<html lang="{{ get_admin_language() }}">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ t('login.title') }} - AliothPress</title>
    <link rel="stylesheet" href="{{ static_v('css/admin.css') }}">
</head>
<body class="auth-page">
    <div class="auth-card">
        <h1><img src="{{ url_for('static', filename='img/admin-star.png') }}" alt="" width="32" height="32" class="sidebar-brand-icon"> AliothPress</h1>
        <p class="auth-subtitle">{{ t('login.title') }}</p>
        
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                    <div class="alert alert-{{ category }}">{{ message }}</div>
                {% endfor %}
            {% endif %}
        {% endwith %}
        
        {% if demo_mode %}
            <div class="alert alert-info">{{ t('demo.login_hint') }}</div>
        {% endif %}
        
        <form method="POST">
            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
            <div class="form-group">
                <label for="username">{{ t('login.username_or_email') }}</label>
                <input type="text" id="username" name="username" required autocomplete="username"{% if demo_mode %} value="{{ demo_login_username }}"{% endif %}>
            </div>
            
            <div class="form-group">
                <label for="password">{{ t('login.password') }}</label>
                <input type="password" id="password" name="password" required autocomplete="current-password"{% if demo_mode %} value="{{ demo_login_password }}"{% endif %}>
            </div>
            
            <button type="submit">{{ t('login.login_btn') }}</button>
        </form>
        
        {% if not demo_mode %}
        <div class="auth-link">
            <a href="{{ url_for('admin_forgot_password') }}">{{ t('login.forgot_password') }}</a>
        </div>
        {% endif %}
        
        <div class="auth-link">
            <a href="{{ url_for('index') }}">{{ t('login.back_to_site') }}</a>
        </div>
    </div>
</body>
</html>
