/**
 * 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.
 **/

.red-ui-menu-dropdown {
    font-family: var(--red-ui-primary-font);
    font-size: var(--red-ui-primary-font-size);
    position: absolute;
    top: 100%;
    width: 230px;
    left: 0;
    z-index: 1000;
    display: none;
    float: left;
    margin: 2px 0 0;
    margin-left: 0px !important;
    padding: 5px 0;
    list-style: none;
    background: var(--red-ui-menuBackground);
    border: 1px solid var(--red-ui-secondary-border-color);
    box-shadow: 0 5px 10px var(--red-ui-shadow);

    &.pull-right {
        right: 0;
        left: auto;
    }

    .red-ui-menu-divider {
        height: 1px;
        margin: 9px 1px;
        overflow: hidden;
        background-color: var(--red-ui-menuDivider);
    }
    & > li > a,
    & > li > a:focus {
        display: block;
        padding: 4px 12px 4px 32px;
        clear: both;
        font-weight: normal;
        line-height: 20px;
        color: var(--red-ui-menuColor);
        white-space: normal !important;
        outline: none;
    }
    & > li.pull-left > a,
    & > li.pull-left > a:focus {
        padding: 4px 12px 4px 32px;
    }
    &.red-ui-menu-dropdown-noicons > li > a,
    &.red-ui-menu-dropdown-noicons > li > a:focus {
        padding: 4px 12px 4px 12px;
    }

    &.red-ui-menu-dropdown-submenus.red-ui-menu-dropdown-direction-right > li > a,
    &.red-ui-menu-dropdown-submenus.red-ui-menu-dropdown-direction-right > li > a:focus {
        padding-right: 20px;
    }
    &.red-ui-menu-dropdown-submenus.red-ui-menu-dropdown-direction-left > li > a,
    &.red-ui-menu-dropdown-submenus.red-ui-menu-dropdown-direction-left > li > a:focus {
        padding-left: 20px;
    }


    & > .active > a,
    & > .active > a:hover,
    & > .active > a:focus {
        color: var(--red-ui-menuActiveColor);
        text-decoration: none;
        background-color: var(--red-ui-menuActiveBackground);
        outline: 0;
    }

    & > .disabled > a,
    & > .disabled > a:hover,
    & > .disabled > a:focus {
        color: var(--red-ui-menuDisabledColor);
        .red-ui-popover-key {
            color: var(--red-ui-menuDisabledColor);
            border-color: var(--red-ui-menuDisabledColor);
        }
    }

    & > .disabled > a:hover,
    & > .disabled > a:focus {
        text-decoration: none;
        cursor: default;
        background-color: transparent;
        background-image: none;
    }

    a {
        img {
            max-width: 14px;
        }
        .fa {
            float: left;
            width: 20px;
            margin-left: -25px;
            margin-top: 3px;
            text-align: center;
        }
        .fa-check-square {
            display: none;
        }
        .fa-square {
            display: inline-block;
        }
        &.active {
            .fa-check-square {
                display: inline-block;
            }
            .fa-square {
                display: none;
            }
        }
        .red-ui-menu-label {
            display: flex;
            & > :first-child {
                flex-grow: 1
            }
        }
        .red-ui-popover-key {
            border: none;
            padding: 0;
            font-size: 13px;
            // float: right;
            color: var(--red-ui-menuColor);
            border-color: var(--red-ui-menuColor);
        }
    }

}

.pull-right > .red-ui-menu-dropdown {
  right: 0;
  left: auto;
}


.red-ui-menu-dropdown > li > a:hover,
.red-ui-menu-dropdown > li.open > a,
.red-ui-menu-dropdown > li > a:focus,
.red-ui-menu-dropdown-submenu:hover > a,
.red-ui-menu-dropdown-submenu:focus > a {
    color: var(--red-ui-menuHoverColor);
    text-decoration: none;
    background-color: var(--red-ui-menuHoverBackground);
}

.red-ui-menu-dropdown-submenu {
    position: relative;
    & > .red-ui-menu-dropdown {
        top: 0;
        left: calc(100% - 5px);
        margin-top: 0;
        margin-left: -1px;
    }
    &.open > .red-ui-menu-dropdown,
    &:hover > .red-ui-menu-dropdown {
      display: block;
    }
    & > a:after {
      display: block;
      float: right;
      width: 0;
      height: 0;
      margin-top: 5px;
      margin-right: -10px;
      border-color: transparent;
      border-left-color: var(--red-ui-menuCaret);
      border-style: solid;
      border-width: 5px 0 5px 5px;
      content: " ";
    }
    &.pull-left {
        float: none;
        & > .red-ui-menu-dropdown {
            left: -100%;
            margin-left: 10px;
        }
    }
}

.red-ui-menu-dropdown-submenu.pull-left>a:after {
    display: none;
}
.red-ui-menu-dropdown-submenu.pull-left>a:before {
    display: block;
    float: left;
    width: 0;
    height: 0;
    margin-top: 5px;
    margin-left: -15px;
    /* Caret Arrow */
    border-color: transparent;
    border-right-color: var(--red-ui-menuCaret);
    border-style: solid;
    border-width: 5px 5px 5px 0;
    content: " ";
}
.red-ui-menu-dropdown-direction-right {
    .red-ui-menu-dropdown-submenu>a:after {
        display: none;
    }
    .red-ui-menu-dropdown-submenu>a:before {
        display: block;
        float: right;
        width: 0;
        height: 0;
        margin-top: 5px;
        margin-right: -15px;
        /* Caret Arrow */
        border-color: transparent;
        border-left-color: var(--red-ui-menuCaret);
        border-style: solid;
        border-width: 5px 0 5px 5px;
        content: " ";
    }
}
.red-ui-menu-dropdown-submenu.disabled > a:before {
    border-right-color: var(--red-ui-menuCaret);
}


// Menu NG
ul.red-ui-menu:not(.red-ui-menu-dropdown) {
    font-family: var(--red-ui-primary-font);
    font-size: 12px;
    list-style-type: none;
    padding: 0;
    margin: 0;
    li a {
        display: block;
        padding: 4px 8px 4px 16px;
        clear: both;
        font-weight: normal;
        line-height: 20px;
        color: var(--red-ui-menuColor);
        white-space: nowrap;
        text-decoration: none;

        &:hover,&:focus {
            color: var(--red-ui-menuHoverColor);
            text-decoration: none;
            background-color: var(--red-ui-menuHoverBackground);
            border: none;
            outline: none;
        }
    }
    &.red-ui-menu-compact {
        font-size: 12px;
        li a {
            line-height: 16px;
        }
    }

}
