<header>
    <div class="container nav-container">
        <a href="/" class="logo">Meta<span>Lab</span></a>
        <button class="mobile-menu-btn" id="mobileMenuBtn">
            <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
        </button>
        <ul class="nav-links" id="navLinks">
            <li><a href="/">首页</a></li>
            {{if .IsLoggedIn}}
            <li><a href="/studio/write" class="nav-contribute">
                <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>
                投稿
            </a></li>
            <li>
                <a href="/messages" class="nav-envelope" id="messagesEnvelope" title="消息中心">
                    <svg class="nav-envelope-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/><polyline points="22,6 12,13 2,6"/></svg>
                    <span class="nav-envelope-badge" id="msgBadge" style="display:none">0</span>
                </a>
            </li>
            <li class="nav-avatar-wrapper">
                <a href="/space" class="nav-avatar-link">
                    {{if .Avatar}}
                    <img src="{{.Avatar}}" alt="" class="nav-avatar">
                    <span class="nav-avatar nav-avatar-default" style="display:none">{{substr .Username 0 1}}</span>
                    {{else}}
                    <span class="nav-avatar nav-avatar-default">{{substr .Username 0 1}}</span>
                    {{end}}
                </a>
                <div class="nav-dropdown">
                    <div class="nav-dropdown-header">
                        <div class="nav-dropdown-avatar">
                            {{if .Avatar}}
                            <img src="{{.Avatar}}" alt="">
                            <span style="display:none">{{substr .Username 0 1}}</span>
                            {{else}}
                            <span>{{substr .Username 0 1}}</span>
                            {{end}}
                        </div>
                        <div class="nav-dropdown-meta">
                            <div class="nav-dropdown-username">{{.Username}}</div>
                            {{if .IsLoggedIn}}
                            <div class="nav-dropdown-level">Lv{{.Level}}</div>
                            {{end}}
                        </div>
                    </div>
                    <a href="/settings/profile" class="nav-dropdown-item">
                        <svg class="nav-dropdown-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
                        <span>个人中心</span>
                    </a>
                    <a href="#" class="nav-dropdown-item nav-logout" id="logoutBtn">
                        <svg class="nav-dropdown-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>
                        <span>退出登录</span>
                    </a>
                </div>
            </li>
            {{else}}
            <li><a href="/auth/login" class="nav-login">登录</a></li>
            {{end}}
        </ul>
    </div>
</header>
{{if .IsMaintenance}}
<div class="maintenance-banner">
    <span class="maintenance-banner-icon">&#9881;</span>
    {{if .IsOwner}}
    <span>社区正处于维护状态</span>
    {{else}}
    <span>社区正在维护中，仅站长可访问</span>
    {{end}}
</div>
{{end}}
{{if .IsBanned}}
<div class="maintenance-banner banned-banner">
    <span class="maintenance-banner-icon">ⓘ</span>
    <span>该账号已被封禁</span>
</div>
{{end}}
