{% load static %}

<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
    <title>Login - SIRH</title>
</head>
<body>
    <div class="container-fluid vh-100">
        <div class="row">
            <div class="col-6 vh-100 d-flex flex-column justify-content-center align-items-center">
                <img src="{% static 'img/cerfig.jpg' %}" class="w-50">
                <h5 class="text-center">Bienvenue sur les systèmes de gestion du CERFIG</h5>
            </div>
            <div class="col-6 vh-100 d-flex justify-content-center align-items-center">
                <form method="POST" action="{% url 'login' %}" class="w-100 shadow rounded px-3 py-5">
                    <h2 class="text-center">Connexion</h2>
                    {% if messages %}
                        {% for message in messages %}
                            <div class="alert alert-{% if message.tags == 'error' %}danger{% else %}success{% endif %}">{{message}}</div>
                        {% endfor %}
                    {% endif %}
                    {% csrf_token %}
                    <input type="hidden" name="next" value="{{ next }}">
                    <div class="mb-3">
                        <label for="mail">Votre adresse email :</label>
                        <input type="text" name="mail" class="form-control" placeholder="Entrez votre e-mail" required>
                    </div>
                    <div class="mb-3">
                        <label for="mot_de_passe">Mot de passe</label>
                        <input type="password" name="mot_de_passe" class="form-control" placeholder="Entrez votre mot de passe" required>
                        <i class="bi bi-eye toggle-password" onclick="togglePassword()" 
                            style="position:absolute; right:10px; top:38px; cursor:pointer;"></i>
                    </div>
                    <button type="submit" class="btn btn-primary w-100">Se connecter</button>
                </form>
            </div>
        </div>
    </div>
</body>
</html>