{% extends 'base.html' %}
{% load i18n static %}

{% block title %}{% trans "Login" %}{% endblock %}

{% block content %}
<div class="container hero-section">
    <div class="row justify-content-center">
        <div class="col-md-6 col-lg-5">
            <div class="glass-card p-5">
                <div class="text-center mb-4">
                    <h2 class="text-primary fw-bold">{% trans "Welcome Back" %}</h2>
                    <p class="text-muted">{% trans "Sign in to continue your learning journey" %}</p>
                </div>
                
                <form method="post">
                    {% csrf_token %}
                    
                    {% if form.errors %}
                    <div class="alert alert-danger alert-dismissible fade show" role="alert">
                        {% trans "Invalid username or password." %}
                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                    {% endif %}
                    
                    <div class="form-floating mb-3">
                        <input type="text" name="username" autofocus autocapitalize="none" autocomplete="username" maxlength="150" required id="id_username" class="form-control" placeholder="{% trans 'Username' %}">
                        <label for="id_username"><i class="fas fa-user me-2"></i>{% trans "Username" %}</label>
                    </div>
                    
                    <div class="form-floating mb-4">
                        <input type="password" name="password" autocomplete="current-password" required id="id_password" class="form-control" placeholder="{% trans 'Password' %}">
                        <label for="id_password"><i class="fas fa-lock me-2"></i>{% trans "Password" %}</label>
                    </div>

                    <button type="submit" class="btn btn-primary w-100 py-3 fs-5 fw-bold shadow-sm">
                        {% trans "Login" %} <i class="fas fa-arrow-right ms-2"></i>
                    </button>
                    
                    <div class="text-center mt-4">
                        <p class="text-muted mb-0">
                            {% trans "Don't have an account?" %} 
                            <a href="{% url 'register_student' %}" class="text-primary text-decoration-none fw-bold">{% trans "Register Here" %}</a>
                        </p>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}