<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Neues Konto anlegen - Frühstückskonten Verwaltung</title>
    <link rel="stylesheet" href="/styles.css">
</head>
<body>
    <div class="container">
        <header>
            <h1>Frühstückskonten Verwaltung</h1>
            <% if (typeof user !== 'undefined' && user) { %>
                <nav>
                    <span>Angemeldet als: <strong><%= user.username %></strong> (<%= user.role %>) | 
                    <a href="/dashboard">Dashboard</a> |
                    <a href="/accounts">Konten</a>
                    <% if (user.role === 'admin') { %>
                        | <a href="/items">Artikel</a>
                        | <a href="/users">Benutzer</a>
                    <% } %>
                    | <a href="/logout">Abmelden</a>
                    </span>
                </nav>
            <% } %>
        </header>
        
        <main>
            <h2>Neues Konto anlegen</h2>
            
            <% if (typeof error !== 'undefined' && error) { %>
                <div class="error"><%= error %></div>
            <% } %>
            
            <form action="/accounts" method="POST">
                <div class="form-group">
                    <label for="name">Name:</label>
                    <input type="text" id="name" name="name" required autofocus>
                </div>
                <div class="form-group">
                    <label for="pin">PIN (4-stellig):</label>
                    <input type="password" id="pin" name="pin" required pattern="\d{4}" 
                           title="Bitte genau 4 Ziffern eingeben" maxlength="4">
                </div>
                <div class="form-group">
                    <label for="initialBalance">Anfangsguthaben (€):</label>
                    <input type="number" id="initialBalance" name="initialBalance" step="0.01" min="0" value="0.00">
                </div>
                <button type="submit" class="btn">Konto anlegen</button>
                <a href="/accounts" class="btn secondary">Abbrechen</a>
            </form>
        </main>
        
        <footer>
            <p>&copy; 2024 Frühstückskonten Verwaltung</p>
        </footer>
    </div>
</body>
</html>
