// 函数示例
/* @function px2rem($px) {
  $rem: 14px;
  @return ($px/$rem) + rem;
} */

@mixin dropdown-menu($width: auto, $min-width: auto, $submenu-min-width: auto) {
  z-index: 2050; /* 没有这行则 抽屉无法显示右键菜单 */
  width: $width;
  min-width: $min-width !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.15);
  background: #fff;
  border-radius: 4px;

  .ant-dropdown-menu {
    padding: 8px 0;
    border-radius: 4px;

    .ant-dropdown-menu-item {
      line-height: 25px;
      margin: 0;
      padding: 0 16px;
      font-size: 13px;
      outline: 0;
      display: flex;
      align-items: center;
      transition: 0.2s;
      border-bottom: 1px solid transparent;
      color: #606266 !important;
      background: #fff;

      .ant-dropdown-menu-title-content {
        width: 100%;
      }

      .menu-item-wrap {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        width: 100%;
        padding: 0 !important;

        .ant-input {
          width: 40px;
          height: 24px;
          margin: 0 5px;
          line-height: 1.4;
          padding: 1px 3px !important;
          font-size: 12px;
          text-align: center;
        }

        .ant-input-number {
          width: 40px;
          margin: 0 5px;
          font-size: 12px;
          vertical-align: middle;

          &.is-percent {
            width: 60px;
          }

          .ant-input-number-input-wrap {
            height: 24px;

            .ant-input-number-input {
              height: 100%;
              font-size: 12px;
              vertical-align: top;
              padding: 0 16px 0 0;
              text-align: center;
            }
          }

          .ant-input-number-handler-wrap {
            width: 16px;
            opacity: 1;

            &:hover {
              .ant-input-number-handler {
                height: 50%;
              }
            }

            .ant-input-number-handler-down {
              display: flex;
              align-items: center;
              justify-content: center;

              &:hover {
                height: 50% !important;
              }

              .ant-input-number-handler-down-inner {
                position: static;
                margin-top: 0;
              }
            }

            .ant-input-number-handler-up {
              display: flex;
              align-items: center;
              justify-content: center;

              &:hover {
                height: 50% !important;
              }

              .ant-input-number-handler-up-inner {
                position: static;
                margin-top: 0;
              }
            }
          }
        }
      }

      &:hover {
        background: #ecf5ff;
        color: #409eff !important;

        .iconfont {
          color: #409eff;
        }
      }

      &-disabled {
        color: #c0c4cc !important;

        &:hover {
          background: #fff;
          color: #c0c4cc !important;

          .iconfont {
            color: #c0c4cc !important;
          }
        }
      }

      .iconfont {
        display: inline-block;
        width: 14px;
        font-size: 13px;
        margin-right: 8px;
      }
    }
  }

  .ant-dropdown-menu-submenu {
    &-disabled {
      .ant-dropdown-menu-submenu-title {
        color: #c0c4cc !important;

        &:hover {
          background: #fff;
          color: #c0c4cc !important;

          .iconfont {
            color: #c0c4cc !important;
          }

          .ant-dropdown-menu-submenu-arrow-icon {
            color: #c0c4cc !important;
          }
        }

        .ant-dropdown-menu-submenu-arrow-icon {
          color: #c0c4cc !important;
        }
      }
    }

    &-title {
      line-height: 32px;
      margin: 0;
      outline: 0;
      padding: 0 16px !important;
      display: flex;
      align-items: center;
      font-size: 13px;
      color: #606266 !important;
      border-bottom: 1px solid transparent;
      transition: 0.2s;
      background: #fff;

      &:hover {
        background: #ecf5ff;
        color: #409eff !important;

        .iconfont {
          color: #409eff;
        }

        .ant-dropdown-menu-submenu-arrow-icon {
          color: #409eff !important;
        }
      }

      .iconfont {
        display: inline-block;
        width: 14px;
        font-size: 13px;
        margin-right: 8px;
      }

      .ant-dropdown-menu-submenu-arrow {
        &-icon {
          display: flex;
          align-items: center;
          margin-top: 1px;
          width: 14px;
          height: 14px;

          > svg {
            display: none;
          }

          &::after {
            font-family: "iconfont";
            content: "\e630";
            font-size: 18px;
          }

          font-size: 14px;
          font-weight: 800;
          color: #606266 !important;
        }
      }
    }

    > .ant-dropdown-menu-submenu-content {
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.15);
    }
  }

  .ant-dropdown-menu-submenu-popup {
    min-width: $submenu-min-width;

    .ant-dropdown-menu-sub {
      margin: 0;
    }
  }

  .ant-dropdown-menu-item-divider {
    margin: 0;
  }
}

// 普通的滚动条
@mixin scrollbar-normal {
  * {
    scrollbar-width: thin;
    scrollbar-track-color: transparent;
  }
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  ::-webkit-scrollbar-track {
    background-color: transparent;
  }

  ::-webkit-scrollbar-thumb {
    min-width: 50px;
    min-height: 50px;
    background-color: #c1c1c1;
    border-radius: 2px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.46);
  }
}

// handsontable 滚动条
@mixin scrollbar-handsontable {
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  ::-webkit-scrollbar-track {
    background-color: $backdrop;
    padding: 1px;
  }

  ::-webkit-scrollbar-track:horizontal {
    border-top: 1px solid #e6e6e6;
  }

  ::-webkit-scrollbar-track:vertical {
    border-left: 1px solid #e6e6e6;
  }

  ::-webkit-scrollbar-corner {
    display: block;
    background-color: $backdrop;
  }

  ::-webkit-scrollbar-thumb {
    min-width: 50px;
    min-height: 50px;
    max-width: 80px;
    max-height: 80px;
    background-color: $light-grey;
    border-radius: 1px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.4);
  }
}

@mixin summary-right-pane() {
  height: 100%;
  background: #fff;
  border: 1px solid #e8eaec;

  .filter-bar {
    height: 36px;
    flex: 0 36px;
    display: flex;
    padding: 0 3px;
    justify-content: space-around;
    align-items: center;

    ::v-deep .el-select {
      display: block;
      margin-right: 6px;
      height: 30px !important;
      line-height: 30px !important;
    }

    ::v-deep .el-input {
      display: flex;
      align-items: center;
      height: 30px;
      line-height: 30px;

      > .el-input__inner {
        line-height: 30px;
        border-radius: 2px;
      }

      > .el-input__prefix,
      > .el-input__suffix {
        line-height: 30px;
      }
    }
  }
  .search-result-nav {
    display: flex;
    height: 32px;
    flex: 0;
    justify-content: space-between;
    align-items: center;
    padding: 0 6px 4px;

    > .count {
    }

    > .nav-button-group {
    }

    > .close-button {
      cursor: pointer;
      font-size: 18px;
      color: #777;
      padding: 2px;
      border-radius: 50%;
      transition: all 0.2s;

      &:hover {
        color: $black;
        background-color: #ddd;
      }
    }
  }

  .table-area {
    position: relative;
    flex: 1;
    border-top: 1px solid #ddd;
  }
}
