<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<% String token = request.getParameter("token"); if (request.getAttribute("token") != null) { token = (String) request.getAttribute("token"); } %>
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Nouveau mot de passe | RJLResaka</title>
    <meta name="description" content="Choisissez un nouveau mot de passe pour votre compte RJLResaka.">
    <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>Nouveau mot de passe</span></div>
            </div>
            <a class="ghost-link" href="${pageContext.request.contextPath}/login">← Retour</a>
            <span class="hero-badge">Nouveau mot de passe</span>
            <h1>Réinitialisez votre mot de passe</h1>
            <p class="auth-copy">Collez le token reçu ou ouvrez directement le lien généré.</p>
            <% if (request.getAttribute("error") != null) { %><div class="alert error"><%= request.getAttribute("error") %></div><% } %>
            <form action="${pageContext.request.contextPath}/reset-password" method="post" class="stack-form">
                <label><span>Token</span><input type="text" name="token" value="<%= token == null ? "" : token %>" required></label>
                <label><span>Nouveau mot de passe</span><input type="password" name="password" required></label>
                <label><span>Confirmer le mot de passe</span><input type="password" name="confirmPassword" required></label>
                <button class="button primary" type="submit">Mettre à jour</button>
            </form>
            <% 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>
