{% extends 'base.html' %}
{% block title %}Login{% endblock %}

{% block content %}
<div class="auth-container d-flex justify-content-center align-items-center">
    <div class="auth-card card shadow-lg p-4">

        <div class="text-center mb-4">
            <i class="bi bi-person-circle auth-icon"></i>
            <h4 class="mt-2">Login</h4>
            <p class="text-muted small">Access your RMS account</p>
        </div>

        {% if messages %}
            {% for message in messages %}
                <div class="alert alert-{{ message.tags }} mb-3">
                    {{ message }}
                </div>
            {% endfor %}
        {% endif %}

        <form method="post">
            {% csrf_token %}

            <!-- USERNAME -->
            <div class="mb-3">
                <label class="form-label">Username</label>
                <input type="text" name="username" class="form-control" required>
            </div>

            <!-- PASSWORD -->
            <div class="mb-3">
                <label class="form-label">Password</label>

                <div class="input-group">
                    <input type="password" name="password" id="loginPassword" class="form-control" required>

                    <button class="btn btn-outline-secondary" type="button"
                            onclick="togglePassword('loginPassword', this)">
                        <i class="bi bi-eye"></i>
                    </button>
                </div>
            </div>

            <!-- REMEMBER ME -->
            <div class="mb-3 form-check">
                <input type="checkbox" class="form-check-input" name="remember" id="rememberMe">
                <label class="form-check-label" for="rememberMe">
                    Remember me
                </label>
            </div>

            <!-- SUBMIT -->
            <button type="submit" class="btn btn-dark w-100">
                <i class="bi bi-box-arrow-in-right"></i> Login
            </button>
        </form>

        <div class="text-center mt-3">
            <a href="{% url 'password_reset' %}" class="small text-decoration-none">
                Forgot password?
            </a>
        </div>

    </div>
</div>
{% endblock %}