{% extends "base.html" %}
{% block extra_head %}
<link rel="stylesheet" href="{{ static_url('/static/css/auth.css') }}">
{% endblock %}
{% block content %}
<div class="auth-page">
    <div class="auth-card">
        <a href="/" class="auth-back">&larr; Back</a>
        <h2>Welcome Back</h2>
        <p class="subtitle">Sign in to continue to DevPlace</p>

        {% if errors %}
        <div class="auth-error" role="alert">
            <ul>
                {% for error in errors %}
                <li>{{ error }}</li>
                {% endfor %}
            </ul>
        </div>
        {% endif %}

        <form class="auth-form" method="POST" action="/auth/login">
            <input type="hidden" name="next" value="{{ next_url or '' }}">
            <div class="auth-field">
                <label for="email">Email address</label>
                <input type="email" id="email" name="email" value="{{ email or '' }}" required aria-required="true" maxlength="255" placeholder="you@example.com">
            </div>

            <div class="auth-field">
                <label for="password">Password</label>
                <div class="input-wrap">
                    <input type="password" id="password" name="password" required aria-required="true" minlength="6" maxlength="128" placeholder="Your password">
                    <button type="button" class="auth-toggle-pw" aria-label="Show password" aria-pressed="false">&#x1F441;</button>
                </div>
            </div>

            <div class="auth-options">
                <label>
                    <input type="checkbox" name="remember_me"> Remember me
                </label>
                <a href="/auth/forgot-password">Forgot your password?</a>
            </div>

            <button type="submit" class="auth-submit"><span class="icon">&#x1F511;</span> Sign in</button>
        </form>

        <div class="auth-footer">
            Don't have an account? <a href="/auth/signup">Create new account</a>
        </div>
    </div>
</div>
{% endblock %}
