<div class="top-bar">
    <div class="logo">
        <img src="/static/logo.png" alt="Logo">
    </div>
    <div class="title">MrSniff's Admin-Tools Dashboard</div>
    <div class="user-info">
        <div class="username">
            <span>{{ session['username'] }}</span>
        </div>
        <div class="profile-picture">
            <img src="/static/pfps/{{ session['user_id'] }}.png?t={{ session.get('pfp_last_updated', 0) }}"
                 alt="Profilbild"
                 onerror="this.onerror=null; this.src='/static/user_small.png';"
                 style="width: 40px; height: 40px; border-radius: 50%; object-fit: cover;">
        </div>
    </div>
</div>

<style>
    .top-bar {
        width: 100%;
        background-color: #42028B;
        color: white;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 20px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
    }

    .top-bar .logo img {
        height: 60px;
    }

    .top-bar .title {
        flex-grow: 1;
        text-align: center;
        font-size: 24px;
        font-weight: bold;
    }

    .top-bar .user-info {
        display: flex;
        align-items: center;
        margin-right: 5%;
    }

    .top-bar .user-info .username {
        font-size: 18px;
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
        max-width: none;
        margin-right: 10px; /* Abstand zwischen Name und Bild */
    }

    .top-bar .user-info .profile-picture img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        object-fit: cover;
    }

    @media (min-width: 768px) {
        .top-bar .user-info {
            max-width: 25%;
            justify-content: flex-end; /* Benutzerinfo rechts ausrichten */
        }
        .top-bar .user-info .username {
            text-align: right;
            margin-right: 10px;
        }
    }
</style>