<header class="bg-base-100 border-b border-base-300 p-4 flex justify-between  shadow-sm fixed top-0 left-0 right-0 z-20">
    <div>
        <h1 class="text-2xl font-bold text-neutral flex items-center">
            <i class="fas fa-envelope mr-2"></i>
            Email Organizer
        </h1>
        <p class="text-sm mt-1 text-base-content/70">AI-powered email organization</p>
    </div>

    <div class="flex items-center space-x-4">
        <button class="relative p-2 rounded-full hover:bg-base-300 btn-circle">
            <i class="fas fa-bell"></i>
            <span class="badge badge-sm badge-secondary absolute -top-1 -right-1">3</span>
        </button>

        <div class="relative" x-data="{ open: false }" @click.outside="open = false">
            <button id="user-menu-button" class="flex items-center space-x-2 p-2 rounded-lg hover:bg-base-300"
                @click="open = !open">
                <div class="w-8 h-8 rounded-full bg-primary flex items-center justify-center">
                    <span class="font-semibold text-primary-content">{{ current_user.first_name[0] }}{{
                        current_user.last_name[0] }}</span>
                </div>
                <span class="hidden md:inline">{{ current_user.first_name }} {{ current_user.last_name }}</span>
                <i class="fas fa-chevron-down"></i>
            </button>

            <!-- User Dropdown -->
            <div id="user-dropdown"
                class="user-dropdown absolute right-0 mt-2 w-48 rounded-md shadow-lg py-1 bg-base-100 z-10"
                x-show="open">
                <a href="#" class="block px-4 py-2 text-sm hover:bg-base-300">Profile</a>
                <a href="#" class="block px-4 py-2 text-sm hover:bg-base-300">Settings</a>
                <a href="{{ url_for('auth.logout') }}" class="block px-4 py-2 text-sm hover:bg-base-300">Logout</a>
            </div>
        </div>
    </div>
</header>