{{ define "base" }}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ .Title }} - inBOXER</title>
    <link rel="stylesheet" href="/static/style.css">
    <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>📬</text></svg>">
</head>
<body>
    {{ if .ShowNav }}
    <nav class="navbar">
        <div class="container">
            <a href="/" class="navbar-brand">📬 inBOXER</a>
            <div class="navbar-menu">
                {{ if .UserEmail }}
                    <a href="/dashboard" class="navbar-item {{ if eq .CurrentPage "dashboard" }}active{{ end }}">Dashboard</a>
                    <a href="/settings" class="navbar-item {{ if eq .CurrentPage "settings" }}active{{ end }}">Settings</a>
                    <a href="/logout" class="navbar-item">Logout</a>
                {{ else }}
                    <a href="/login" class="navbar-item {{ if eq .CurrentPage "login" }}active{{ end }}">Login</a>
                {{ end }}
            </div>
        </div>
    </nav>
    {{ end }}

    <main class="container">
        {{ if .Flash }}
        <div class="alert alert-{{ .Flash.Type }}">
            {{ .Flash.Message }}
        </div>
        {{ end }}

        {{ template "content" . }}
    </main>

    {{ if .ShowFooter }}
    <footer class="footer">
        <div class="container">
            <p>inBOXER &copy; {{ .CurrentYear }} v{{ .Version }} | Email classification powered by AI</p>
        </div>
    </footer>
    {{ end }}
</body>
</html>
{{ end }}