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

{% block title %}
    {% if LANGUAGE_CODE == 'ar' %}تسجيل الدخول{% else %}Login{% endif %}
{% 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">
                        {% if LANGUAGE_CODE == 'ar' %}مرحباً بعودتك{% else %}Welcome Back{% endif %}
                    </h2>
                    <p class="text-muted">
                        {% if LANGUAGE_CODE == 'ar' %}سجل الدخول لمتابعة رحلتك التعليمية{% else %}Login to continue your educational journey{% endif %}
                    </p>
                </div>
                
                <form method="post">
                    {% csrf_token %}
                    
                    {% if form.errors %}
                    <div class="alert alert-danger alert-dismissible fade show" role="alert">
                        {% if LANGUAGE_CODE == 'ar' %}اسم المستخدم أو كلمة المرور غير صحيحة.{% else %}Invalid username or password.{% endif %}
                        <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="{% if LANGUAGE_CODE == 'ar' %}اسم المستخدم{% else %}Username{% endif %}">
                        <label for="id_username"><i class="fas fa-user me-2"></i>{% if LANGUAGE_CODE == 'ar' %}اسم المستخدم{% else %}Username{% endif %}</label>
                    </div>
                    
                    <div class="form-floating mb-4">
                        <input type="password" name="password" autocomplete="current-password" required id="id_password" class="form-control" placeholder="{% if LANGUAGE_CODE == 'ar' %}كلمة المرور{% else %}Password{% endif %}">
                        <label for="id_password"><i class="fas fa-lock me-2"></i>{% if LANGUAGE_CODE == 'ar' %}كلمة المرور{% else %}Password{% endif %}</label>
                    </div>

                    <button type="submit" class="btn btn-primary w-100 py-3 fs-5 fw-bold shadow-sm">
                        {% if LANGUAGE_CODE == 'ar' %}دخول{% else %}Login{% endif %}
                        <i class="fas fa-arrow-left ms-2"></i>
                    </button>
                    
                    <div class="text-center mt-4">
                        <p class="text-muted mb-0">
                            {% if LANGUAGE_CODE == 'ar' %}ليس لديك حساب؟{% else %}Don't have an account?{% endif %}
                            <a href="{% url 'register_student' %}" class="text-primary text-decoration-none fw-bold">
                                {% if LANGUAGE_CODE == 'ar' %}سجل هنا{% else %}Register here{% endif %}
                            </a>
                        </p>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}