@import "~themes/vars";

.layout {
  position: relative;
  height: 100vh;

  &.withnavbar {
    .main {
      margin-left: 0;
    }
  }

  &.fold {
    .sider {
      width: 42px;

      .logo {
        img {
          width: 28px;
          margin: 6px 7px;
        }
      }

      :global {
        .ant-menu-root {
          width: 100%;
          overflow: visible;

          & > .ant-menu-item {
            padding: 0;
            text-align: center;

            .anticon {
              font-size: 14px;
              margin-right: 0;
            }
          }

          & > .ant-menu-submenu {
            & > .ant-menu-submenu-title {
              padding: 0;
              text-align: center;

              .anticon {
                font-size: 14px;
                margin-right: 0;
              }

              &::after {
                display: none;
              }
            }
          }
        }
      }
    }

    .main {
      margin-left: 42px;
    }
  }

  .sider {
    width: 224px;
    background: #3e3e3e;
    position: absolute;
    overflow: visible;
    padding-bottom: 24px;
    height: 100vh;
    transition: @transition-ease-out;
    box-shadow: @shadow-1;
    color: #999;

    &.light {
      background: #fff;

      .switchtheme {
        background: #fff;
        border-top: solid 1px #f8f8f8;
      }
    }

    .logo {
      text-align: center;
      height: 40px;
      line-height: 40px;
      cursor: pointer;
      margin: 28px 0;
      transition: @transition-ease-out;
      overflow: hidden;

      img {
        width: 40px;
        margin-right: 8px;
        transition: @transition-ease-out;
      }

      span {
        vertical-align: text-bottom;
        font-size: 16px;
        text-transform: uppercase;
        display: inline-block;
      }

      .anticon {
        transition: @transition-ease-out;
      }
    }

    .switchtheme {
      width: 100%;
      position: absolute;
      bottom: 0;
      height: 48px;
      background-color: @dark-half;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 16px 0 24px;
      overflow: hidden;
      z-index: 1000;

      span {
        white-space: nowrap;
        overflow: hidden;
      }

      :global {
        .anticon {
          min-width: 14px;
          margin-right: 8px;
          font-size: 14px;
        }
      }
    }

    :global {
      .ant-menu-dark,
      .ant-menu-dark .ant-menu-sub {
        color: #999;
      }

      .ant-menu-root {
        height: ~"calc(100vh - 144px)";
        overflow-x: hidden;
        border-right: none;

        &::-webkit-scrollbar-thumb {
          background-color: transparent;
        }

        &:hover {
          &::-webkit-scrollbar-thumb {
            background-color: rgba(0, 0, 0, 0.2);
          }
        }

        &.ant-menu-vertical {
          .ant-menu-sub {
            height: 0;
            opacity: 0;
            transition: none;
          }

          .ant-menu-submenu-active {
            .ant-menu-sub {
              height: auto;
              opacity: 1;
            }
          }
        }
      }

      .ant-menu {
        transition: @transition-ease-out;

        .ant-menu-item,
        .ant-menu-submenu-title {
          overflow: hidden;
          white-space: normal;
        }
      }
    }
  }

  .main {
    margin-left: 224px;
    overflow: auto;
    height: 100vh;
    transition: @transition-ease-out;

    :global {
      .content-inner {
        background: #fff;
        padding: 24px;
        box-shadow: @shadow-1;
        min-height: e("calc(100vh - 184px)");
      }
    }

    .container {
      margin: 24px;
    }

    .content {
      min-height: e("calc(100vh - 184px)");
      position: relative;
    }
  }
}

:global .ant-menu-dark {
  color: #999;
  background-color: #3e3e3e;

  .ant-menu-submenu-title:hover,
  .ant-menu-submenu:hover {
    color: @primary-color;
  }

  .ant-menu-sub {
    color: #999;
  }

  .ant-menu-submenu-selected {
    color: @primary-color;

    &:not(.ant-menu-submenu-open) {
      background-color: @dark-half;
    }
  }

  .ant-menu-item,
  .ant-menu-submenu-title {
    & > a {
      color: #999;
    }

    &:hover > a {
      color: @primary-color;
    }
  }

  &.ant-menu-inline {
    .ant-menu-item-selected {
      background-color: @dark-half;
    }
  }

  .ant-menu-item-selected {
    color: @primary-color;
    background-color: @dark-half;

    & > a {
      color: @primary-color;
    }

    &:hover {
      background-color: @dark-half;
    }
  }
}

.spin {
  :global .ant-spin-container {
    height: 100vh;
  }
}
@media (max-width: 767px) {
  .layout {
    .main {
      .container {
        margin: 12px;
      }

      .bread {
        padding: 0 12px;
      }

      .content {
        min-height: e("calc(100vh - 160px)");
      }

      :global {
        .content-inner {
          padding: 12px;
          min-height: e("calc(100vh - 160px)");
        }
      }
    }
  }
}
