#page-wrapper .navbar {
    background-color: #fff;
    border-bottom: solid 1px rgba(144, 144, 144, 0.35);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    color: #484b49;
    cursor: default;
    font-weight: 300;
    height: 4em;
    max-height: 4em;
    left: 0;
    position: fixed;
    text-transform: $text-transform;
    width: 100%;

    &.fixed-top {
        align-items: center;
    }

    .dropdown-divider {
        border-top: 1px solid fix-color-contrast($secondary, $header-bg-color);
    }

    &.navbar-light {
        .navbar-nav {
            .nav-link:hover,
            .nav-link:focus,
            .nav-link {
                color: choose-contrast-color($header-bg-color);
            }
            .editmode-switch-form,
            .editmode-switch-form .text-primary {
                color: choose-contrast-color($header-bg-color) !important;
            }
        }
        &.bg-white {
            background-color: $header-bg-color !important;
        }
    }

    .site-name {
        color: choose-contrast-color($header-bg-color);
        font-weight: bold;
        letter-spacing: 0.08rem;
        height: inherit;
        left: 1.25em;
        line-height: inherit;
    }

    .simplesearchform [type="submit"] {
        margin: 0;
        background-color: $primary;
        color: choose-contrast-color($primary);
    }

    .navbar-nav {
        .popover-region .icon {
            font-weight: 600;
        }
    }

    .trema-custom-menu {
        overflow: visible;
    }

    .d-inline-block.mr-3 button {
        background-color: #fff;
        border: solid 1px rgba(144, 144, 144, 0.35);
    }

    .popover-region-container {
        top: 3.6rem;
    }

    .popover-region-toggle:before {
        bottom: -21px;
    }

    .popover-region-toggle:after {
        bottom: -22px;
    }

    .action-menu-trigger .dropdown-toggle:after {
        content: none;
    }

    .search-input-wrapper > div .icon {
        margin-top: .75rem;
    }

    .lang-menu {
        .dropdown-menu {
            top: 45px;
            left: -100px;
        }
        #user-action-menu {
            top: 70px;
            left: -126px;

            .fa {
                font-size: 16px;
            }

            &:before {
                content: "";
                display: inline-block;
                border-left: 10px solid transparent;
                border-right: 10px solid transparent;
                border-bottom: 10px solid #ddd;
                position: absolute;
                top: -10px;
                right: 7px;
            }

            &:after {
                content: "";
                display: inline-block;
                border-left: 9px solid transparent;
                border-right: 9px solid transparent;
                border-bottom: 9px solid #fff;
                position: absolute;
                top: -8px;
                right: 8px;
                z-index: 2;
            }
        }
    }

    .usermenu {
        color: choose-contrast-color($loginbtn-bg-color);
        margin-right: 1rem;

        .login {
            line-height: 1.5;
            a {
                padding: 5px 20px;
                background-color: $loginbtn-bg-color;
                color: choose-contrast-color($loginbtn-bg-color);
                @if ($loginbtn-bg-color != $white) {
                    border: 1px solid $gray-500;
                }
                text-decoration: none;
            }
            a:hover,
            a:focus,
            a:active {
                background-color: choose-contrast-color($loginbtn-bg-color);
                @if ($loginbtn-bg-color == $header-bg-color) {
                    border: 1px solid $gray-500;
                }
                color: choose-contrast-color(choose-contrast-color($loginbtn-bg-color));
            }
        }

        .usertext {
            color: choose-contrast-color($header-bg-color);
            margin-top: 0.1rem;
            @media (max-width: 768px) {
                display: none !important;
            }
        }

        @media (max-width: 768px) {
            .login {
                line-height: 1;
                text-transform: none;
            }
        }

        .dropdown-menu {
            top: 4rem;
            right: -60px;
        }

        .avatar.current {
            img {
                height: 2.5rem;
                width: 2.5rem;
            }
        }
        .dropdown-menu {
            top: 2.5rem;
            right: -60px;
            padding-top: 1rem;
            border: none;
            background: transparent;
            #usermenu-carousel {
                background: white;
                border: 1px solid rgb(0, 0, 0, .15);
                padding: .5rem;
            }
            &:before {
                content: "";
                display: inline-block;
                border-left: 9px solid transparent;
                border-right: 9px solid transparent;
                border-bottom: 9px solid #fff;
                position: absolute;
                top: 8px;
                right: 90px;
                z-index: 1001;
            }
            &:after {
                content: "";
                display: inline-block;
                border-left: 9px solid transparent;
                border-right: 9px solid transparent;
                border-bottom: 9px solid rgba(0, 0, 0, .5);
                position: absolute;
                top: 7px;
                right: 90px;
                z-index: 2;
            }
        }
        .dropdown-toggle::after {
            color: choose-contrast-color($header-bg-color);
        }
    }

    .primary-navigation {
        .navigation .nav-link {
            color: choose-contrast-color($header-bg-color);
            border-top: 3px solid transparent;
            transition: all ease-in 300ms;
            padding-top: 0.5em;
            &.active {
                font-weight: normal;
                color: choose-contrast-color($header-bg-color);
                &:focus,
                &:hover {
                    color: $dark;
                }
            }
            &:focus:not(.active),
            &:hover:not(.active) {
                border-bottom: 3px solid #7a7a7a;
                &:hover {
                    color: $dark;
                }
            }
        }
        padding-top: 2px;
        flex-grow: 1;
        display: flex;
        justify-content: $custom-menu-alignment;
    }

    .dropdown-item:hover,
    .dropdown-item:focus,
    .dropdown-item:focus-within {
        background-color: $primary;
        color: choose-contrast-color($primary);
    }

    .form-switch .form-check-input {
        border-radius: 2em;
    }
}

