/*
CSS für die navbar
 */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #333d43;
    padding: 0 1rem;
}

.nav__left,
.nav__right {
    display: flex;
    align-items: center;
}

.nav__logo img {
    height: 3rem;
}

.nav__center {
    display: flex;
    align-items: center;
}

.nav__item {
    position: relative;
    margin: 0 0.5rem;
}

.nav__dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    padding: 0.5rem 1rem;
    color: #fff;
    text-decoration: none;
}

.nav__dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #f9f9f9;
    min-width: 12rem;
    box-shadow: 0 2px 5px rgba(0,0,0,.15);
    padding: 0.5rem 0;
}

.nav__dropdown-menu a {
    padding: 0.5rem 1rem; /* Abstand um den Text */
    color: #333;
    text-decoration: none;
    font-weight: 600;
}

.nav__dropdown-menu a:hover {
    color: #1d4ed8;
}

.nav__link {
    display: inline-block;
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    color: #fff;
    text-decoration: none;
}

.nav__button {
    display: inline-block;
    background: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    margin-left: 0.5rem;

    white-space: nowrap;
}

.nav__search {
    display: flex;
    align-items: center;
    border-radius: 4px; /* Abgerundete Ecken */
    background: #fff;
    margin: 0 0.5rem;
    width: 100%;
}

.nav__search input {
    flex: 1;
    width: 100%;
}

.nav__search-button {
    display: inline-block;
    background: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    margin-left: 4px;
}

.nav__dropdown:hover .nav__dropdown-menu {
    display: block;
}

.nav__checkbox {
    display: none;
}

.nav__mobile-submenu {
    display: block;
}

.nav__search-form {
    display: flex;
    width: 100%;
    margin: 0;
}

.nav__search {
    flex: 1;
    width: 100%;
}

.nav__search-button {
    display: inline-block;
    background: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    margin-left: 4px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Responsive Anpassung unter 1240px */
@media (max-width: 1240px) {
    .nav {
        flex-wrap: wrap; /* zweite Nav-Zeile*/
        padding: 0.5rem 1rem;
    }

    .nav__left {
        order: 1;
        flex: 1; /* nimmt den Platz ganz links ein */
    }

    .nav__right {
        order: 2;
        flex: 1;
        justify-content: flex-end; /* schiebt Buttons nach ganz rechts */
    }

    .nav__center {
        order: 3;
        flex-basis: 100%; /* Erzwingt, dass dieses Element eine eigene Zeile einnimmt */
        justify-content: center; /*zentriert die Links in der zweiten Zeile */
        padding: 0.5rem 0;
        border-top: 1px solid rgba(255,255,255,0.1); /* Optionale Trennlinie */
        margin-top: 0.5rem;
    }

    .nav__item {
        margin: 0.25rem;
    }
}

#mobile-nav {
    display: none;
}

/* Responsive Anpassungen unter 900px (für z.B. Smartphones) */
@media (max-width: 900px) {
    .nav {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 0 1rem;
    }

    .nav__logo img {
        height: 50px;
    }

    .nav__left {
        order: 2;
        flex: 1;
        justify-content: flex-start;
    }

    .nav__right {
        order: 3;
        width: 100%;
        display: flex;
        margin-top: 0.5em;
    }

    #mobile-nav {
        display: block;
        order: 1;
        background: #333d43;
        border: none;
        color: #fff;
        font-size: 1.5rem;
        padding: 0.5rem 0.1rem;
        border-radius: 0.2rem;
        cursor: pointer;
    }

    .nav__search-button:hover {
        background-color: #f8f9fa;
    }

    /* restliche desktop-navbar aus */
    .nav__center,
    .nav__right .nav__button,
    .nav__right .nav__link {
        display: none;
    }

    /* off canvas menu */
    .nav__mobile-menu {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: -100%; /* kommt von links */
        width: 280px;
        height: 100vh;
        background: #333d43;
        z-index: 1000;
        transition: left 0.3s ease;
        padding: 2rem 1rem;
        box-shadow: 2px 0 10px rgba(0,0,0,0.5);
        overflow-y: auto;

        /* Genug Abstand oben rechts, damit Links nicht hinter dem X liegen */
        padding: 4rem 1.5rem 2rem 1.5rem;
    }

    .nav__checkbox:checked ~ .nav__mobile-menu {
        left: 0;
    }

    .nav_mobile-menu.is-active {
        left: 0;
    }

    .nav__close-btn {
        position: absolute;
        top: 1rem;
        right: 1.5rem;
        font-size: 2rem;
        color: #fff;
        cursor: pointer;
        line-height: 1;
        user-select: none;
        transition: color 0.2s ease, transform 0.2s ease;
    }

    .nav__mobile-menu a {
        color: #fff;
        text-decoration: none;
        font-size: 1.2rem;
        font-weight: 600;
        display: block;
        padding: 0.5rem 1rem;
        border-bottom: 1px solid #333d43;
    }

    .nav__logout-form {
        margin: 0;
    }

    .nav__mobile-logout-button {
        color: #fff;
        text-decoration: none;
        font-size: 1.2rem;
        font-weight: 600;
        display: block;
        width: 100%;
        text-align: left;
        padding: 0.5rem 1rem;
        border: none;
        border-bottom: 1px solid #333d43;
        background: none;
        cursor: pointer;
        font-family: inherit;
    }

    .nav__mobile-submenu {
        display: block;
        list-style: none;
        padding: 0;
        background: rgba(0, 0, 0, 0.15);
    }

    .nav__mobile-label {
        display: flex;
        justify-content: space-between;
        align-items: center;
        color: #fff;
        font-size: 1.2rem;
        font-weight: 600;
        padding: 0.8rem 1rem;
        cursor: pointer;
    }

}