/**
 * Copyright JS Foundation and other contributors, http://js.foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **/

.button {
    @include disable-selection;
}

#red-ui-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: $header-background;
    box-sizing: border-box;
    padding: 0px 0px 0px 20px;
    color: $header-menu-color;
    font-size: 14px;

    span.red-ui-header-logo {
        float: left;
        margin-top: 5px;
        font-size: 30px;
        line-height: 30px;
        text-decoration: none;
        white-space: nowrap;

        span {
            vertical-align: middle;
            font-size: 16px !important;
            &:not(:first-child) {
                margin-left: 5px;
            }
        }
        img {
            height: 18px;
        }

        a {
            color: inherit;
            &:hover {
                text-decoration: none;
            }
        }

    }

    .red-ui-header-toolbar {
        padding: 0;
        margin: 0;
        list-style: none;
        float: right;

        > li {
            display: inline-block;
            padding: 0;
            margin: 0;
            position: relative;

        }
    }

    .button {
        min-width: 20px;
        text-align: center;
        line-height: 40px;
        display: inline-block;
        font-size: 20px;
        padding: 0px 12px;
        text-decoration: none;
        color: $header-menu-color;
        margin: auto 5px;
        vertical-align: middle;
        border-left: 2px solid $header-background;
        border-right: 2px solid $header-background;

        &:hover {
            border-color: $header-menu-item-hover;
        }
        &:active, &.active {
            background: $header-button-background-active;
        }
        &:focus {
            outline: none;
        }
    }

    .button-group {
        display: inline-block;
        margin: auto 15px;
        vertical-align: middle;
        clear: both;
        & > a {
            display: inline-block;
            position: relative;
            float: left;
            line-height: 22px;
            font-size: 14px;
            text-decoration: none;
            padding: 4px 8px;
            margin: 0;
        }
    }

    .red-ui-deploy-button {
        background: $deploy-button-background;
        color: $deploy-button-color;

        &:hover {
            background: $deploy-button-background-hover;
        }
        &:focus {
            outline: none;
        }
        &:active {
            background: $deploy-button-background-active;
            color: $deploy-button-color-active;
        }
    }

    .red-ui-deploy-button-spinner {
        position: absolute;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        text-align: center;

        img {
            opacity: 0.8;
            height: 100%;
        }
    }

    #red-ui-header-button-deploy {
        padding: 4px 12px;
        &.disabled {
            cursor: default;
            background: $deploy-button-background-disabled;
            color: $deploy-button-color-disabled;

            .red-ui-deploy-button-content>img {
                opacity: 0.3;
            }
            &+ #red-ui-header-button-deploy-options {
                background: $deploy-button-background-disabled;
                color: $deploy-button-color-active;
            }
            &+ #red-ui-header-button-deploy-options:hover {
                background: $deploy-button-background-disabled-hover;
            }
            &+ #red-ui-header-button-deploy-options:active {
                background: $deploy-button-background-disabled;
            }
        }

        .red-ui-deploy-button-content>img {
            margin-right: 8px;
        }
    }

    .red-ui-deploy-button-group.open {
        #red-ui-header-button-deploy-options {
            background: $header-button-background-active !important;
        }
    }

    li.open .button {
        background: $header-button-background-active;
        border-color: $header-button-background-active;
    }


    ul.red-ui-menu-dropdown {
        background: $header-menu-background;
        border: 1px solid $header-menu-background;
        width: 250px !important;
        margin-top: 0;
        li a {
            color: $header-menu-color;
            padding: 3px 40px;
            img {
                max-width: 100%;
                margin-right: 10px;
                padding: 4px;
                border: 3px solid transparent;
            }

            &.active img {
                border: 3px solid $header-menu-item-border-active;
            }

            span.red-ui-menu-label-container {
                width: 180px;
                vertical-align: top;
                display: inline-block;
                text-indent: 0px;
            }
            span.red-ui-menu-label {
                font-size: 14px;
                display: inline-block;
                text-indent: 0px;
            }
            span.red-ui-menu-sublabel {
                color: $header-menu-sublabel-color;
                font-size: 13px;
                display: inline-block;
                text-indent: 0px;
            }
        }
        > li > a:hover,
        > li > a:focus,
        > li:hover > a,
        > li:focus > a {
            background: $header-menu-item-hover !important;
        }
        li.red-ui-menu-divider {
            background: $headerMenuItemDivider;
        }
        li.disabled a {
            color:  $header-menu-color-disabled;
        }
        > li.disabled > a:hover,
        > li.disabled > a:focus {
            background: none !important;
        }
    }
    .red-ui-menu-dropdown-submenu>a:before {
        border-right-color: $headerMenuCaret;
    }

    /* Deploy menu customisations */
    ul#red-ui-header-button-deploy-options-submenu {
        width: 300px !important;
        li a {
            padding: 10px 30px;
            color: $header-menu-heading-color;
            span.red-ui-menu-label {
                font-size: 16px;
                display: inline-block;
                text-indent: 0px;
            }
            > i.fa {
                display: none;
            }
        }
    }
    /* User menu customisations */
    #usermenu-item-username > .red-ui-menu-label {
        color: $header-menu-heading-color;
    }

    #red-ui-header-button-user .user-profile {
        background-position: center center;
        background-repeat: no-repeat;
        background-size: contain;
        display: inline-block;
        width: 40px;
        height: 35px;
        vertical-align: middle;
    }
}

@media only screen and (max-width: 450px) {
    span.red-ui-header-logo > span {
        display: none;
    }
}