#page-wrapper .navbar-light .navbar-brand {
    color: choose-contrast-color($header-bg-color);
    font-weight: 400;
    text-wrap: wrap;
    overflow: hidden;
    font-size: calc(1.25rem * #{$sitename-font-scale});
    line-height: calc(1.25rem * #{$sitename-font-scale} + 0.05rem);
    max-width: 260px;
    max-height: 42px;
    width: fit-content;
    &:hover,
    &:focus {
        font-weight: 500;
    }
    @media (max-width: 600px) {
        font-size: calc(0.9rem * #{$sitename-font-scale});
        line-height: calc(0.9rem * #{$sitename-font-scale} + 0.05rem);
    }
    img {
        width: -webkit-fill-available;
    }
}
.drawerheader .sitename {
    text-wrap: wrap;
    overflow: hidden;
    line-height: 1.1rem;
}

#page .secondary-navigation {
    .navigation .nav-link {
        color: fix-color-contrast($primary);
        border-top: 3px solid transparent;
        text-decoration: none;
        transition: all ease-in 100ms;
        &.active {
            font-weight: normal;
            color: $dark;
        }
        &:hover:not(.active) {
            border-bottom: 3px solid #7a7a7a;
        }
    }
}

.sr-only-focusable {
    &:active,
    &:focus {
        z-index: 10001;
    }
}

.notloggedin {
    #page-wrapper .navbar {
        .usermenu {
            padding-right: 0;
        }
    }
}

#page.drawers {
    height: calc(100vh - 4em);
    margin-top: 4em;
}

@media (max-width: 767.98px) {
    #page-wrapper .navbar {
        padding: 0 .5rem;
        .primary-navigation {
            display: none;
        }
        .d-inline-block.mr-3 button {
            border: 0 none;
            padding: 0;
        }
        .navbar-brand.d-none {
            display: flex !important;
            margin-left: 8px !important;
            overflow: hidden;
        }
        .usermenu {
            padding-right: 0;
            .avatar.current {
                position: relative;
                right: 0;
                top: 0;
            }
            .dropdown .dropdown-toggle {
                padding: 0;

            }
        }
    }
}

.navbar-light {
    .navbar-toggler-icon {
        @if ($nav-color == $white) {
            background-image: escape-svg($navbar-dark-toggler-icon-bg);
        }
    }
}
