/* --- 3. CUSTOM UNTERE NAVIGATION (Nicholas Bereich) --- */
#bb-custom-user-nav {
    display: block !important;
    background: transparent !important;
    z-index: 9999;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    padding: 0 !important;
    border-top: none !important;
    margin-top: 20px;
}

.bb-side-sep {
    height: 1px;
    background: rgba(0,0,0,0.05);
    margin: 15px 12px;
}

/* LINKS: Nachrichten & Benachrichtigungen */
.bb-side-item {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 12px 15px !important;
    text-decoration: none !important;
    color: #495057 !important;
    font-size: 14px !important;
    font-weight: 300 !important;
    border-radius: 8px !important;
    transition: all 0.15s ease !important;
    box-sizing: border-box !important;
    margin: 0 8px 4px 8px !important;
}

/* BuddyBoss Icons styling */
.bb-side-item i.bb-icon-l {
    font-size: 20px !important;
    width: 22px;
    min-width: 22px;
    margin-right: 7px;
    text-align: center;
    opacity: 0.7 !important;
    color: #495057 !important;
}


.bb-side-item:hover {
    background-color: #F2F4F5 !important;
    color: #495057 !important;
    text-decoration: underline !important;
    transform: none !important;
}

.bb-side-item:hover i.bb-icon-l {
    opacity: 1 !important;
    color: inherit !important;
}

/* DAS BADGE (Perfektes Quadrat ganz rechts) */
.bb-side-badge {
    background: #6f4aa2 !important;
    color: #fff !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 18px !important;
    height: 18px !important;
    padding: 0 !important;
    border-radius: 4px !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
    margin-right: 0 !important;
}

/* --- 4. PROFIL-ZEILE (Avatar & 3 Dots) --- */
.bb-side-user-row {
    display: flex !important;
    align-items: center !important;
    padding: 10px 12px !important;
    margin: 0 8px !important;
    box-sizing: border-box !important;
    justify-content: space-between !important;
}

.bb-side-user-link {
    display: flex !important;
    align-items: center !important;
    text-decoration: none !important;
    min-width: 0 !important;
}

.bb-side-user-link:hover .bb-side-name {
    text-decoration: underline !important;
}

.bb-side-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
    flex-shrink: 0;
}

.bb-side-name {
    font-weight: 500 !important;
    color: #111 !important;
    font-size: 14px !important;
    flex-grow: 1 !important;
}

.bb-menu-container {
    margin-left: 12px !important;
}

/* DIE 3 PUNKTE (Rund & am rechten Rand) */
.bb-side-dots {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    border: none !important;
    background: #F2F4F5 !important;
    color: #495057 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    flex-shrink: 0 !important;
    padding: 0 !important;
    font-size: 16px !important;
}

/* --- 5. POPUP STYLING --- */
.bb-custom-popup {
    display: none;
    position: absolute;
    bottom: 45px;
    right: 8px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.1);
    min-width: 180px;
    z-index: 10001;
    overflow: hidden;
}

.bb-custom-popup.is-active {
    display: block !important;
}

.bb-custom-popup a {
    display: flex !important;
    align-items: center !important;
    padding: 12px 15px !important;
    font-size: 13px !important;
    color: #495057 !important;
    text-decoration: none !important;
    border-bottom: 1px solid #f0f0f0 !important;
    font-weight: 300 !important;
}

.bb-custom-popup a:hover {
    background: #F2F4F5 !important;
    text-decoration: none !important;
}

.bb-custom-popup a i {
    margin-right: 8px !important;
    font-size: 14px !important;
    color: #6c757d !important;
    width: 16px;
    min-width: 16px;
    text-align: center;
}

/* --- 5. RESPONSIVE & POPUP --- */
/* --- 2. DESKTOP SPEZIFISCH (Fix für Admin vs. User) --- */
@media screen and (min-width: 1025px) {
    /* Standard für reguläre User (ohne Admin-Bar) */
    .side-panel-inner #bb-custom-user-nav {
        position: absolute !important;
        bottom: 20px !important; /* Etwas tiefer für User ohne Bar */
        left: 0 !important;
        right: 0 !important;
        padding: 0 12px;
    }

    /* Korrektur NUR für Admins (wenn Admin-Bar vorhanden ist) */
    /* WordPress fügt die Klasse .admin-bar zum body hinzu */
    body.admin-bar .side-panel-inner #bb-custom-user-nav {
        bottom: 40px !important;
    }
}

@media screen and (max-width: 1024px) {
    .bb-mobile-panel-inner nav.main-navigation ul,
    .bb-mobile-panel-inner nav.main-navigation li {
        display: block !important;
        height: auto !important;
    }

    #bb-custom-user-nav.is-mobile {
        position: relative !important;
        display: block !important;
        width: 100% !important;
        margin-top: 40px !important;
        padding: 20px 15px !important;
        border-top: 1px solid rgba(0,0,0,0.08);
        background: #fff !important;
    }
}

.bb-custom-popup {
    display: none;
    position: absolute;
    bottom: 45px;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.1);
    min-width: 170px;
    z-index: 10001;
    overflow: hidden;
}
.bb-custom-popup.is-active { display: block !important; }
.bb-custom-popup a { display: block; padding: 12px 15px; font-size: 13px; color: #333; text-decoration: none; border-bottom: 1px solid #f0f0f0; }
.bb-custom-popup a:hover { background: #faf7ff; }

/* --- 6. SUCHE-MENÜPUNKT --- */

.buddypanel-menu > li {
    margin-bottom: 8px !important;
}

.buddypanel-menu > li > a.bb-menu-item[href="#search-open"] > i.bb-icon-search {
    font-size: 20px !important;
}


.buddypanel-menu > li > a.bb-menu-item[href="#search-open"]:hover,
.buddypanel-menu > li > a.bb-menu-item[href="#search-open"]:hover .link-text {
    text-decoration: underline !important;
}

/* --- 7. HEADER (Masthead) mit Slide-Down-Animation --- */
/* Statt display:none nutzen wir max-height + overflow, damit eine Transition möglich ist.
   BuddyBoss' eigenes CSS fadet zusätzlich .header-search-wrap (opacity 0→1, 0.2s linear). */
.site-header {
    max-height: 0 !important;
    overflow: hidden !important;
    transition: max-height 0.3s ease !important;
}

/* Aside (Nachrichten/Benachrichtigungen) bleibt immer versteckt */
.site-header #header-aside {
    display: none !important;
}

/* Beim Klick auf Sidebar-Suche: Header ausklappen.
   BB-Theme nutzt --bb-header-height für die natürliche Header-Höhe. */
body.search-visible .site-header {
    max-height: var(--bb-header-height, 80px) !important;
}
