// menu.scss
// Styling for the superdesk top menu and sidebar main menu
// ----------------------------------------------------------------------------------------
@import '~variables.scss';
@import '~mixins.scss';


/*
====================================================
    Main navigation
====================================================
*/

//beta switch button
.beta-switch {
    background: none !important;
    border-right: none !important;
    margin-right: 8px;
    span {
        height: 14px;
        font-size: 10px;
        letter-spacing: 0.04em;
        padding: 4px 8px;
        border: 1px solid;
        background-color: rgba(0,0,0,0.12);
        transition: background-color ease-in-out 0.2s;
        @include border-radius(2px);
        &:hover {
            background-color: rgba(0,0,0,0.5);
        }
        &.stable {
            color: rgba(255,255,255,0.4);
            border-color: rgba(255,255,255,0.2);
        }
        &.beta {
            color: rgba(0,184,119,1);
            border-color: rgba(0,184,119,0.4);
        }
    }
}

// top menu
#top-menu {
    background: #2c2c2c;
    height: $nav-height;
    position: fixed;
    right: 0;
    left: 0;
    top: 0;
    z-index: $zindexFixedNavbar;
    margin-bottom: 0; // remove 18px margin for static navbar
    transition: all 0.3s ease;
    &.menu-open {
        left: $sf-main-menu-width !important;
        right: 0 !important;
        .collapse-nav {
            margin-left: -48px;
            background: rgba(0,0,0,0.02) !important;
            &:hover {
                background: rgba(0,0,0,0.4) !important;
            }
        }
    }

    &.test-environment {
        background: #3783a2;
        &:after {
            content: attr(data-text);
            color: black;
            font-size: 47px;
            color: black;
            top: 13px;
            position: absolute;
        }
    }
    .current-user {
        width: $nav-height;
        height: $nav-height;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        @include box-shadow(none);
        background-color: rgba(0,0,0,0.25);
        transition: background-color ease-in-out 0.2s;
        .badge {
            position: absolute;
            top: 4px;
            right: 4px;
            text-shadow: none;
            z-index: 1;
        }
        &:hover {
            background-color: rgba(0,0,0,0.50);
        }
    }

    #hamburger-menu {
        a, button {
            height: $nav-height;
            display: inline-block;
            line-height: $nav-height;
            padding: 0 25px;
            background: #202020;
            border:0;
            @include text-normal();
    
            &:hover {
                text-decoration: none;
                background: #000;
            }
    
            &.main-link {
                font-size: 15px;
                color: #aaa;
            }
    
            //main nav toggle button
            &.collapse-nav {
                width: $nav-height !important;
                text-align: center;
                padding: 0;
                line-height: 0;
                transition: all 0.3s ease;
                &:hover {
                    background: #101010;
                    cursor: pointer;
                }
            }

        }
    }

    .top-nav {
        height: $nav-height;
        float: left;
    }
    .dropdown {
        position: relative;
        float: left;
        &.navbtn, button {
            @include box-shadow(none);
            border: none;
            width: auto;
            .name {
                display: block;
                float: left;
                min-width: 155px;
                max-width: 200px;
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
                text-align: left;
                text-transform: uppercase;
            }
        }
        &.open {
            .dropdown__toggle {
                background-color: $white;
                color: #5aa1bf;
                .dropdown__caret {
                    border-top-color: #595959;
                }
                &.workspace {
                    background-color: $white;
                    color: $purple;
                }
                &.desk--closed {
                    background-color: $white;
                    color: $red;
                }
            }
        }
        .dropdown__toggle {
            background-color: $sd-blue;
            color: $white;
            padding: 0 15px;
            font-size: 12px;
            overflow: hidden;
            .dropdown__caret {
                border-top-color: $white;
            }
            &.workspace {
                background-color: $purple;
            }
            &.desk--closed {
                background-color: $red;
            }
        }
        .dropdown__menu {
            min-width: 295px;
            max-height: 550px;
            overflow: auto;
            margin: 0;
            padding: 0;
            z-index: 4;
            .dropdown__menu-label {
                font-size: 10px;
                color: $grayLight;
                padding: 5px 15px;
                margin-top: 9px;
                border-top: 1px solid #ebebeb;
                &:first-of-type {
                    margin-top: 0;
                    border-top: 0;
                }
            }
            .no-desk {
                width: 100%;
                background-color: $white;
                color: $grayLight;
                border: none;
                height: auto;
                font-size: 12px;
                line-height: 1.3em;
                margin: 0;
                padding: 10px 15px;
                border-radius: 0;
            }
            button {
                width: 100%;
                background-color: $white;
                color: $sd-blue-text;
                border: none;
                height: auto;
                font-size: 12px;
                line-height: 1.3em;
                margin: 0;
                padding: 10px 15px;
                border-radius: 0;
                text-transform: uppercase;
                position: relative;
                &[disabled] {
                    &:hover {
                        cursor: default;
                        background-color: $white;
                    }
                }
                &.action-btn {
                    font-size: 13px;
                    margin-top: 9px;
                    padding: 12px 15px;
                    text-transform: none;
                    color: #757676;
                    border-top: 1px solid #ebebeb;
                }
                &:hover {
                    background-color: #eef5f8;
                }
            }
            .workspace-item {
                button {
                    color: $purple;
                }
            }
            .desk-item--closed, .desk-item--receiving {
                button {
                    &::after {
                        font-family: 'sd_icons';
                        position: absolute;
                        right: 8px;
                        top: 9px;
                        width: 16px;
                        height: 16px;
                        line-height: 16px;
                        font-size: 16px;
                        font-family: 'sd_icons';
                        font-style: normal;
                        font-weight: normal;
                        font-variant: normal;
                        text-transform: none;
                        -webkit-font-smoothing: antialiased;
                        -moz-osx-font-smoothing: grayscale;
                    }
                }
            }
            .desk-item--closed {
                button {
                    color: $red;
                    background-color: rgba(229, 28, 35, 0.08);
                    &::after {
                        content: "\e625";
                        color: $red;
                    }
                    &:hover {
                        background-color: rgba(229, 28, 35, 0.16);
                    }
                }
            }
            .desk-item--receiving {
                button {
                    &::after {
                        content: "\e624";
                        color: $green;
                    }
                }
            }
        }
    }
    .top-menu__content-block {
        display: flex;
        align-items: center;
        &--right {
            margin-left: auto;
            float: right;
        }
    }
    .top-menu__info {
        display: flex;
        height: 30px;
        padding: 0 20px;
        background-color: rgba(0,0,0,0.5);
        line-height: 1;
        color: $white;
        font-size: 12px;
        border-radius: 15px;
        align-items: center;
        white-space: nowrap;
        max-width: 700px;
    }
    .top-menu__info-label {
        font-weight: 300;
        color: rgba(255, 255, 255, 0.5);
        padding-right: 5px;
    }
    .top-menu__info-text {
        font-weight: 400;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .top-menu__info-icon {
        margin-right: 6px;
        color: inherit;
        &--green {
            color: $green;
        }
        &--red {
            color: $red;
        }
    }
}

