<!-- Begin Welcome -->
<header class="dashboard-header">
    <h1><a href="<%= typeof user !== 'undefined' && user ? '/dashboard' : '/' %>">🍻g33k.pub Campaign Manager</a></h1>
    <div class="user-info">
        <% if (typeof user !== 'undefined' && user) { %>
            <span>Welcome, <strong><%= user.username %></strong></span>
            
            <!-- Context-specific buttons passed from the route -->
            <% if (typeof contextButtons !== 'undefined' && contextButtons) { %>
                <% contextButtons.forEach(button => { %>
                    <% if (button.type === 'form') { %>
                        <form action="<%= button.action %>" method="<%= button.method || 'POST' %>"<% if (button.style) { %> style="<%= button.style %>"<% } else { %> style="display: inline;"<% } %><% if (button.confirm) { %> onsubmit="return confirm('<%= button.confirm %>');"<% } %>>
                            <% if (button.inputs) { %>
                                <% button.inputs.forEach(input => { %>
                                    <input type="<%= input.type %>" name="<%= input.name %>" value="<%= input.value %>">
                                <% }); %>
                            <% } %>
                            <button type="submit" class="btn btn-small <%= button.class || '' %>"><%= button.text %></button>
                        </form>
                    <% } else { %>
                        <a href="<%= button.href %>" class="btn btn-small <%= button.class || '' %>"><%= button.text %></a>
                    <% } %>
                <% }); %>
            <% } %>
            
            <!-- Always show logout for authenticated users -->
            <form action="/logout" method="POST" style="display: inline;">
                <button type="submit" class="btn btn-small">Logout</button>
            </form>
        <% } else { %>
            <!-- Not logged in - show auth buttons -->
            <div class="auth-buttons">
                <a href="/login" class="btn btn-small btn-primary">Login</a>
                <a href="/register" class="btn btn-small btn-secondary">Register</a>
            </div>
        <% } %>
    </div>
</header>
<!-- End Welcome -->