@import "mixins/mixins";
@import "mixins/utils";
@import "common/var";
@import "common/transition";
* {
  &:focus {
    outline: none;
  }
}
@mixin menu-item {
  height: 56px;
  line-height: 56px;
  font-size: $--menu-item-font-size;
  color: $--menu-item-font-color;
  padding: 0 16px 0 16px;
  list-style: none;
  cursor: pointer;
  position: relative;
  transition: border-color .3s, background-color .3s, color .3s;
  box-sizing: border-box;
  white-space: nowrap;
  font-weight: 400;
  * {
    vertical-align: middle;
  }

  i {
    color: $--color-text-secondary;
  }

  &:hover {
    outline: none;
    background-color: $--menu-item-hover-fill;
  }

  @include when(disabled) {
    opacity: 0.25;
    cursor: not-allowed;
    background: none !important;
  }
}

@include b(menu) {
  list-style: none;
  position: relative;
  margin: 0;
  padding-left: 0;
  background-color: $--menu-background-color;
  @include utils-clearfix;
  &.el-menu--horizontal {
    border-bottom: solid 1px $--border-color-lighter;
  }

  @include m(horizontal) {
    border-right: none;
    & > .el-menu-item {
      float: left;
      height: 56px;
      line-height: 56px;
      margin: 0;
      border-bottom: 4px solid transparent;
      color: $--color-text-primary;
      padding: 0 16px;
      a,
      a:hover {
        color: inherit;
      }

      &:not(.is-disabled):hover {
        background-color: #fff;
      }
    }
    & > .el-submenu {
      float: left;

      &:hover {
        outline: none;
        .el-submenu__title {
          color: $--color-primary-light-2;
        }
      }

      &.is-active {
        .el-submenu__title {
          border-bottom: 4px solid $--color-primary;
          color: $--color-primary;
          font-weight: 500;
        }
      }

      & .el-submenu__title {
        height: 56px;
        line-height: 56px;
        border-bottom: 4px solid transparent;
        color: $--color-text-primary;
        padding: 0 16px;
        &:hover {
          background-color: #fff;
        }
      }
      & .el-submenu__icon-arrow {
        position: static;
        vertical-align: middle;
        margin-left: 4px;
        margin-top: -3px;
      }
    }
    & .el-menu {
      & .el-menu-item,
      & .el-submenu__title {
        background-color: $--color-white;
        float: none;
        height: 40px;
        line-height: 40px;
        padding: 0 16px;
        color: $--color-text-primary;
      }
      & .el-menu-item.is-active,
      & .el-submenu.is-active > .el-submenu__title {
        color: $--color-primary;
      }
    }
    & .el-menu-item:not(.is-disabled):hover{
      outline: none;
      color: $--color-primary-light-2;
    }
    & .el-menu-item:not(.is-disabled):hover,
    & .el-menu-item:not(.is-disabled):focus {
      outline: none;
    }
    & > .el-menu-item.is-active {
      border-bottom: 4px solid $--color-primary;
      color: $--color-primary;
      font-weight: 500;
    }
    & > .el-menu--popup {
      & .el-menu-item:not(.is-active):hover,
      & .el-menu-item:not(.is-active):focus {
        background: $--menu-item-hover-fill;
        color: $--color-text-primary;
      }
    }
    .border-left::before {
      content: '|';
      color: $--border-color-cut;
      height: 16px;
      width: 1px;
      position: relative;
      left: -16px;
    }
  }
  @include m(collapse) {
    width: 64px;
    border-right: 1px solid $--border-color-cut;
    > .el-menu-item,
    > .el-submenu > .el-submenu__title {
      [class^="el-icon-"] {
        margin: 0;
        vertical-align: middle;
        width: 24px;
        text-align: center;
      }
      .el-submenu__icon-arrow {
        display: none;
      }
      span {
        height: 0;
        width: 0;
        overflow: hidden;
        visibility: hidden;
        display: inline-block;
      }
    }

    > .el-menu-item.is-active i {
      color: inherit;
    }

    .el-menu .el-submenu {
      min-width: 168px;
    }

    .el-submenu {
      position: relative;
      & .el-menu {
        position: absolute;
        margin-left: 5px;
        top: 0;
        left: 100%;
        z-index: 10;
        border: 1px solid $--border-color-light;
        border-radius: $--border-radius-small;
        box-shadow: $--box-shadow-light;
      }

      &.is-opened {
        > .el-submenu__title .el-submenu__icon-arrow {
          transform: none;
        }
      }
    }
  }
  @include m(popup) {
    z-index: 100;
    min-width: 168px;
    border: none;
    padding: 8px 0;
    border-radius: $--border-radius-small;
    box-shadow: $--box-shadow-light;

    &-bottom-start {
      margin-top: 0px;
    }
    &-right-start {
      margin-left: 5px;
      margin-right: 5px;
    }
  }
  @include m(vertical) {
    box-shadow: $--large-shadow-r;
    padding-top: 16px;
    padding-bottom: 40px;
    flex-grow: 1;
    overflow-y: scroll;
    box-sizing: border-box;
    .el-menu-item {
      height: 40px;
      line-height: 40px;
      margin-bottom: 8px;
    }
    .el-menu-item.is-active {
      background-color: $--background-color-active;
      color: $--color-primary;
      &::before {
        content: '';
        background-color: $--color-primary;
        width: 4px;
        height: 40px;
        position: absolute;
        left: 0px;
      }
    }
    & > .el-submenu {
      .el-submenu__title {
        height: 40px;
        line-height: 40px;
        margin-bottom: 8px;
        transition: margin-bottom .3s;
      }
    }
    @include m(popup) {
      box-shadow: unset;
      overflow-y: unset;
      padding-top: unset;
    }
  }
  @include m(inline) {
    box-shadow: unset;
    padding-top: unset;
    .el-menu-item {
      margin-bottom: unset;
    }
  }
}
@include b(menu-wrap) {
  display: flex;
  width: 168px;
  overflow: hidden;
  position: relative;
  box-shadow: $--large-shadow-r;
  height: 100%;
}
@include b(menu-item) {
  @include menu-item;

  & [class^="el-icon-"] {
    margin-right: 8px;
    width: 24px;
    text-align: center;
    vertical-align: middle;
    font-size: 24px;
    color: $--color-text-secondary;
  }
  @include when(active) {
    color: $--color-primary;
  }
  i {
    color: inherit;
  }
}
  
