/* ==========================================================================
   menuBuilder by techNEO – Basis-Stylesheet (gilt für ALLE Themes)
   Reset, Layout, Dropdown-Grundmechanik, Flyout, Badges, Mobile-Verhalten
   ========================================================================== */

/* Akzentfarbe: Fallback, falls kein Inline-Style auf .tn-mb-nav gesetzt ist */
.tn-mb-nav {
    --tn-mb-accent: #0b6aa2;
}

/* --------------------------------------------------------------------------
   Defensiver Reset (Bootstrap-4 / NOVA-Umfeld)
   -------------------------------------------------------------------------- */
.tn-mb-nav,
.tn-mb-nav * {
    box-sizing: border-box;
}

.tn-mb-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tn-mb-nav li {
    margin: 0;
    padding: 0;
}

.tn-mb-nav {
    position: relative;
    display: block;
    font-size: 15px;
    line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Top-Level-Leiste (horizontal, flex)
   -------------------------------------------------------------------------- */
.tn-mb-menu.tn-mb-level-0 {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    position: relative;
}

.tn-mb-item {
    position: relative;
}

/* Links / Nicht-Links einheitlich */
.tn-mb-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.tn-mb-link .fas,
.tn-mb-link .far,
.tn-mb-link .fab,
.tn-mb-link i {
    flex: 0 0 auto;
}

/* Nicht klickbare Überschriften */
.tn-mb-nolink {
    cursor: default;
}

/* --------------------------------------------------------------------------
   Badge / Pill
   -------------------------------------------------------------------------- */
.tn-mb-badge {
    display: inline-block;
    padding: 1px 7px;
    margin-left: 4px;
    font-size: 11px;
    line-height: 1.5;
    font-weight: 600;
    color: #fff;
    border-radius: 10px;
    background: var(--tn-mb-accent);
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Dropdown-Grundmechanik (Desktop)
   Standard versteckt via opacity/visibility, sichtbar bei Hover/Fokus/Open
   -------------------------------------------------------------------------- */
.tn-mb-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity .15s ease, visibility .15s ease, transform .15s ease;
    pointer-events: none;
}

/* Öffnen bei Hover, Tastatur-Fokus (focus-within) oder JS-Klasse */
.tn-mb-item:hover > .tn-mb-dropdown,
.tn-mb-item:focus-within > .tn-mb-dropdown,
.tn-mb-item.tn-mb-open > .tn-mb-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.tn-mb-submenu {
    position: relative;
}

/* --------------------------------------------------------------------------
   Flyout rechts für tiefere Ebenen (Level 1 und tiefer)
   -------------------------------------------------------------------------- */
.tn-mb-submenu .tn-mb-item > .tn-mb-dropdown {
    top: 0;
    left: 100%;
    transform: translateX(4px);
}

.tn-mb-submenu .tn-mb-item:hover > .tn-mb-dropdown,
.tn-mb-submenu .tn-mb-item:focus-within > .tn-mb-dropdown,
.tn-mb-submenu .tn-mb-item.tn-mb-open > .tn-mb-dropdown {
    transform: translateX(0);
}

/* Untermenü-Punkte mit Kindern: Pfeil-Indikator */
.tn-mb-submenu .tn-mb-has-children > .tn-mb-link::after {
    content: "\203A"; /* › */
    margin-left: auto;
    padding-left: 10px;
    font-size: 16px;
    line-height: 1;
}

/* Top-Level-Punkte mit Kindern: Chevron nach unten */
.tn-mb-level-0 > .tn-mb-has-children > .tn-mb-link::after {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 4px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    opacity: .6;
}

/* --------------------------------------------------------------------------
   Hamburger-Toggle: auf Desktop versteckt (JS erzeugt den Button)
   -------------------------------------------------------------------------- */
.tn-mb-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 4px;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

/* Hamburger-Icon aus reinem CSS (kein Icon-Font nötig) */
.tn-mb-toggle::before {
    content: "";
    width: 20px;
    height: 2px;
    background: currentColor;
    box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

/* ==========================================================================
   MOBILE (< 992px): vertikales Accordion, kein Hover
   ========================================================================== */
@media (max-width: 991.98px) {

    .tn-mb-toggle {
        display: inline-flex;
    }

    /* Top-Leiste standardmäßig eingeklappt, per .tn-mb-open am <nav> sichtbar */
    .tn-mb-menu.tn-mb-level-0 {
        display: none;
        flex-direction: column;
        align-items: stretch;
    }

    .tn-mb-nav.tn-mb-open .tn-mb-menu.tn-mb-level-0 {
        display: flex;
    }

    /* Dropdowns werden zu statischen, ausklappbaren Blöcken */
    .tn-mb-dropdown {
        position: static;
        min-width: 0;
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
        display: none;
        transition: none;
    }

    /* Auf Mobil NUR per .tn-mb-open öffnen – Hover/focus-within deaktiviert */
    .tn-mb-item:hover > .tn-mb-dropdown,
    .tn-mb-item:focus-within > .tn-mb-dropdown {
        display: none;
    }

    .tn-mb-item.tn-mb-open > .tn-mb-dropdown {
        display: block;
    }

    /* Flyout aufheben: alles vertikal einrücken */
    .tn-mb-submenu .tn-mb-item > .tn-mb-dropdown {
        left: 0;
        transform: none;
    }

    .tn-mb-submenu .tn-mb-link {
        padding-left: 28px;
    }

    /* Pfeil bei offenem Punkt drehen */
    .tn-mb-item.tn-mb-open.tn-mb-has-children > .tn-mb-link::after {
        transform: rotate(180deg);
    }

    .tn-mb-submenu .tn-mb-has-children > .tn-mb-link::after {
        transform: rotate(90deg);
    }

    .tn-mb-submenu .tn-mb-item.tn-mb-open.tn-mb-has-children > .tn-mb-link::after {
        transform: rotate(-90deg);
    }
}
