/* =============================================================
   Bootstrap 5 Navigation – vollständiges sauberes CSS
   ============================================================= */

/* Basis Navbar */
.navbar {
    background-color: var(--pb-header-navi-bg, #ddd) !important;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

/* UL der Navigation */
.navbar-nav {
    display: flex;
    flex-direction: row;
    gap: 4px;
    margin: 0;
    padding: 0;
}

/* Einzelne Einträge */
.navbar-nav .nav-item {
    list-style: none;
    position: relative;
    overflow: visible !important;
}

/* Normale Links */
.navbar-nav .nav-link {
    display: block;
    padding: 8px 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    background: var(--pb-header-navi-item-bg, #e6e6e6);
    color: var(--pb-link-color-navigation, #333);
}

/* Hover */
.navbar-nav .nav-link:hover,
.navbar-nav .nav-item:hover > .nav-link {
    background: var(--pb-link-hover-color-navigation-bg, #ccc);
    color: var(--pb-link-hover-color-navigation, #000);
}

/* Aktiver Menüpunkt */
.navbar-nav .nav-link.active,
.navbar-nav .nav-item.active > .nav-link {
    background: var(--pb-component-active-bg, #87C9A3);
    color: var(--pb-component-active-color, #fff);
}

/* ==========================================
   DROPDOWN
   ========================================== */

.dropdown-menu {
    position: absolute !important;
    top: 100%;
    left: 0;
    z-index: 99999 !important;

    min-width: 220px;
    padding: 0.4rem 0;
    border-radius: 6px;

    background: #fff !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.20);

    display: none;
    opacity: 0;
    visibility: hidden;
}

/* Dropdown-Einträge */
.dropdown-item {
    padding: 8px 14px;
    color: var(--pb-link-color-navigation, #333);
    background: transparent !important;    /* <<< FALSCH war: purple, #ccc */
}

.dropdown-item:hover {
    background: var(--pb-link-hover-color-navigation-bg, #ccc) !important;
    color: var(--pb-component-active-color, #fff) !important;
}

/* Dropdown sichtbar */
.nav-item.dropdown.show > .dropdown-menu,
.dropdown-menu.show,
.nav-item.dropdown:hover > .dropdown-menu,
.nav-item.dropdown[aria-expanded="true"] > .dropdown-menu {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Pfeil */
.dropdown-toggle::after {
    display: inline-block;
    margin-left: .3em;
    vertical-align: .2em;
    content: "";
    border-top: .3em solid;
    border-right: .3em solid transparent;
    border-left: .3em solid transparent;
}

/* ==========================================
   FIX: Verwaltung-Button darf beim Klick 
   NICHT verschwinden
   ========================================== */

/* Grundzustand – immer sichtbar */
.nav-item.dropdown > .nav-link {
    background: var(--pb-header-navi-item-bg, #e6e6e6);
    color: var(--pb-link-color-navigation, #333);
}

/* Wenn Dropdown geöffnet ist */
.nav-item.dropdown.show > .nav-link {
    background: var(--pb-component-active-bg, #87C9A3) !important;
    color: #fff !important;
}
.navbar-nav .dropdown-toggle {
    display: inline-block !important;
}

/* ==========================================
   MOBILE
   ========================================== */
@media (max-width: 991.98px) {

    .navbar-collapse .navbar-nav {
        flex-direction: column !important;
        gap: 0;
    }

    .navbar-nav .nav-item {
        width: 100%;
    }

    .navbar-nav .nav-link {
        width: 100%;
        border-radius: 0 !important;
        padding: 4px 4px;
        border: 1px solid black;
    }

    /* Dropdown im Mobile untereinander, aber NICHT sichtbar */
    .dropdown-menu {
        position: static !important;
        width: 100% !important;
        margin: 0 !important;
        background: #fff;
        box-shadow: none !important;

        /* ? Sichtbarkeit NICHT mehr erzwingen */
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }

    /* Wenn geöffnet ? sichtbar machen */
    .nav-item.dropdown.show > .dropdown-menu,
    .dropdown-menu.show {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .dropdown-item {
        padding-left: 2rem;
        padding: 4px 4px;
    }
    .navbar-brand {
        display: none;
    }
}
