<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Connexion | RJLResaka</title>
    <meta name="description" content="Connectez-vous à RJLResaka pour accéder à vos conversations privées.">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/app.css">
</head>
<body class="auth-body">
    <main class="auth-shell branded">
        <section class="auth-panel glass">
            <div class="auth-brand">
                <img src="${pageContext.request.contextPath}/assets/img/logo_resaka.png" alt="Logo RJLResaka" width="56" height="56">
                <div>
                    <strong>RJLResaka</strong>
                    <span>Connexion sécurisée</span>
                </div>
            </div>
            <a class="ghost-link" href="${pageContext.request.contextPath}/home">← Retour</a>
            <span class="hero-badge">Connexion</span>
            <h1>Bon retour sur RJLResaka</h1>
            <p class="auth-copy">Utilisez votre email ou votre nom d'utilisateur pour continuer.</p>
            <% if (request.getAttribute("error") != null) { %><div class="alert error"><%= request.getAttribute("error") %></div><% } %>
            <% if (request.getAttribute("success") != null) { %><div class="alert success"><%= request.getAttribute("success") %></div><% } %>
            <form action="${pageContext.request.contextPath}/login" method="post" class="stack-form">
                <label><span>Email ou username</span><input type="text" name="identity" placeholder="ex: demo@rjlresaka.app" required></label>
                <label><span>Mot de passe</span><input type="password" name="password" placeholder="••••••••" required></label>
                <button class="button primary" type="submit">Se connecter</button>
            </form>
            <div class="auth-links"><a href="${pageContext.request.contextPath}/forgot-password">Mot de passe oublié ?</a><a href="${pageContext.request.contextPath}/register">Créer un compte</a></div>
            <% if (request.getAttribute("debugMessage") != null) { %><p class="debug-note">Détail technique: <%= request.getAttribute("debugMessage") %></p><% } %>
        </section>
    </main>
    <script src="${pageContext.request.contextPath}/assets/js/app.js"></script>
</body>
</html>