.top-menu-dropdown-button {
    padding-left: 1.6rem;
    padding-right: 1.6rem;
    z-index: 2;
    color: $white;
    background-color: rgba(255,255,255,0.06);
    transition: background-color ease-in-out 0.2s;

    &:disabled {
        cursor: default;
    }

    &:not([disabled]):hover {
        background-color: rgba(255,255,255,0.1);
    }
    &--active {
        color: $sd-text;
        background-color: rgba(255,255,255,1);
        &:hover {
            background-color: rgba(255,255,255,1);
        }
    }
    &--pulsate {
        animation: pulsateBG ease-in-out 3s infinite;
        &:hover {
            background-color: $pulsateBG-on;
            animation: none;
        }
    }
}

.top-menu-dropdown-button--active {
    &.top-menu-dropdown-button--pulsate {
        color: $sd-text;
        background-color: rgba(255,255,255,1);
        animation: none;
        &:hover {
            background-color: rgba(255,255,255,1);
        }
    }
}

#side-menu {
    position: absolute;
    width: $sidebar-width;
    top: $nav-height;
    left: 0;
    bottom: $authoring-opened-articles;
    background-color: $sidebar-background;
    z-index: $zindexFixedNavbar - 1;
    @include box-shadow(2px 0 5px 0 rgba(0,0,0,0.25));
    @include transition( all 0.3s ease);
    &.menu-open {
        left: $sf-main-menu-width !important;
        right: 0 !important;
    }
    hr {
        width: $sidebar-width / 2;
        margin: 18px $sidebar-width / 4;
        border-top: 1px dotted #9b9b9b;
        border-bottom: 0;
    }
    i {
      opacity: 1;
    }
    li {
      text-align: center;
      line-height: $sidebar-width;
    }
    a, .dropdown__toggle {
      display: block;
      margin: 6px auto;
      border-radius: 50%;
      height:36px;
      width: 36px;
      overflow: hidden;
      transition: opacity 0.2s, background-color 0.2s;

      position: relative;
    }
    a:hover, .dropdown__toggle:hover {
      opacity: 1;
      background-color: rgba(255, 255, 255, .6);
    }
    a:active, .dropdown__toggle:active {
      background-color: $sd-blue;
      opacity: 1;
    }
    .main-icon {
      position: absolute;
      top: 6px;
      left: 4px;
      transition: left 0.2s ease-out;
    }
    .helper-icon {
      position: absolute;
      top: 6px;
      left: 30px;
      transition: left 0.2s ease-out, transform 0.2s;
    }
    .active {
      a, .dropdown__toggle {
        background-color: darken($sd-blue, 11%);
        opacity: 1;
      }
    }
    .dropdown--dropright {
      display: block;
      .dropdown__menu {
        top: -10px;
      }
    }

}
#side-menu {
  .authoring-active {
    .active {
        .sd-sidebar-menu__main-icon, .sd-sidebar-menu__helper-icon {
            color: #fff;
        }
        &:hover {
            .sd-sidebar-menu__main-icon {
                left: -3rem;
            }
            .sd-sidebar-menu__helper-icon {
                left: 0.5rem;
            }
        }
    }
    &.list-hidden {
      .active {
        .sd-sidebar-menu__helper-icon {
            transform: rotate(180deg);
            left: -3rem;
        }
        &:hover {            
            .sd-sidebar-menu__helper-icon {
                left: 0.5rem;
            }
        }
      }
    }
  }
}

