{{define "webmail_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 - Webmail</title>
    <link href="/webmail/static/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="/webmail/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-inbox-fill" style="font-size: 2.5rem;"></i>
            <h4 class="mt-2">Webmail</h4>
            <p class="text-muted">Manage your mailbox account</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="/webmail/login">
                    <div class="mb-3">
                        <label for="email" class="form-label">Email</label>
                        <input type="email" class="form-control" id="email" name="email" value="{{.email}}" 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 class="form-text">This is your mailbox account password — not an app password.</div>
                    </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="/pymta-manager/login" class="btn btn-outline-secondary btn-sm"><i class="bi bi-shield-lock me-1"></i>Login as Admin</a>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
{{end}}
