@import '../../style/themes/index.less';

@pro-layout-sider-menu-prefix-cls: ~'@{ant-prefix}-pro-sider';

@nav-header-height: @layout-header-height;

.@{pro-layout-sider-menu-prefix-cls} {
  position: relative;
  background-color: @layout-sider-background;
  border-right: 0;
  transition: background-color 0.3s, min-width 0.3s, max-width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);

  // 这里关掉了动画，不然使用无法兼容
  .@{ant-prefix}-menu {
    background: transparent;

    &-item {
      transition: none;
    }

    &-submenu-title {
      transition: none;
    }
  }

  &.@{ant-prefix}-layout-sider-light {
    .@{ant-prefix}-menu-item a {
      color: @heading-color;
    }
    .@{ant-prefix}-menu-item-selected a,
    .@{ant-prefix}-menu-item a:hover {
      color: @primary-color;
    }
  }

  &-logo {
    position: relative;
    display: flex;
    align-items: center;
    padding: 16px;
    cursor: pointer;
    transition: padding 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);

    > a {
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 32px;
    }

    img {
      display: inline-block;
      height: 32px;
      vertical-align: middle;
    }

    h1 {
      display: inline-block;
      height: 32px;
      margin: 0 0 0 12px;
      color: white;
      font-weight: 600;
      font-size: 18px;
      line-height: 32px;
      vertical-align: middle;
      animation: pro-layout-title-hide 0.3s;
    }
  }

  &-extra {
    margin-bottom: 16px;
    padding: 0 16px;

    &-no-logo {
      margin-top: 16px;
    }
  }

  &-menu {
    position: relative;
    z-index: 10;
    min-height: 100%;
    padding-top: @margin-sm;
    box-shadow: 2px 0 6px rgb(0 21 41 / 35%);

    & .@{ant-prefix}-menu-item,
    & .@{ant-prefix}-menu-submenu-title {
      .@{ant-prefix}-item-icon,
      .@{iconfont-css-prefix} {
        + span {
          margin-left: 0;
        }
      }
    }

    span.@{ant-prefix}-pro-menu-item {
      display: inline-flex;
      align-items: center;

      // .anticon {
      //   margin-right: 4px;
      // }
    }

    span.@{ant-prefix}-pro-menu-item-title {
      margin-left: @margin-sm;
      transition: none;
    }
  }

  .@{ant-prefix}-layout-sider-children {
    display: flex;
    flex-direction: column;
    height: 100%;

    ::-webkit-scrollbar {
      width: 6px;
      height: 6px;
    }

    ::-webkit-scrollbar-track {
      background: rgb(255 255 255 / 15%);
      border-radius: 3px;
      box-shadow: inset 0 0 5px rgb(37 37 37 / 5%);
    }

    /* 滚动条滑块 */
    ::-webkit-scrollbar-thumb {
      background: rgb(255 255 255 / 20%);
      border-radius: 3px;
      box-shadow: inset 0 0 5px rgb(255 255 255 / 5%);
    }
  }

  &.@{ant-prefix}-layout-sider-collapsed {
    .@{ant-prefix}-menu-inline-collapsed {
      width: 56px;
      font-size: @font-size-base;
    }
    .@{pro-layout-sider-menu-prefix-cls} {
      &-logo {
        padding: 16px 8px;
      }
    }
  }

  &.@{ant-prefix}-layout-sider.@{pro-layout-sider-menu-prefix-cls}-fixed {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    height: 100%;
    overflow: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 8px 0 rgb(29 35 41 / 5%);
    > .@{ant-prefix}-menu-root {
      :not(.@{pro-layout-sider-menu-prefix-cls}-link-menu) {
        height: ~'calc(100vh - @{nav-header-height})';
        overflow-y: auto;
      }
    }
  }

  &-light {
    .@{ant-prefix}-layout-sider-children {
      ::-webkit-scrollbar-track {
        background: rgb(0 0 0 / 6%);
        border-radius: 3px;
        box-shadow: inset 0 0 5px rgb(0 21 41 / 5%);
      }

      /* 滚动条滑块 */
      ::-webkit-scrollbar-thumb {
        background: rgb(0 0 0 / 12%);
        border-radius: 3px;
        box-shadow: inset 0 0 5px rgb(0 21 41 / 5%);
      }
    }

    background-color: @white;
    box-shadow: 2px 0 8px 0 rgb(29 35 41 / 5%);
    .@{pro-layout-sider-menu-prefix-cls}-logo {
      h1 {
        color: @primary-color;
      }
    }
    .@{ant-prefix}-menu-light {
      border-right-color: transparent;
    }

    .@{pro-layout-sider-menu-prefix-cls}-collapsed-button {
      border-top: @border-width-base @border-style-base @border-color-split;
    }
  }

  &-icon {
    width: @menu-icon-size;
    vertical-align: baseline;
  }

  &-links {
    width: 100%;
    ul.@{ant-prefix}-menu-root {
      height: auto;
    }
  }

  &-collapsed-button {
    border-top: @border-width-base @border-style-base rgb(0 0 0 / 25%);

    .anticon {
      font-size: @menu-icon-size;
    }
  }

  .top-nav-menu li.@{ant-prefix}-menu-item {
    height: 100%;
    line-height: 1;
  }

  .drawer .drawer-content {
    background: @layout-sider-background;
  }
}

@keyframes pro-layout-title-hide {
  0% {
    display: none;
    opacity: 0;
  }

  80% {
    display: none;
    opacity: 0;
  }

  100% {
    display: unset;
    opacity: 1;
  }
}
