{% extends "base.html" %}

{% block title %}Admin Login - A+ Academy{% endblock %}

{% block content %}
<section style="min-height: 100vh; display: flex; align-items: center; background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%); padding: 80px 0;">
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-5">
                <div class="soft-card p-4 p-md-5">
                    <div class="text-center mb-4">
                        <div class="subject-icon mx-auto mb-3" style="width: 70px; height: 70px; font-size: 1.8rem;">
                            <i class="bi bi-shield-lock"></i>
                        </div>
                        <h3 class="fw-bold">Admin Login</h3>
                        <p class="text-muted">Sign in to access the admin dashboard</p>
                    </div>

                    <form method="POST" action="{{ url_for('admin.login') }}">
                        {{ form.hidden_tag() }}

                        <div class="mb-3">
                            {{ form.username.label(class="form-label") }}
                            {{ form.username(class="form-control" + (" is-invalid" if form.username.errors else ""), placeholder="Enter username") }}
                            {% if form.username.errors %}
                                <div class="invalid-feedback">{% for error in form.username.errors %}{{ error }}{% endfor %}</div>
                            {% endif %}
                        </div>

                        <div class="mb-3">
                            {{ form.password.label(class="form-label") }}
                            {{ form.password(class="form-control" + (" is-invalid" if form.password.errors else ""), placeholder="Enter password") }}
                            {% if form.password.errors %}
                                <div class="invalid-feedback">{% for error in form.password.errors %}{{ error }}{% endfor %}</div>
                            {% endif %}
                        </div>

                        <div class="mb-3 form-check">
                            {{ form.remember_me(class="form-check-input") }}
                            {{ form.remember_me.label(class="form-check-label") }}
                        </div>

                        <div class="d-grid">
                            {{ form.submit(class="soft-btn btn-lg") }}
                        </div>
                    </form>

                    <div class="text-center mt-4">
                        <a href="{{ url_for('main.index') }}" class="text-decoration-none">
                            <i class="bi bi-arrow-left"></i> Back to Website
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
{% endblock %}
