{{define "login.html"}}
<!DOCTYPE html>
<html lang="fr" data-theme="light">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Connexion - SOGOMS Admin</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
    <style>
        body {
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
        }
        .login-card {
            width: 100%;
            max-width: 400px;
        }
        .logo {
            text-align: center;
            font-size: 2rem;
            font-weight: bold;
            margin-bottom: 2rem;
        }
        .logo span {
            color: var(--pico-primary);
        }
        .error-message {
            background: #fef2f2;
            border: 1px solid #fecaca;
            color: #dc2626;
            padding: 0.75rem 1rem;
            border-radius: var(--pico-border-radius);
            margin-bottom: 1rem;
        }
    </style>
</head>
<body>
    <article class="login-card">
        <div class="logo">SOGO<span>MS</span> Admin</div>

        {{if .Error}}
        <div class="error-message">
            {{.Error}}
        </div>
        {{end}}

        <form action="/admin/login" method="post">
            <input type="hidden" name="csrf_token" value="{{.CSRFToken}}">

            <label for="username">
                Nom d'utilisateur
                <input type="text" id="username" name="username"
                       placeholder="Votre identifiant" required autofocus>
            </label>

            <label for="password">
                Mot de passe
                <input type="password" id="password" name="password"
                       placeholder="Votre mot de passe" required>
            </label>

            <button type="submit">Se connecter</button>
        </form>
        <footer style="text-align: center; margin-top: 1rem; font-size: 0.8rem; color: var(--pico-muted-color);">
            v{{.SogVersion}}
        </footer>
    </article>
</body>
</html>
{{end}}
