@import '~antd/es/style/themes/default.less';
@import '../global.less';

@sider-menu-prefix-cls: ~'@{ant-prefix}-pro-sider-menu';

@nav-header-height: @layout-header-height;

.@{sider-menu-prefix-cls} {
  position: relative;
  height: calc(100vh - 64px - 50px);
  min-height: 0 !important;
  overflow: auto;
  @scroller();

  &-logo {
    position: relative;
    display: flex;
    justify-content: center;
    padding: 0 2px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;

    > a {
      display: flex;
      align-items: center;
      height: 64px;
    }

    img {
      display: inline-block;
      height: 32px;
      vertical-align: middle;
    }

    h1 {
      display: inline-block;
      margin: 0 0 0 12px;
      color: white;
      font-weight: 600;
      font-size: 20px;
      vertical-align: middle;
      animation: fade-in;
      animation-duration: 0.3s;
    }
  }

  &-sider {
    position: relative;
    z-index: 10;
    // min-height: 100%;
    box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35);

    &.fix-sider-bar {
      position: fixed;
      top: 0;
      left: 0;
      height: 100%;
      overflow: auto;
      box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05);
      > .ant-menu-root {
        :not(.@{sider-menu-prefix-cls}-link-menu) {
          height: ~'calc(100vh - @{nav-header-height})';
          overflow-y: auto;
        }
      }

      .ant-menu-inline {
        border-right: 0;

        .ant-menu-item,
        .ant-menu-submenu-title {
          width: 100%;
        }
      }
    }

    &.light {
      background-color: white;
      box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05);

      .@{sider-menu-prefix-cls}-logo {
        background-color: transparent;

        h1 {
          color: @primary-color;
        }
      }

      .ant-menu-light {
        background-color: transparent;
        border-right-color: transparent;
      }

      .ant-menu-submenu > .ant-menu {
        background-color: transparent;
      }
    }
  }

  &-icon {
    width: 14px;
    vertical-align: baseline;
  }

  &-links {
    position: absolute;
    bottom: 0 !important;
    width: 100%;

    ul.ant-menu-root {
      height: auto;
    }
  }

  .top-nav-menu li.ant-menu-item {
    height: @nav-header-height;
    line-height: @nav-header-height;
  }

  .drawer .drawer-content {
    background: @layout-sider-background;
  }

  .ant-menu-inline-collapsed {
    & > .ant-menu-item .sider-menu-item-img + span,
    &
      > .ant-menu-item-group
      > .ant-menu-item-group-list
      > .ant-menu-item
      .sider-menu-item-img
      + span,
    &
      > .ant-menu-submenu
      > .ant-menu-submenu-title
      .sider-menu-item-img
      + span {
      display: inline-block;
      max-width: 0;
      opacity: 0;
    }
  }

  .ant-menu-item .sider-menu-item-img + span,
  .ant-menu-submenu-title .sider-menu-item-img + span {
    opacity: 1;
    transition: opacity 0.3s @ease-in-out, width 0.3s @ease-in-out;
  }

  .ant-drawer-body {
    padding: 0;
  }
}

.collapsed-button {
  height: 50px !important;
  margin: 0 !important;
  padding: 0 0 0 18px !important;
  border-top: @border-width-base @border-style-base rgba(0, 0, 0, 0.25);
  .ant-menu-title-content {
    height: 100%;
  }
  .button {
    margin-right: 10px;
  }
  .ant-pro-sider-copyright {
    color: #c9c9c9;
    font-size: 12px;
    line-height: 18px;
    transition: 0.2s;
    zoom: 0.9;
    svg {
      margin: 0 2px;
      font-size: 12px;
      vertical-align: sub;
    }
  }
}

@keyframes fade-in {
  0% {
    opacity: 0;
  }

  40% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

.ant-menu-inline-collapsed > .ant-menu-submenu > .ant-menu-submenu-title {
  padding: 0 16px !important;
}
.ant-menu-inline-collapsed .ant-menu-item {
  padding: 0 16px !important;
}
