@import "../../themes/vars.less";
@import "../../../node_modules/antd/lib/style/themes/default.less";

.layout {
  position: relative;
  height: 100vh;

  .header {
    z-index: 1000;
    margin-left: @sider-width;
    transition: @transition-ease-out;

    :global .ant-menu-submenu-title:hover {
      color: @primary-color;
    }

    :global .ant-menu-horizontal {
      display: inline-block;

      & > .ant-menu-submenu {
        float: right;
      }

      & > .ant-menu-submenu:hover {
        float: right;
        background-color: fade(@primary-color, 15%);
        color: @primary-color;
      }

      & > .ant-menu-submenu-open {
        color: @primary-color;
        border-bottom: 2px solid @primary-color;
      }

      .ant-menu-submenu-horizontal > .ant-menu {
        right: 0;
        left: inherit;
      }

      .ant-menu-submenu-selected {
        border: none;
        color: inherit;
      }

      .ant-menu-item-selected {
        background-color: inherit;
        color: inherit;
      }

      .anticon {
        font-size: 16px;
        margin-right: 0;
      }
    }

    box-shadow: @shadow-2;
    position: relative;
    display: flex;
    justify-content: space-between;
    height: 47px;
    background-color: #fff;

    .welcome {
      margin: auto;
      margin-left: 10px;
      span {
        font-size: 13px;
      }

      i {
        font-size: 20px;
      }
    }
    .rightWarpper {
      display: flex;
      padding-right: 20px;
    }

    .button {
      width: 47px;
      height: 47px;
      line-height: 47px;
      text-align: center;
      cursor: pointer;
      transition: @transition-ease-in;

      i {
        font-size: 22px;
      }

      &:hover {
        color: @primary-color;
        background-color: fade(@primary-color, 15%);
      }
    }
  }

  .sider {
    width: @sider-width;
    background: @menu-dark-bg;
    position: absolute;
    overflow: visible;
    padding-bottom: 24px;
    height: 100vh;
    transition: @transition-ease-out;
    box-shadow: @shadow-1;
    color: #fff;

    &.light {
      background: #fff;

      .switchtheme {
        background: #fff;
        border-top: solid 1px #f8f8f8;
      }
    }

    .logo {
      text-align: center;
      //height: 90px;
      //background: #FFCC33;
      //background: #ffbf00;
      line-height: 30px;
      cursor: pointer;
      padding: 5px 0;
      transition: @transition-ease-out;
      overflow: hidden;

      h2 {
        color: white;
      }

      img {
        //height: 80%;
        width: 80%;
        //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;
      }
    }

    :global {
      .ant-menu-dark,
      .ant-menu-dark .ant-menu-sub {
        color: #dfdfdf;
      }

      .ant-menu-dark .ant-menu-item > a {
        color: #dfdfdf;
      }

      .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-item-selected {
            //background-color: @dark-half;
          }
        }
      }

      .ant-menu {
        transition: @transition-ease-out;
        .ant-menu-item,
        .ant-menu-submenu-title {
          color: #dfdfdf;
          overflow: hidden;
          white-space: normal;
          font-size: 14px;
        }

      }
    }
  }

  .main {
    position: relative;
    margin-left: @sider-width;
    max-height: e("calc(100vh - 40px)");
    overflow: auto;
    height: 100%;
    transition: @transition-ease-out;

    :global {
      .content-inner {
        background: #fff;
        padding: 12px;
        box-shadow: @shadow-2;
        min-height: e("calc(100vh - 112px)");
        //min-height: e("calc(100vh + 100px)");
      }
    }

    .container {
      //max-height: 100vh;
      //height: e("calc(100vh - 100px)");
      margin: 12px 24px 24px 24px;
    }

    .content {
      //min-height: e("calc(100vh + 100px)");
      //min-height: e("calc(100vh + 0px)");
      position: relative;
      //height: calc(100vh + 30px);
    }
  }

  &.withnavbar {
    .main {
      margin-left: 0;
    }
  }

  &.fold {
    .sider {
      width: 64px;

      .logo {
        img {
          width: 60px;
          height: 60px;
          margin: 0;
        }
      }

      :global {
        .ant-menu-root {
          width: 100%;
          overflow: visible;

          & > .ant-menu-item {
            padding: 0 !important;
            text-align: center;

            .anticon {
              font-size: 20px;
              margin-right: 0;
            }
          }

          & > .ant-menu-submenu {
            & > .ant-menu-submenu-title {
              padding: 0 !important;
              text-align: center;

              .anticon {
                font-size: 20px;
                margin-right: 0;
              }

              &::after {
                display: none;
              }
            }
          }
        }
      }
    }

    .main {
      margin-left: 64px;
    }

    .header {
      margin-left: 64px;
    }
  }
}

//:global .ant-menu-dark {
//  color: #dfdfdf;
//  background-color: @menu-dark-bg;
//
//  .ant-menu-submenu-title:hover,
//  .ant-menu-submenu:hover {
//    color: @primary-color;
//    //color: white;
//    background-color: @dark-half;
//  }
//
//  .ant-menu-sub {
//    color: #dfdfdf;
//  }
//
//  .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: #dfdfdf;
//    }
//
//    &:hover {
//      background-color: @dark-half;
//    }
//
//    &:hover > a {
//      color: @primary-color;
//    }
//  }
//
//  &.ant-menu-inline {
//    .ant-menu-item-selected {
//      background-color: @dark-half;
//    }
//    .ant-menu-sub {
//      background: #3e3e3e;
//    }
//  }
//
//  .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: 768px) {
  .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)");
        }
      }
    }

    .header {
      margin-left: 0;
    }
  }
}
