/* ============================================================
   FILE: css/12-mobile-nav.css
   VERSION: 4.0
   LAST MODIFIED: March 12, 2026
   DESCRIPTION: Finaler Mobile-Sync via Variablen.
                Hamburger, Suche und Close-Button auf einer Linie.
                v4.0: Anpassung an universellen .submenu-trigger (JS v2.1).
   ============================================================ */

/* 1. SICHTBARKEIT & HEADER-BAR-CLEANUP */
@media (max-width: 1023px) {
    .desktop-sidebar,
    aside.sidebar,
    #secondary {
        display: none !important; /* Sidebar auf Mobile verstecken */
    }

    .mobile-header-bar {
        display: block !important;
        position: relative !important;
        width: 100% !important;
        height: var(--sync-height-mobile) !important; /* SYNC: 40px */
        background: #ffffff !important;
        border: none !important;
        box-shadow: none !important;
        margin-bottom: 15px !important;
        box-sizing: border-box;
    }
}

@media (min-width: 1024px) {
    .mobile-header-bar,
    .mobile-nav-overlay {
        display: none !important;
    }
}

/* 2. DER SYNCHRONISIERTE HAMBURGER (Start bei 15px) */
.mobile-nav-toggle {
    position: absolute !important;
    left: var(--mobile-edge-left) !important; /* SYNC: 15px */
    top: 5px !important;
    width: 34px !important;
    height: var(--sync-inner-height-mobile) !important; /* SYNC: 30px */
    background: var(--primary-color) !important; /* SYNC: Farbe */
    border: none !important;
    cursor: pointer;
    display: flex !important;
    justify-content: center;
    align-items: center;
    padding: 0 !important;
    z-index: 1005;
}

.hamburger-box {
    width: 18px;
    height: 12px;
    position: relative;
    pointer-events: none;
}

.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
    width: 18px;
    height: 2px;
    background-color: #ffffff !important;
    position: absolute;
    display: block;
    content: "";
}
.hamburger-inner {
    top: 5px;
}
.hamburger-inner::before {
    top: -5px;
}
.hamburger-inner::after {
    top: 5px;
}

/* 3. DIE SYNCHRONISIERTE SUCHE (Ende bei 25px) */
.fr-mobile-search {
    position: absolute !important;
    left: calc(var(--mobile-edge-left) + 34px + 15px) !important;
    top: 5px !important;
    height: var(--sync-inner-height-mobile) !important; /* SYNC: 30px */
    display: flex !important;
    z-index: 1002;
}

/* Tablet: Kompakt */
@media (min-width: 601px) and (max-width: 1023px) {
    .fr-mobile-search {
        width: 350px !important;
    }
}

/* Smartphone: Sync mit Rechtskante der H1 */
@media (max-width: 600px) {
    .fr-mobile-search {
        right: var(--mobile-edge-right) !important; /* SYNC: 25px */
    }
}

/* Kleinstgeräte (390px) */
@media (max-width: 390px) {
    .mobile-nav-toggle {
        left: var(--mobile-edge-small) !important;
    }
    .fr-mobile-search {
        left: calc(var(--mobile-edge-small) + 34px + 12px) !important;
        right: 20px !important;
    }
}

.fr-mobile-search .search-form {
    display: flex !important;
    width: 100% !important;
    height: var(--sync-inner-height-mobile) !important;
    background: #fff;
    border: 1px solid var(--primary-color);
    box-sizing: border-box;
}

.fr-mobile-search .search-field {
    flex: 1 !important;
    border: none !important;
    padding: 4px 10px 5px 10px !important;
    font-size: 14px !important;
    font-family: "Open Sans", sans-serif;
    outline: none;
    height: calc(var(--sync-inner-height-mobile) - 2px) !important;
    background: transparent;
}

.fr-mobile-search .search-submit {
    width: 34px !important;
    height: calc(var(--sync-inner-height-mobile) - 2px) !important;
    border: none !important;
    background-color: var(--primary-color) !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.fr-mobile-search .search-submit::before {
    content: "\f002";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #fff;
    font-size: 0.8rem;
}

/* 4. NAVIGATION OVERLAY & SUBMENUS */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 320px;
    height: 100%;
    z-index: 100000;
    transition: left 0.3s ease-in-out;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    visibility: hidden;
}

body.theme-blau .mobile-nav-overlay {
    background-color: #ecf5ff;
}
body.theme-orange .mobile-nav-overlay {
    background-color: #fff4ec;
}

body.mobile-nav-active .mobile-nav-overlay {
    left: 0;
    visibility: visible;
}

.mobile-navigation {
    padding: 60px 0 20px 0;
}

.mobile-menu-list,
.mobile-menu-list ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.mobile-menu-list li {
    position: relative;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-menu-list li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
    padding: 0 20px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: bold;
    border-left: 6px solid transparent;
}

/* Aktive Zustände */
.mobile-menu-list li.current_page_item > a {
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

/* Submenu Pfeil-Logik (Visuell) */
.mobile-menu-list li.page_item_has_children > a::after {
    content: "\203A";
    font-size: 1.8rem;
    display: inline-block;
    transition: transform 0.2s ease;
    color: var(--primary-color);
    margin-left: 10px;
}

.mobile-menu-list li.is-open > a::after {
    transform: rotate(90deg);
}

/* DER UNIVERSELLE TOUCH-TRIGGER (Logik via JS) */
.submenu-trigger {
    position: absolute;
    right: 0;
    top: 0;
    width: 60px; /* Breite der Klickzone für den Pfeil */
    height: 50px; /* Matcht Item-Höhe */
    z-index: 10;
    cursor: pointer;
}

.mobile-menu-list ul.children {
    display: none;
    background: rgba(0, 0, 0, 0.03);
}

.mobile-menu-list li.is-open > ul.children {
    display: block !important;
}

.mobile-menu-list ul.children li a {
    padding-left: 40px;
    font-weight: normal;
    min-height: 44px;
}

/* 5. CLOSE BUTTON (34x30px) */
.mobile-nav-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px !important;
    height: 30px !important;
    border: none;
    color: #fff;
    background: #333;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 !important;
    z-index: 100005;
}

body.theme-blau .mobile-nav-close {
    background-color: var(--brand-blue);
}
body.theme-orange .mobile-nav-close {
    background-color: var(--brand-orange);
}