.side-menu-hidden {
    #side-menu {
        display: none;
    }

    #main-container.hideMonitoring #authoring-container {
        width: 100%!important;
    }

    #workspace-container {
        left: 0;
    }
}

.sd-sidetab-menu,
.sd-sidebar-menu {
    top: 0;
}

#main-menu, .main-menu {
    position: fixed;
    top: 0;
    left:0;
    bottom: 0;
    width: $sf-main-menu-width;
    background: #272727;
    color: #f0f0f0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    @include user-select(none);
    @include box-shadow(inset -5px 0 6px -0px #181818);
    .header, .main-menu__header {
        grid-column: 1/2;
        grid-row: 1/2;
        z-index: 1;
        display: flex;
        align-items: center;
        height: $nav-height;
        box-shadow: 0 2px 3px rgba(0, 0, 0, 0.24);
        border-bottom: 1px solid rgba(0, 0, 0, 0.4);
    }
    .main-menu__heading {
        font-size: 1.6rem;
        font-weight: 300;
        opacity: 0.5;
        padding-left: $sd-base-increment * 3;
    }
    .content, .main-menu__content {
        grid-column: 1/2;
        grid-row: 2/3;
        overflow: auto;

        ul, .main-menu__list {
            list-style-type: none;
            margin:0;
            padding: 0;
            margin-top: $sd-base-increment * 2;
            li, .main-menu__list-item {
                a, .main-menu__menu-item {
                    @include user-select(none);
                    display: flex;
                    align-items: center;
                    position: relative;
                    padding-left: $sd-base-increment * 5;
                    height: $sd-base-increment * 5;
                    font-size: 14px;
                    color: inherit;
                    text-decoration: none;
                    border-left: 4px solid transparent;
                    transition: all 0.2s ease-in-out;
                    &:hover {
                        background: rgba(255, 255, 255, 0.06);
                        cursor: pointer;
                        border-left: 4px solid rgba(255, 255, 255, 0.2);
                    }
                    sup {
                        padding-left: 4px;
                        opacity: 0.7;
                        font-weight: 300;
                        letter-spacing: 0.05em;
                    }
                }
                &.active, &.main-menu__list-item--active {
                    a, .main-menu__menu-item {
                        background: rgba(0,0,0,0.30);
                        color: $sd-blue;
                        border-left: 4px solid $sd-blue;
                    }
                }
            }
            .main-menu__group-header {
                font-size: 11px;
                text-transform: uppercase;
                padding: 12px 0 4px 24px;
                color: rgba(255, 255, 255, 0.5);
                letter-spacing: 0.06em;
            }
        }
    }
    .footer, .main-menu__footer {
        grid-column: 1/2;
        grid-row: 3/4;
        z-index: 2;
        border-top: 1px solid #1f1f1f;
        @include box-shadow-both(inset 0 1px 0px 0px #353535,0 -2px 3px 0px #232323);
        text-align: center;
        .icon-superdesk {
            background: url(~images/superdesk-logo.svg) no-repeat 0 0;
            background-size: contain;
            width: 130px;
            height: 42px;
            margin: 14px auto 10px;
        }
        .powered {
            display: block;
            color: rgba(255,255,255,0.4);
            font-size: 10px;
            font-weight: 300;
            letter-spacing:0.05em;
            padding: 8px 0 6px;
            border-bottom: 1px solid rgba(255,255,255,0.065);
        }
        .about {
            display: flex;
            align-items: center;
            justify-content: center;
            color: rgba(255,255,255,0.9);
            background-color: rgba(0,0,0,0.1);
            font-size: 12px;
            font-weight: 300;
            padding: 0 16px;
            height: 3.2rem;
            font-weight: 300;
            letter-spacing:0.05em;
            border-top: 1px solid rgba(255,255,255,0.065);
            a {
              color: rgba(255,255,255,0.9);
              cursor: pointer;
            }

        }
    }
}

// About modal content

.about-content {
  position: relative;
  .sf-logo {
    width: 110px;
    background-size: 110px;
    opacity: 0.5;
    position: absolute;
    top:0;
    right:0;
  }
}



@media screen and (max-width: 1180px) {
    .top-menu {
        &.menu-open {
            left: $sf-main-menu-width !important;
            right: -$sf-main-menu-width !important;
        }
    }

}

@media screen and (max-width: 320px) {

    .sf-main-menu {
        width:260px;
    }
    .top-menu {
        max-height: 40px;
        overflow: hidden;
        &.menu-open {
            left: 260px !important;
            right: -260px !important;
        }
    }
}
