@charset "UTF-8";
@import "./common/var.css";

@define-extend menu-item {
  height: 56px;
  line-height: 56px;
  font-size: 14px;
  color: var(--menu-item-color);
  padding: 0 20px;
  cursor: pointer;
  position: relative;
  transition: border-color .3s, background-color .3s, color .3s;
  box-sizing: border-box;
  white-space: nowrap;
}

@component-namespace el {
  @b menu {
    border-radius: 2px;
    list-style: none;
    position: relative;
    margin: 0;
    padding-left: 0;
    background-color: var(--menu-item-fill);
    @utils-clearfix;

    & li {
      list-style: none;
    }

    @m dark {
      background-color: var(--dark-menu-item-fill);

      & .el-menu-item,
      & .el-submenu__title {
        color: var(--color-extra-light-silver);

        &:hover {
          background-color: var(--color-extra-light-black);
        }
      }
      
      & .el-submenu .el-menu {
        background-color: var(--color-base-black);

        & .el-menu-item:hover {
          background-color: var(--color-extra-light-black);
        }
      }
    }
    @m horizontal {
      & .el-menu-item {
        float: left;
        height: 60px;
        line-height: 60px;
        margin: 0;
        cursor: pointer;
        position: relative;
        box-sizing: border-box;
        border-bottom: 5px solid transparent;

        a,
        a:hover {
          color: inherit;
        }

        &:hover {
          background-color: var(--menu-item-hover-fill);
        }
      }
      & .el-submenu {
        float: left;
        position: relative;

        > .el-menu {
          position: absolute;
          top: 65px;
          left: 0;
          border:1px solid var(--color-base-gray);
          padding: 5px 0;
          background-color: var(--color-white);
          z-index: 100;
          min-width: 100%;
          box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.12), 0px 0px 6px 0px rgba(0,0,0,0.04);
        }

        & .el-submenu__title {
          height: 60px;
          line-height: 60px;
          border-bottom: 5px solid transparent;
        }

        & .el-menu-item {
          background-color: var(--color-white);
          float: none;
          height: 36px;
          line-height: 36px;
          padding: 0 10px;
        }

        & .el-submenu__icon-arrow {
          position: static;
          vertical-align: middle;
          margin-left: 5px;
          color: var(--color-light-silver);
          margin-top: -3px;
        }
      }
      & .el-menu-item:hover,
      & .el-submenu__title:hover {
        background-color: var(--menu-item-fill);
      }
      & > .el-menu-item:hover,
      & > .el-submenu:hover .el-submenu__title,
      & > .el-submenu.is-active .el-submenu__title {
        border-bottom: 5px solid var(--color-primary);
      }

      &.el-menu--dark {
        & .el-menu-item:hover,
        & .el-submenu__title:hover {
          background-color: var(--dark-menu-item-fill);
        }

        & .el-submenu {
          .el-menu-item,
          .el-submenu-title {
            color: var(--color-extra-light-black);

            &:hover {
              background-color: var(--color-base-gray);
            }
          }
          .el-menu-item.is-active {
            color: var(--color-primary);
          }
        }
      }
    }
    @m collapse {
      width: 64px;

      > .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 .el-submenu {
        min-width: 200px;
      }

      .el-submenu {
        position: relative;
        & .el-menu {
          position: absolute;
          margin-left: 5px;
          top: 0;
          left: 100%;
          z-index: 10;
        }

        &.is-opened {
          > .el-submenu__title .el-submenu__icon-arrow {
            transform: none;
          }
        }
      }
    }
  }
  @b menu-item {
    @extend menu-item;
    
    & [class^="el-icon-"] {
      margin-right: 5px;
      width: 24px;
      text-align: center;
    }
    & * {
      vertical-align: middle;
    }
    &:first-child {
      margin-left: 0;
    }
    &:last-child {
      margin-right: 0;
    }
    &:hover {
      background-color: var(--color-base-gray);
    }
    @when active {
      color: var(--color-primary);
    }
  }
  
  @b submenu {
    @e title {
      position: relative;
      @extend menu-item;

      &:hover {
        background-color: var(--color-base-gray);
      }

      & * {
        vertical-align: middle;
      }
    }
    & .el-menu {
      background-color: var(--color-light-gray);
    }
    & .el-menu-item {
      height: 50px;
      line-height: 50px;
      padding: 0 45px;
      min-width: 200px;

      &:hover {
        background-color: var(--color-base-gray);
      }
    }
    @e icon-arrow {
      position: absolute;
      top: 50%;
      right: 20px;
      margin-top: -7px;
      transition: transform .3s;
      font-size: 12px;
    }
    @when active {
      .el-submenu__title {
        border-bottom-color: var(--color-primary);
      }
    }
    @when opened {
      > .el-submenu__title .el-submenu__icon-arrow {
        transform: rotateZ(180deg);
      }
    }
    [class^="el-icon-"] {
      vertical-align: middle;
      margin-right: 5px;
      width: 24px;
      text-align: center;
    }
  }

  @b menu-item-group {
    > ul {
      padding: 0;
    }
    @e title {
      padding-top: 15px;
      line-height: normal;
      font-size: 14px;
      padding-left: 20px;
      color: var(--color-light-silver);
    }
  }
}

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