<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login - Hierarchy Management</title>
    <style>
        :root {
            --primary: #2563eb;
            --primary-dark: #1d4ed8;
            --bg: #f8fafc;
            --card-bg: #ffffff;
            --border: #e2e8f0;
            --text: #1e293b;
            --text-muted: #64748b;
            --danger: #ef4444;
        }
        * { box-sizing: border-box; margin: 0; padding: 0; }
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--bg);
            color: var(--text);
            line-height: 1.6;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .login-card {
            background: var(--card-bg);
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.1);
            padding: 2.5rem;
            width: 100%;
            max-width: 400px;
            margin: 1rem;
        }
        h1 {
            font-size: 1.5rem;
            font-weight: 600;
            margin-bottom: 0.5rem;
            text-align: center;
        }
        .subtitle {
            color: var(--text-muted);
            font-size: 0.875rem;
            text-align: center;
            margin-bottom: 1.5rem;
        }
        .form-group {
            margin-bottom: 1rem;
        }
        .form-group label {
            display: block;
            margin-bottom: 0.5rem;
            font-weight: 500;
            font-size: 0.875rem;
        }
        .form-control {
            width: 100%;
            padding: 0.75rem;
            border: 1px solid var(--border);
            border-radius: 6px;
            font-size: 1rem;
        }
        .form-control:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
        }
        .btn {
            display: block;
            width: 100%;
            padding: 0.75rem 1rem;
            border-radius: 6px;
            font-size: 1rem;
            font-weight: 500;
            text-decoration: none;
            cursor: pointer;
            border: none;
            transition: all 0.15s;
        }
        .btn-primary {
            background: var(--primary);
            color: white;
        }
        .btn-primary:hover {
            background: var(--primary-dark);
        }
        .error {
            background: #fee2e2;
            color: #991b1b;
            padding: 0.75rem;
            border-radius: 6px;
            margin-bottom: 1rem;
            font-size: 0.875rem;
        }
        .demo-users {
            margin-top: 1.5rem;
            padding-top: 1.5rem;
            border-top: 1px solid var(--border);
        }
        .demo-users h3 {
            font-size: 0.75rem;
            text-transform: uppercase;
            color: var(--text-muted);
            margin-bottom: 0.75rem;
        }
        .demo-users ul {
            list-style: none;
            font-size: 0.875rem;
        }
        .demo-users li {
            padding: 0.25rem 0;
            color: var(--text-muted);
        }
        .demo-users code {
            background: var(--bg);
            padding: 0.125rem 0.375rem;
            border-radius: 3px;
            font-size: 0.8125rem;
        }
    </style>
</head>
<body>
    <div class="login-card">
        <h1>Hierarchy Management</h1>
        <p class="subtitle">Sign in to manage your organization</p>

        {% if form.errors %}
        <div class="error">
            Invalid username or password. Please try again.
        </div>
        {% endif %}

        <form method="post">
            {% csrf_token %}
            <div class="form-group">
                <label for="id_username">Username</label>
                <input type="text" name="username" id="id_username" class="form-control" required autofocus>
            </div>
            <div class="form-group">
                <label for="id_password">Password</label>
                <input type="password" name="password" id="id_password" class="form-control" required>
            </div>
            <button type="submit" class="btn btn-primary">Sign in</button>
            <input type="hidden" name="next" value="{{ next }}">
        </form>

        <div class="demo-users">
            <h3>Demo Accounts</h3>
            <ul>
                <li><code>admin/admin</code> - Superuser (full access)</li>
                <li><code>alice/alice</code> - Organization owner</li>
                <li><code>bob/bob</code> - Engineering manager</li>
                <li><code>charlie/charlie</code> - Backend lead</li>
                <li><code>diana/diana</code> - Frontend member</li>
            </ul>
        </div>
    </div>
</body>
</html>
