<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <script src="https://unpkg.com/htmx.org@1.9.11"></script>
    <meta charset="UTF-8">
    <title>Connexion - AS Talange</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
    <style>
        body { font-family: 'Inter', sans-serif; }
    </style>
</head>
<body class="bg-gray-50 flex items-center justify-center min-h-screen">

<div class="bg-white p-8 rounded-2xl shadow-xl w-full max-w-md border border-gray-100">
    <div class="text-center mb-8">
        <h1 class="text-3xl font-bold text-gray-900 mb-2">AS Talange</h1>
        <p class="text-gray-500">Outil de gestion administrative</p>
    </div>

    <div th:if="${param.error}" class="bg-red-50 text-red-600 p-4 rounded-lg mb-6 text-sm">
        Identifiant ou mot de passe incorrect.
    </div>
    
    <div th:if="${param.logout}" class="bg-green-50 text-green-600 p-4 rounded-lg mb-6 text-sm">
        Vous avez été déconnecté avec succès.
    </div>

    <form th:action="@{/login}" method="post" class="space-y-6">
        <div>
            <label for="username" class="block text-sm font-medium text-gray-700 mb-1">Nom d'utilisateur</label>
            <input type="text" id="username" name="username" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors" required autofocus>
        </div>

        <div>
            <label for="password" class="block text-sm font-medium text-gray-700 mb-1">Mot de passe</label>
            <input type="password" id="password" name="password" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors" required>
        </div>

        <button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-semibold py-3 px-4 rounded-lg transition-colors duration-200">
            Se connecter
        </button>
    </form>
</div>

</body>
</html>
