{{define "login.html"}}
<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sign in - mailgoserver</title>
    <link href="/pymta-manager/static/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="/pymta-manager/static/vendor/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
    <style>
        body { background-color: #1a1a1a; color: #e0e0e0; min-height: 100vh; display: flex; align-items: center; }
        .login-card { max-width: 420px; margin: 0 auto; width: 100%; }
        .card { background-color: #2d2d2d; border: 1px solid #404040; }
    </style>
</head>
<body>
    {{template "csrf_script" .}}
    <div class="container login-card">
        <div class="text-center mb-4">
            <i class="bi bi-envelope-fill" style="font-size: 2.5rem;"></i>
            <h4 class="mt-2">mailgoserver</h4>
            <p class="text-muted">Admin Dashboard</p>
        </div>
        <div class="card">
            <div class="card-body p-4">
                {{if .error}}<div class="alert alert-danger">{{.error}}</div>{{end}}
                <form method="POST" action="/pymta-manager/login">
                    <input type="hidden" name="next" value="{{.next}}">
                    <div class="mb-3">
                        <label for="username" class="form-label">Username</label>
                        <input type="text" class="form-control" id="username" name="username" value="{{.username}}" required autofocus>
                    </div>
                    <div class="mb-3">
                        <label for="password" class="form-label">Password</label>
                        <input type="password" class="form-control" id="password" name="password" required>
                    </div>
                    <div class="d-grid">
                        <button type="submit" class="btn btn-primary"><i class="bi bi-box-arrow-in-right me-1"></i>Sign in</button>
                    </div>
                </form>
                <hr>
                <div class="d-grid">
                    <a href="/webmail/login" class="btn btn-outline-secondary btn-sm"><i class="bi bi-inbox me-1"></i>Login as Mailbox User</a>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
{{end}}
