.page-sidebar {
    top: #{$header-height};
    left: 0;
    position: fixed;
    z-index: 2;
    height: 100%;
    background-color: #FFF;
    padding-top: 2rem;
    border-right: 1px solid #E8E8E8;
    width: $logged-out-sidebar-width;
    transition: left ease 0.5s;
    &__inner {
        position: absolute;
        width: 100%;
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        border-width: 0 0 ($spacer * 2) 0;
        border-color: transparent;
        border-style: solid;
    }
    .has-header & {
        height: calc(100vh - #{$header-height} - #{$sidebar-bottom-height});
    }
    .logged-in & {
        width: $logged-in-sidebar-width;
    }

    .sidebar-top {
        position: absolute;
        width: 100%;
        left: 0;
        border-top: .33333rem solid $primary;
        padding: 2rem 0 0 2rem;
        .header-left {
            height: auto;
        }
        span {
            padding: 0;
        }
    }

    .sidebar-bottom {
        position: absolute;
        top: 100%;
        left: 0;
        width: $logged-out-sidebar-width;
        background-color: $sidebar-bottom-bg;
        height: $sidebar-bottom-height;
        padding: 0 ($spacer * 2);
        border-right: 1px solid #e8e8e8;
        text-align: center;
        nav {
            a {
                color: $dark;
                font-size: 0.65rem;
                &:after {
                    content: ' | ';
                }
                &:last-child:after {
                    display: none;
                }
            }
        }
        .logged-in & {
            width: $logged-in-sidebar-width;
        }
    }
    .sidebar-hidden & {
        left: #{$logged-out-sidebar-width * -1};
    }
    .sidebar-hidden.logged-in & {
        left: #{$logged-in-sidebar-width * -1};
    }
}

.logged-in .page-sidebar {
    top: $header-height;
    padding-top: 0 !important;
    .sidebar-company li:first-child .dropdown + a {
        padding-top: 0.75rem;
    }
}

.sidebar-wrap {
    padding: 0 ($spacer * 2);
}

// -----------------------------------------------------------------------------
// Anmeldung

.sidebar-auth {
    .tab-content {
        padding-top: 1rem;
    }
    &__buttons {
        margin-top: 1rem;
        .btn {
            width: 100%;
        }
    }
}

// -----------------------------------------------------------------------------
// Suche

.sidebar-search {
    &__input {
        position: relative;
        padding-right: 2.75em;
        input {
            margin: 0;
            padding: 0;
            border: none;
            background: none;
            width: 100%;
        }
        button {
            position: absolute;
            top: 0;
            right: 0;
            width: auto;
            border-color: transparent !important;
            background: none !important;
            margin: 0;
            cursor: pointer;
            .fa {
                opacity: 0.66666;
                position: relative;
                top: -0.15em;
            }
            &:hover,
            &:focus {
                .fa {
                    opacity: 1;
                }
            }
        }
    }
}

// -----------------------------------------------------------------------------
// Company Switcher

.sidebar-company {
    ul {
        list-style: none;
        margin: 0;
        padding: 0;
        li {
            position: relative;
            .dropleft,
            .dropdown,
            .dropup,
            .dropright {
                > a {
                    display: block;
                    color: inherit;
                    position: relative;
                    padding: 0.75em 0 0.75em 2.5em;
                    overflow: hidden;
                    .fa {
                        position: absolute;
                        top: 1.05em;
                        left: 0;
                        width: 1.5em;
                        text-align: center;
                        opacity: 0.66666;
                    }
                    > span {
                        line-height: 1.2;
                        display: inline-block;
                        max-width: 100%;
                    }
                    &:focus,
                    &:hover {
                        text-decoration: none;
                        color: $primary;
                    }
                }
                button {
                    position: absolute;
                    top: 0.75em;
                    right: -0.25em;
                    border: none;
                    background: none;
                    padding: 0;
                    margin: 0;
                    cursor: pointer;
                    width: 1.5em;
                    text-align: center;
                    opacity: 0.66666;
                    overflow: hidden;
                    &:after {
                        @include fontello();
                        content: "\e83f"; // Font Awesome: "caret-down"
                        transition: transform 0.25s;
                    }
                    &:hover,
                    &:focus {
                        opacity: 1;
                        color: $primary;
                    }
                    &:hover {
                        &:after {
                            transform: scale(1.25);
                        }
                    }
                }
            }
        }
    }
}

// -----------------------------------------------------------------------------
// Menü

.sidebar-nav {
    ul {
        list-style: none;
        margin: 0;
        padding: 0;
        li {
            position: relative;
            a {
                display: block;
                color: inherit;
                position: relative;
                padding: 0.75em 0 0.75em 2.5em;
                overflow: hidden;
                .fa {
                    position: absolute;
                    top: 1.05em;
                    left: 0;
                    width: 1.5em;
                    text-align: center;
                    opacity: 0.66666;
                }
                > span {
                    line-height: 1.2;
                    display: inline-block;
                    max-width: 100%;
                }
                &:focus,
                &:hover {
                    text-decoration: none;
                    color: $primary;
                }
            }
            button {
                position: absolute;
                top: 0.75em;
                right: -0.25em;
                border: none;
                background: none;
                padding: 0;
                margin: 0;
                cursor: pointer;
                width: 1.5em;
                text-align: center;
                opacity: 0.66666;
                overflow: hidden;
                &:after {
                    @include fontello();
                    content: "\e83f"; // Font Awesome: "caret-down"
                    transition: transform 0.25s;
                }
                &:hover,
                &:focus {
                    opacity: 1;
                    color: $primary;
                }
                &:hover {
                    &:after {
                        transform: scale(1.25);
                    }
                }
            }
            .sidebar-subnav {
                position: relative;
                &:before {
                    content: "";
                    position: absolute;
                    top: 0;
                    left: #{($spacer * -2)};
                    width: calc(100% + #{($spacer * 4)});
                    height: 100%;
                    background-color: #F3F3F3;
                }
                ul {
                    display: none;
                    a {
                        span {
                            font-size: 0.8em;
                        }
                    }
                    li {
                        &.active {
                            padding-left: 10%;
                        }
                    }
                }
            }
            &.active {
                &:before {
                    content: "";
                    position: absolute;
                    top: 0;
                    left: #{($spacer * -2)};
                    width: 3px;
                    height: 100%;
                    background-color: $primary;
                }
                > a {
                    color: $primary;
                }
            }
            &.has-subnav {
                > a {
                    padding-right: 1.5em;
                }
            }
            &.expanded {
                button {
                    &:after {
                        content: "\f00d"; // Font Awesome: "times"
                    }
                }
            }
        }
    }
}

@media only screen and (max-width: $media-maxW-sm) {
    .page-sidebar {
        width: 100%;
        .sidebar-bottom {
            width: 100%;
        }
    }
    .sidebar-hidden .page-sidebar {
        left: -100%;
    }

    .mobile-nav.page-sidebar {
        width: 100% !important;
        display: block;
        font-size: 1.5em;
        li {
            width: 40%;
            display: inline-block;
            margin: 2%;
            vertical-align: top;
            i {
                font-size: xx-large;
                top: 0 !important;
                display: block;
                width: 100% !important
            }
            span {
                margin-top: 1.5em;
                text-align: center;
                display: block;
            }
            button {
                top: 0.8em;
                right: 1em;
            }
            .sidebar-subnav {
                &:before {
                    left: 0;
                    width: 100%;
                }
                li {
                    float: none;
                    width: 100%;
                    i {
                        font-size: medium;
                        display: inline-block;
                        width: 30% !important;
                        top: 1.2em !important;
                    }
                    span {
                        display: inline-block;
                        margin-top: 0;
                        margin-left: 1.5em;
                    }
                }
            }
            &.active:before {
                left: 0 !important;
            }
        }
    }
    .sidebar-section form.sidebar-item {
        position: relative;
        padding: .75em 0 .75em 2.5em;
        i {
            position: absolute;
            top: 1.05em;
            left: 0;
            width: 1.5em;
            text-align: center;
            opacity: .66666;
        }
        button {
            background-color: transparent;
            border: 0;
            padding-left: 0;
            line-height: 1.2;
        }
    }
}