@include b(submenu) {
  list-style: none;
  margin: 0;
  padding-left: 0;

  @include e(title) {
    @include menu-item;
    &:hover {
      background-color: $--menu-item-hover-fill;
    }
  }
  & .el-menu {
    border: none;
  }
  & .el-menu-item {
    height: 40px;
    line-height: 40px;
    width: 100%;
  }
  @include e(icon-arrow) {
    position: absolute;
    top: 50%;
    right: 10px;
    margin-top: -5px;
    transition: transform .3s;
    font-size: 12px;
    color: $--color-text-primary;
  }
  @include when(active) {
    .el-submenu__title {
      border-bottom-color: $--color-primary;
    }
  }
  @include when(opened) {
    > .el-submenu__title {
      margin-bottom: unset;
      .el-submenu__icon-arrow {
        transform: rotateZ(180deg);
        color: $--color-text-primary;
      }
    }
  }
  @include when(disabled) {
    .el-submenu__title,
    .el-menu-item {
      opacity: 0.25;
      cursor: not-allowed;
      background: none !important;
    }
  }
  [class^="el-icon-"] {
    vertical-align: middle;
    margin-right: 8px;
    width: 24px;
    text-align: center;
    font-size: 24px;
  }
}

@include b(menu-item-group) {
  > ul {
    padding: 0;
  }
  @include e(title) {
    padding: 10px 0 10px 24px;
    line-height: 18px;
    font-size: 12px;
    color: $--menu-item-font-group-title;
  }
}


.horizontal-collapse-transition .el-submenu__title .el-submenu__icon-arrow {
  transition: .2s;
  opacity: 0;
}
