@import (reference) '../../../design/index.less';

@basic-menu-prefix-cls: ~'@{namespace}-basic-menu';

.active-style() {
  color: @white;
  background: linear-gradient(
    118deg,
    rgba(@primary-color, 0.8),
    rgba(@primary-color, 1)
  ) !important;
}

.active-menu-style() {
  .ant-menu-item-selected,
  .ant-menu-submenu-popup.ant-menu-dark .ant-menu-item-selected {
    .active-style();
  }
}

.@{basic-menu-prefix-cls} {
  width: 100%;

  // &__expand-icon {
  //   position: absolute;
  //   top: calc(50% - 6px);
  //   right: 16px;
  //   width: 10px;
  //   transform-origin: none;

  //   span[role='img'] {
  //     margin-right: 0;
  //     font-size: 11px;
  //   }

  //   &--collapsed {
  //     opacity: 0;
  //   }
  // }

  //  collapsed show title start
  &--show-title {
    max-width: unset !important;
    opacity: 1 !important;
  }

  &--hide-title {
    &.ant-menu-inline-collapsed > .ant-menu-item,
    &.ant-menu-inline-collapsed > .ant-menu-item-group > .ant-menu-item-group-list > .ant-menu-item,
    &.ant-menu-inline-collapsed
      > .ant-menu-item-group
      > .ant-menu-item-group-list
      > .ant-menu-submenu
      > .ant-menu-submenu-title,
    &.ant-menu-inline-collapsed > .ant-menu-submenu > .ant-menu-submenu-title {
      padding-right: 20px !important;
      padding-left: 20px !important;
    }
  }

  &--collapsed-show-title.ant-menu-inline-collapsed {
    .@{basic-menu-prefix-cls}-item__level1 {
      padding: 2px 0;
    }

    & > li[role='menuitem']:not(.ant-menu-submenu),
    & > li > .ant-menu-submenu-title {
      display: flex;
      margin-top: 10px;
      font-size: 12px;
      flex-direction: column;
      align-items: center;
      line-height: 24px;
    }

    & > li > .ant-menu-submenu-title {
      line-height: 24px;
    }
    .@{basic-menu-prefix-cls}__content-wrapper {
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      .@{basic-menu-prefix-cls}--show-title {
        line-height: 30px;
      }
    }
  }

  // .ant-menu-item {
  //   transition: unset;
  // }

  // scrollbar -s tart
  &-wrapper {
    /* 滚动槽 */
    &::-webkit-scrollbar {
      width: 5px;
      height: 5px;
    }

    &::-webkit-scrollbar-track {
      background: rgba(0, 0, 0, 0);
    }

    &::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.2);
      border-radius: 3px;
      box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
    }

    ::-webkit-scrollbar-thumb:hover {
      background: @border-color-dark;
    }
  }

  // scrollbar  end

  &-item__level1.light {
    &.top-active-menu {
      top: 0 !important;
    }

    &.top-active-menu:not(.ant-menu-item-selected) {
      color: @primary-color;
      border-bottom: 3px solid @primary-color;
    }
  }

  &__sidebar-hor {
    // overflow: hidden;

    &.ant-menu-horizontal {
      display: flex;
      border: 0;
      align-items: center;

      .@{basic-menu-prefix-cls}-item__level1 {
        margin-right: 2px;
      }

      &.ant-menu-light {
        .ant-menu-item {
          &.@{basic-menu-prefix-cls}-item__level1 {
            height: @header-height;
            line-height: @header-height;
          }
        }

        .ant-menu-submenu:hover,
        .ant-menu-item-open,
        .ant-menu-submenu-open,
        .ant-menu-item-selected,
        .ant-menu-submenu-selected,
        .ant-menu-item:hover,
        .ant-menu-item-active,
        .ant-menu:not(.ant-menu-inline) .ant-menu-submenu-open,
        .ant-menu-submenu-active,
        .ant-menu-submenu-title:hover {
          color: @primary-color !important;
          border-bottom: 3px solid @primary-color;
        }

        .ant-menu-submenu {
          &:hover {
            border-bottom: 3px solid @primary-color;
          }

          &.ant-menu-selected,
          &.ant-menu-submenu-selected {
            border-bottom: 3px solid @primary-color;
          }
        }
      }

      &.ant-menu-dark {
        background: transparent;

        .ant-menu-submenu:hover,
        .ant-menu-item-open,
        .ant-menu-submenu-open,
        .ant-menu-item-selected,
        .ant-menu-submenu-selected,
        .ant-menu-item:hover,
        .ant-menu-item-active,
        .ant-menu:not(.ant-menu-inline) .ant-menu-submenu-open,
        .ant-menu-submenu-active,
        .ant-menu-submenu-title:hover {
          color: #fff;
          background: @top-menu-active-bg-color !important;
        }

        .ant-menu-item:hover,
        .ant-menu-item-active,
        .ant-menu:not(.ant-menu-inline) .ant-menu-submenu-open,
        .ant-menu-submenu-active,
        .ant-menu-submenu-title:hover {
          background: @top-menu-active-bg-color;
        }

        .@{basic-menu-prefix-cls}-item__level1 {
          background: transparent;

          &.top-active-menu {
            color: @white;
            background: @top-menu-active-bg-color;
            border-radius: 2px 2px 0 0;
          }

          &.ant-menu-item-selected,
          &.ant-menu-submenu-selected {
            background: @top-menu-active-bg-color !important;
          }
        }

        .ant-menu-item,
        .ant-menu-submenu {
          &.@{basic-menu-prefix-cls}-item__level1,
          .ant-menu-submenu-title {
            height: @header-height;
            line-height: @header-height;
          }
        }
      }
    }
  }

  &:not(.@{basic-menu-prefix-cls}__sidebar-hor).ant-menu-inline-collapsed {
    .@{basic-menu-prefix-cls}-item__level1 {
      > div {
        align-items: center;
      }
    }
  }

  &.ant-menu-dark:not(.@{basic-menu-prefix-cls}__sidebar-hor):not(.@{basic-menu-prefix-cls}__second) {
    // Reset menu item row height
    .ant-menu-item:not(.@{basic-menu-prefix-cls}-item__level1),
    .ant-menu-sub.ant-menu-inline > .ant-menu-item,
    .ant-menu-sub.ant-menu-inline > .ant-menu-submenu > .ant-menu-submenu-title {
      height: @app-menu-item-height;
      margin: 0;
      line-height: @app-menu-item-height;
    }

    .ant-menu-item.@{basic-menu-prefix-cls}-item__level1 {
      height: @app-menu-item-height;
      line-height: @app-menu-item-height;
    }
  }

  // 层级样式
  &.ant-menu-dark:not(.@{basic-menu-prefix-cls}__sidebar-hor) {
    overflow: hidden;
    background: @sider-dark-bg-color;
    .active-menu-style();

    // .menu-item-icon.app-iconify {
    //   display: inline-block !important;
    // }

    .ant-menu-item.ant-menu-item-selected.@{basic-menu-prefix-cls}-menu-item__level1,
    .ant-menu-submenu-selected.@{basic-menu-prefix-cls}-menu-item__level1 {
      color: @white;
    }

    .@{basic-menu-prefix-cls}-item__level1 {
      background-color: @sider-dark-bg-color;

      > .ant-menu-sub > li {
        background-color: @sider-dark-lighten-1-bg-color;
      }
    }

    .@{basic-menu-prefix-cls}-item__level2:not(.ant-menu-item-selected),
    .ant-menu-sub {
      background-color: @sider-dark-lighten-1-bg-color;
    }

    .@{basic-menu-prefix-cls}-item__level3:not(.ant-menu-item-selected) {
      background-color: @sider-dark-lighten-2-bg-color;

      .ant-menu-item {
        background-color: @sider-dark-lighten-2-bg-color;
      }
    }

    .ant-menu-submenu-title {
      display: flex;
      height: @app-menu-item-height;
      // margin: 0;
      align-items: center;
    }

    &.ant-menu-inline-collapsed {
      .ant-menu-submenu-selected,
      .ant-menu-item-selected {
        background: @sider-dark-darken-bg-color !important;
      }
    }
  }

  &.ant-menu-light:not(.@{basic-menu-prefix-cls}__sidebar-hor) {
    overflow: hidden;
    border-right: none;

    // .menu-item-icon.app-iconify {
    //   display: inline-block !important;
    // }

    .ant-menu-item.ant-menu-item-selected.@{basic-menu-prefix-cls}-menu-item__level1,
    .ant-menu-submenu-selected.@{basic-menu-prefix-cls}-menu-item__level1 {
      color: @primary-color;
    }
  }

  // 激活的子菜单样式
  .ant-menu-item.ant-menu-item-selected {
    position: relative;
  }

  &.@{basic-menu-prefix-cls}__second.ant-menu-inline-collapsed:not(.@{basic-menu-prefix-cls}__sidebar-hor) {
    // Reset menu item row height
    .ant-menu-item,
    .ant-menu-sub.ant-menu-inline > .ant-menu-item,
    .ant-menu-sub.ant-menu-inline > .ant-menu-submenu > .ant-menu-submenu-title {
      display: flex;
      height: @app-menu-item-height * 1.4;
      padding: 6px 0 !important;
      margin: 0;
      line-height: @app-menu-item-height;
      align-items: center;
    }
  }
  .@{basic-menu-prefix-cls}__tag {
    position: absolute;
    top: calc(50% - 8px);
    right: 30px;
    display: inline-block;
    padding: 2px 4px;
    margin-right: 4px;
    font-size: 12px;
    line-height: 14px;
    color: #fff;
    border-radius: 2px;

    &.dot {
      top: calc(50% - 4px);
      width: 8px;
      height: 8px;
      padding: 0;
      border-radius: 50%;
    }

    &.primary {
      background: @primary-color;
    }

    &.error {
      background: @error-color;
    }

    &.success {
      background: @success-color;
    }

    &.warn {
      background: @warning-color;
    }
  }
}

.ant-menu-dark {
  &.ant-menu-submenu-popup {
    > ul {
      background: @sider-dark-bg-color;
    }

    .active-menu-style();
  }
}

// collapsed show title end
.ant-menu-item,
.ant-menu-submenu-title {
  > .@{basic-menu-prefix-cls}__name {
    width: 100%;

    .@{basic-menu-prefix-cls}__tag {
      float: right;
      margin-top: @app-menu-item-height / 2;
      transform: translate(0%, -50%);
    }
  }
}
