@import 'variables';

$top-bar-bg: #2a2929;

.top-bar {
    position: fixed;
    padding: 0 24px;
    background-color: $top-bar-bg;
    width: 100%;
    top: 0;
    height: $top-bar-height;
    transition: background-color 0.7s;
    z-index: 10;
    display: flex;
    align-items: center;

    .top-bar-content {
        display: flex;
        flex: 1;
        align-items: center;
        max-width: $container-max-width;
        margin: auto;
    }

    @media all and (max-width: $sm-breakpoint) {
        padding: 12px;
        font-size: $font-size-14;
    }

    &.landing-page {
        background-color: transparent;
        .right {
            a:link,
            a:visited {
                color: $gray-700;
            }
            a:hover {
                color: $gray-500;
                text-decoration: none;
            }
        }
        .submenu .trigger-icon {
            filter: invert(0.3);
        }

        &.floating {
            background-color: $top-bar-bg;

            .submenu .trigger-icon {
                filter: invert(0.8);
            }

            .right {
                a:link,
                a:visited {
                    color: $gray-400;
                }
                a:hover {
                    color: $gray-100;
                    text-decoration: none;
                }
            }
        }
    }

    .flex-spacer {
        flex: 1;
    }

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

    .logo {
        img {
            max-width: 32px;
            margin-right: 12px;
        }
        display: flex;
        align-items: end;
        color: $brand-color;
        font-size: 18px;
        font-size: 24px;
        letter-spacing: 0px;
        font-weight: 600;

        .logotype {
            font-family: $brand-font-face;
            display: inline-block;
            margin-right: 12px;
            @media all and (max-width: $sm-breakpoint) {
                display: none;
            }
        }
    }

    .version-label {
        display: inline-block;
        background-color: #ffd400;
        padding: 3px 6px;
        border-radius: 3px;
        font-size: 14px;
        font-weight: bold;
        text-transform: uppercase;
        color: #736108;
    }

    .right {
        display: flex;
        a {
            margin-left: 18px;
        }
        a:link,
        a:visited {
            color: $gray-400;
        }
        a:hover {
            color: $gray-100;
            text-decoration: none;
        }
        @media all and (max-width: $sm-breakpoint) {
            text-align: right;
            a {
                margin-left: 12px;
            }
        }
    }

    .submenu {
        position: relative;
        .trigger {
            display: flex;
            align-items: flex-end;
        }
        .trigger-icon {
            transform: rotateZ(180deg);
            width: 12px;
            height: 12px;
            filter: invert(0.8);
            margin-left: 3px;
            margin-bottom: 2px;
        }

        .overlay {
            position: absolute;
            @media all and (max-width: $sm-breakpoint) {
                top: 28px;
            }
            top: 34px;
            right: 0;
            border-radius: 2px;
            visibility: hidden;
            overflow: hidden;
            height: 0;
            background-color: $top-bar-bg;
            padding: $padding-4;
            box-shadow: 0px 5px 3px 0px rgba(0, 0, 0, 0.21);
            opacity: 0;
            a:link,
            a:visited {
                margin: $padding-16 $padding-8;
                color: $gray-400;
            }
            &.expanded {
                visibility: visible;
                height: auto;
                opacity: 1;
                transition: visibility 0s, opacity 0.2s;
            }
        }

        .overlay a {
            display: flex;
            align-items: center;
            // justify-content: space-between;
            flex: 1;
            .menu-icon {
                width: 24px;
                height: 24px;
                filter: contrast(0);
                margin-right: 12px;
            }
        }
    }

    .search-input {
        display: flex;
    }
    #searchInput {
        width: 100%;
        border-radius: 3px;
        border: 1px solid $gray-900;
        padding: 6px 9px;
        background-color: transparentize($gray-300, 0.2);
        color: $gray-900;
        transition: background-color 0.2s;
        margin: 0;

        &:focus {
            background-color: $gray-300;
        }
        @media all and (max-width: $sm-breakpoint) {
            background-color: $gray-300;
        }
    }
    button.search-icon {
        background-color: transparent;
        padding: 0;
        margin: 0;
        border: none;
        display: none;
        img {
            width: 24px;
            height: 24px;
        }
        @media all and (max-width: $sm-breakpoint) {
            display: block;
        }
    }
}
