// tag公共渲染样式
@mixin tagRender() {
  display: flex;
  align-items: center;
  max-width: 300px;

  .text {
    max-width: 260px;
    width: fit-content;
    display: inline-block;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .ant-tag-close-icon {
    display: flex;
  }
}

.#{$ns}Crud {
  position: relative;

  // .#{$ns}Form--inline {
  //   padding-top: 0;
  // }

  // &.is-loading>&-body {
  // 弹框中，blur 效果变成白班，先去掉。
  // -webkit-filter: blur(5px);
  // filter: blur(5px);
  // }
  &-head {
    position: relative;
    height: auto;
    // .#{$ns}Form-filter-wrapper {
    //   display: grid;
    //   grid-template-rows: 1fr;
    //   transition: grid-template-rows .3s ease;
    //   &.#{$ns}Form-filter-hidden {
    //     grid-template-rows: 0fr;
    //     .#{$ns}Form--grid {
    //       padding-top: 0;
    //       border-bottom: 0;
    //     }
    //   }
    // }
    // .#{$ns}Form--grid {
    //   transition: padding .1s ease;
    //   transition-delay: .2s;
    //   overflow: hidden;
    // }

    >.#{$ns}Alert {
      border-top: 0;
      border-left: 0;
      border-bottom: 1px solid var(--saas-Border-Dividers);
      border-color: var(--saas-Border-Dividers);

      .#{$ns}Alert-close {
        svg.icon {
          font-size: 12px;
        }
      }
    }

    &-height {
      height: 15px;
      overflow: hidden;
      border-bottom: 1px solid var(--saas-border-color);
    }

    &-empty {
      height: 15px;
      background-color: var(--saas-crud-title-from-color);
    }

    &-action {
      position: absolute;
      width: 40px;
      height: 15px;
      background-color: rgba(230, 232, 235);
      top: 0;
      left: 50%;
      z-index: 1;
      transform: translateX(-50%);
      border-bottom-left-radius: 5px;
      border-bottom-right-radius: 5px;
      text-align: center;
      line-height: 15px;
      cursor: pointer;
      color: var(--saas-font-size-color-reverse);

      @media screen and (max-width: 1600px) {
        width: 20px;
        height: 8px;
        line-height: 8px;
      }
    }

    &-filter {
      color: var(--saas-font-size-dark-black);
      display: flex;
      align-items: center;
      height: 40px;
      border-bottom: 1px solid var(--saas-Border-Dividers);
      padding: 4px 8px;

      .filter-menu {
        margin: 0 8px;
        flex: 1;
        display: flex;
        // flex-wrap: wrap;
        // @include gap(5px);
        overflow: hidden;
        align-items: center;

        .ant-tag {
          @include tagRender;
        }

        &-item {
          display: flex;
          margin-right: 6px;

          .ant-tag {
            color: var(--saas-crud-filters-font-color);
            background-color: var(--saas-crud-filters-bg-color);
          }

          .is-advanced {
            border: 1px solid var(--saas-crud-filters-font-border-color);
          }
        }
      }

      .filter-search-wrapper {
        display: flex;
        align-self: flex-start;

        .filter-search-items {
          display: flex;
          align-items: center;
          height: 32px;
          font-size: 12px;

          .#{$ns}Form-item {
            margin-right: 0;
          }

          button {
            height: 24px;
            display: flex;
            align-items: center;

            &:not(:last-child) {
              margin-right: 8px;
            }
          }
        }
      }

      .filter-select-wrap {
        display: flex;
        align-items: center;
        border-bottom: 1px solid #e7e7e7;
        margin-right: 8px;

        .icon {
          color: #bfbfbf;
          width: 20px;
          height: 20px;
          top: 0;
        }
      }

      .filter-select {
        width: 240px;
        font-size: 12px;

        .ant-select-selection-placeholder {
          font-size: 12px;
        }

        .ant-select-selection-overflow-item-rest {
          .ant-select-selection-item {
            border: none;
            background-color: transparent;
          }
        }

        &-tag {
          margin-right: 6px;
          margin-bottom: 4px;

          .anticon-close-circle,
          .ant-tag-close-icon {
            opacity: 0;
          }

          &:hover {

            .anticon-close-circle,
            .ant-tag-close-icon {
              opacity: 1;
            }
          }

          &-label {
            font-size: 12px;
            color: #3574ee;
            border: 1px solid #dcdcdc;
            background-color: #f7f9fc;
            padding: 4px;
          }

          &-value {
            font-size: 12px;
            color: #00000090;
            border: 1px solid #dcdcdc;
            border-left: none;
            padding: 4px;
          }
        }
      }
    }
  }

  &-selection {
    margin-bottom: var(--gap-base);
  }

  &-selectionLabel {
    display: inline-block;
    vertical-align: top;
    margin-top: var(--gap-xs);
  }

  &-value {
    cursor: pointer;
    vertical-align: middle;
    user-select: none;
    line-height: calc(var(--Form-input-lineHeight) * var(--Form-input-fontSize) - #{px2rem(2px)});
    display: inline-block;
    font-size: var(--Form-selectValue-fontSize);
    color: var(--Form-selectValue-color);
    background: var(--Form-selectValue-bg);
    border: px2rem(1px) solid var(--Form-selectValue-borderColor);
    border-radius: 2px;
    margin-right: var(--gap-xs);
    margin-top: var(--gap-xs);

    &:hover {
      background: var(--Form-selectValue-onHover-bg);
    }

    &.is-disabled {
      pointer-events: none;
      opacity: var(--Button-onDisabled-opacity);
    }
  }

  &-valueIcon {
    cursor: pointer;
    border-right: px2rem(1px) solid var(--Form-selectValue-borderColor);
    padding: 1px 5px;

    &:hover {
      background: var(--Form-selectValue-onHover-bg);
    }
  }

  &-valueLabel {
    padding: 0 var(--gap-xs);
  }

  &-selectionClear {
    display: inline-block;
    cursor: pointer;
    user-select: none;
    margin-left: var(--gap-xs);
    margin-top: var(--gap-xs);
    vertical-align: middle;
  }

  &-bulkActions {
    display: flex;
    align-items: center;
  }

  // Jay
  &-toolbar.footer {
    background-color: var(--Layout-header-bg);
    flex: 1;
    overflow: auto;
    width: 100%;
    display: inline-flex;

    &:last-of-type {
      flex-direction: row-reverse;
    }

    @include media-breakpoint-up(sm) {
      .#{$ns}Crud-toolbar-tool--actions {
        flex-direction: row-reverse;
        font-size: 12px;
        background: var(--saas-crud-table-thead-color);

        .#{$ns}Crud-pager {
          height: 30px;
          line-height: 30px;

          .#{$ns}Pagination-wrap {
            .#{$ns}Pagination {

              >li>a,
              >li>span {
                font-size: 12px;
              }
            }
          }
        }

        .#{$ns}Crud-pageSwitch {
          .ant-select {
            font-size: 12px;

            .ant-select-selector {
              border: 0;
              box-shadow: none !important;
              background-color: var(--saas-crud-table-thead-color);
              // padding-left: 0;
            }
          }
        }
      }
    }
  }

  &-toolbar-item {
    margin-right: var(--Crud-toolbar-gap);
    vertical-align: middle;
    display: inline-flex;

    &--left {
      float: left;
    }

    &--right {
      float: right;
    }
  }

  &-toolbar-tool {
    border-radius: 3px;
    overflow: hidden;
    transition: all 0.3s;
    height: 32px;
    white-space: nowrap;

    &-content {
      display: flex;
      flex-wrap: nowrap;
      height: 32px;
      align-items: center;

      &::before {
        content: "";
        /* 伪元素是行内元素，需要转变为块元素 */
        display: inline-block;
        height: 0;
        clear: both;
        visibility: hidden;
      }

      .#{$ns}Crud-toolbar-item {
        margin: 0;
        display: flex;
        align-items: center;

        >.#{$ns}DropDown {
          >.#{$ns}Button {
            background: none;
            border: 0;
            color: var(--saas-font-size-dark-black);

            .#{$ns}DropDown-caret {
              margin-left: 0;
            }
          }

          >.#{$ns}DropDown-popover {
            >.#{$ns}DropDown-menu-root>.#{$ns}DropDown-menu {
              .#{$ns}Button--default {
                color: var(--saas-font-size-dark-black);

                &:hover {
                  color: var(--saas-font-size-dark-black);
                }
              }
            }
          }
        }

        >.exportExcel,
        >.#{$ns}Crud-loadMore,
        >.#{$ns}ColumnToggler {
          display: flex;
          align-items: center;

          >.#{$ns}Button {
            border-color: transparent;
            box-shadow: none;
            background: none;
            border: none;
            color: var(--saas-font-size-dark-black);
            padding: 0px 5px;
            display: inline-flex;
            align-items: center;
            line-height: 24px;

            &:hover {
              background: none;
              border: none;
              color: var(--saas-font-size-black);
            }

            .icon {
              margin-right: 0 !important;
              font-size: 16px;
              top: -1px;
            }
          }
        }

        >.#{$ns}Button {
          border-color: transparent;
          box-shadow: none;
          background: none;
          border: none;
          font-size: 12px;
          color: var(--saas-font-size-dark-black);
          padding: 0px 5px;
          line-height: 24px;
          display: inline-flex;
          align-items: center;

          &:hover {
            background: none;
            border: none;
            color: var(--saas-font-size-black);
          }

          .icon {
            margin-right: 0 !important;
            font-size: 16px;
            top: -1px;
          }
        }

        >.#{$ns}Crud-statistics {
          line-height: 32px;
        }
      }
    }

    &-content.more-content-box {
      color: var(--saas-font-size-dark-black);
      background: var(--saas-crud-table-thead-color);
    }
  }

  &-actions {

    >*+.#{$ns}Button,
    >*+.#{$ns}ButtonGroup,
    >*+.#{$ns}DropDown,
    >*+.#{$ns}ButtonToolbar {
      margin-left: var(--Crud-toolbar-gap);
    }
  }

  &-statistics {
    vertical-align: middle;
  }

  &-pageSwitch {
    .#{$ns}Select {
      margin-left: var(--Crud-toolbar-gap);
      // Jay
      padding: 5px 6px 5px 11px;
    }
  }

  &-pager {
    align-self: flex-start;
  }

  &-filter {
    margin-bottom: var(--gap-base);
  }

}

@include media-breakpoint-up(sm) {
  .#{$ns}Crud {
    &-toolbar {
      margin-left: 0;
      width: 100%;
      overflow: hidden;
      @include clearfix();

      &-tool--actions {
        display: flex;
        width: 100%;
        justify-content: flex-start;
        align-items: center;
        overflow-x: auto;
      }

      &-tool--head {
        border: 0.0625rem solid var(--saas-Border-Dividers);
        border-bottom: 0;
        background-color: var(--saas-crud-table-thead-color);
        display: flex;
        justify-content: space-between;
        align-items: center;

        .#{$ns}Table-affix {
          // width: 500px;
          width: fit-content;
          justify-content: flex-start;
          color: var(--saas-font-size-dark-black);

          .#{$ns}Crud-toolbar.footer {
            width: auto;
            flex: unset;
            margin-left: 8px;
          }

          .#{$ns}Table-affixs {
            .#{$ns}Table-affix-text {
              line-height: 32px;
            }
          }

          .#{$ns}Crud-toolbar.footer {
            .#{$ns}Crud-toolbar-tool--actions {
              .#{$ns}Crud-toolbar-item {
                .#{$ns}Crud-pageSwitch {
                  .ant-select {
                    color: var(--saas-font-size-dark-black);

                    .ant-select-arrow {
                      color: var(--saas-font-size-dark-black);
                    }
                  }
                }
              }
            }
          }
        }

        .#{$ns}Crud-toolbar-tool {
          flex: 1;

          &-content {
            justify-content: flex-end;

            .overflow-container {
              width: 100%;

              .overflow-box {
                justify-content: flex-end;

                .overflow-wrapper {
                  width: 100%;
                  justify-content: flex-end;

                  &.isOverflow {
                    justify-content: unset;
                  }
                }
              }

              .more-btn-box {
                color: var(--saas-font-size-dark-black);
                background: var(--saas-crud-table-thead-color);
              }
            }
          }
        }
      }
    }

    &-toolbar-item {
      margin-right: var(--Crud-toolbar-gap);
      line-height: var(--Crud-toolbar-lineHeight);
      height: auto;
      vertical-align: middle;

      &--left {
        margin-bottom: 8px;

        .show-field-translate-container {
          height: 30px;
          line-height: 30px;

          .ant-checkbox-wrapper,
          .ant-checkbox {
            color: rgba(#000000, .6);
            font-size: 12px;
          }
        }
      }
    }

    &-actions {

      >*+.#{$ns}Button,
      >*+.#{$ns}Button--disabled-wrap {
        margin-left: var(--Crud-toolbar-gap);
      }
    }
  }
}

/* Aug移动端样式 */
@include media-breakpoint-down(sm) {
  .#{$ns}Crud {

    &-toolbar.footer {
      flex: 1;
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: transparent;
      padding: 0 16px;
      overflow-x: auto;

      //隐藏滚动的
      &::-webkit-scrollbar {
        display: none;
      }

      .#{$ns}Crud-toolbar-item {
        flex: 1;
        display: flex;
        margin: 0 12px 0 0;

        &:last-child {
          margin: 0;
        }

        .#{$ns}Button {
          flex: 1;
        }
      }
    }

    &-bulkActions {
      display: flex;
      align-items: center;
      flex: 1;
    }

    .offline-progress-mask {
      opacity: .6;
      z-index: 1001;
      position: absolute;
      z-index: 12;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: #fcfcfa;
      transition: ease-out opacity var(--animation-duration);
    }

    .offline-progress-spinner {
      position: absolute;
      z-index: 1001;
      top: 50%;
      left: 50%;
      transform: translate3d(-50%, -50%, 0);
      opacity: 1;
    }
  }

  .#{$ns}Crud.tableRotate {
    transition: all ease-in .5s;
    transform: rotate(90deg);
    width: 100vh;
    height: 100vw !important;
    position: fixed;
    top: calc(50vh - 50vw);
    right: calc(50vw - 50vh);
    z-index: 10000;
    background-color: #fff;
  }

  .#{$ns}Mobile-header-toolbar-wrapper {
    width: 100%;
    background: var(--saas-main-bg);
    display: flex;
    padding: var(--ListItem-paddingX);
    flex-direction: column;
    border-bottom: 1px solid #dfe2e6;
    border-top: 1px solid #dfe2e6;

    &:empty {
      display: none;
    }

    &>div {
      display: flex;
      align-items: center;
      justify-content: flex-start;
    }

    .#{$ns}Mobile-filter,
    .#{$ns}Mobile-reload {
      border-radius: 6px;
      text-align: left;
      // padding: 0 10px;
      // height: 32px;
      color: #999;
      background: transparent;
      border: none;

      .filter-text {
        font-size: 14px;
        margin-left: 2px;
      }

      .filter-text.has-filter {
        color: #1899ff;
      }

      .icon {
        font-size: 15px;
      }
    }

    .#{$ns}Mobile-reload {
      padding-right: 0;
    }

    .filter-conditions {
      flex: 1;
      font-size: 14px;
      color: #aaa;
      @include ellipsis();
    }

    .header-btns {
      display: flex;
      @include gap(8px);
    }
  }

  .#{$ns}Mobile-batch-manage {
    // margin-left: 8px;
    cursor: pointer;
    color: #999;

    &.is-active {
      color: var(--Button--link-color);
    }

    .batch-manage-icon {
      font-size: 16px;
      color: #999;
    }

    .batch-text {
      font-size: 14px;
      color: #999;
      margin-left: 2px;
    }

    .icon {
      font-size: 15px;
    }

    .toolbar-item {
      display: flex;
    }
  }

  .#{$ns}Mobile-checkall {
    font-size: 12px;
    margin-left: 6px;

    .#{$ns}Checkbox {
      margin-right: 4px;
    }
  }

  .#{$ns}Drawer .#{$ns}Mobile-header-toolbar-wrapper {
    top: auto;
  }

  .picker-modal {
    .#{$ns}Mobile-header-toolbar-wrapper {
      right: unset;
    }
  }
}

.virtual-table-cell {
  .#{$ns}Tpltab {
    display: flex;
    justify-content: space-between;
    align-items: center;

    .#{$ns}TplOpen {
      height: 28px !important;
      overflow: hidden;
    }
  }
}

.#{$ns}Tool-action {

  .ant-popover-content {
    .ant-popover-arrow {
      .ant-popover-arrow-content {
        --antd-arrow-background-color: var(--Layout-header-bg);
      }
    }

    .ant-popover-inner {
      background-color: var(--Layout-header-bg);
      border-radius: 4px;

      .ant-popover-inner-content {
        padding: 0;

        .crud-mode-exchange {
          width: 100px;
          display: flex;
          flex-direction: column;
          justify-content: flex-start;
          align-items: flex-start;

          &>.#{$ns}Button {
            width: 100%;
            text-align: left;
            border-radius: 0;
            border: 0;

            >.icon {
              margin-right: 3px;
              width: 14px;
              height: 14px;
            }
          }
        }

        .#{$ns}Tool-action-shadow {
          width: 100%;
          height: 100%;
          position: fixed;
          top: 0;
          left: 0;
          z-index: 9999;
        }

        .#{$ns}Tool-action-body {
          width: 120px;
          position: relative;
          z-index: 10000;
          padding: 8px 0;

          button {
            width: 100%;
            border-color: transparent;
            box-shadow: none;
            background: none;
            border: none;
            color: var(--saas-font-size-dark-black);
            line-height: 17px;
            display: inline-flex;
            align-items: center;
            border-radius: 0;
            padding: 8px;

            &:hover {
              background-color: var(--frameworkSelectedBackGroundColor);
              border: none;
              color: var(--saas-font-size-black);
            }

            span {
              flex: 1;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
              text-align: left;
            }

            .icon {
              margin-right: 4px !important;
              font-size: 16px;
              top: 1px;
            }
          }

          .#{$ns}Button:disabled {
            background-color: var(--frameworkSelectedBackGroundColor);
            color: var(--saas-font-size-light-black);
            opacity: 0.3;

            &:hover {
              color: var(--saas-font-size-light-black);
            }
          }
        }
      }
    }
  }
}

.find-and-replace-tabs {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  user-select: none;

  .find-and-replace-tab {
    margin-right: 40px;
    @include font_size(18px);
    color: var(--saas-Title-Text);
    cursor: pointer;

    &:last-child {
      margin-right: 0;
    }

    &.active {
      position: relative;
      color: #2a87eb;

      &::after {
        position: absolute;
        left: 0;
        bottom: -10px;
        content: "";
        width: 100%;
        height: 2px;
        background: #2a87eb;
      }
    }
  }
}

.find-and-replace-pc-wrapper {
  width: 100%;
  background: var(--saas-Background-Header);

  .wrapper-inner {
    .options-con {
      .option-item {
        display: flex;
        flex-flow: row nowrap;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 20px;

        &:last-child {
          margin-bottom: 0;
        }

        .name {
          width: 58px;
          @include font_size(14px);
          color: var(--saas-Title-Text);
          flex-shrink: 0;
          margin-right: 20px;
          text-align: right;
        }
        .ant-radio-group {
          .ant-radio-wrapper {
            color: var(--saas-Title-Text);
          }
        }

        .match-con {
          flex-grow: 1;
          display: flex;
          flex-flow: row nowrap;
          align-items: center;

          >.ant-select {
            flex: 1;
          }
        }

        &.findField {
          max-height: 100px;
          overflow: auto;

          .fl-select-wrapper {
            overflow: hidden;

            .ant-select-selection__rendered {
              margin-right: 0;
            }
          }

          >.ant-select {
            flex: 1;
          }
        }

        .ant-input {
          flex: 1;
          height: 32px;
        }
      }

      .range-item {
        justify-content: left;
      }
    }

    .btn-margin {
      margin-left: 10px;
    }

    .btn-con {
      display: flex;
      flex-flow: row nowrap;
      align-items: center;
      justify-content: flex-end;
      padding-top: 40px;

      .btn {
        margin-right: 20px;

        &:last-child {
          margin-right: 0;
        }
      }

      .replace-btn {
        &:hover {
          opacity: 0.8;
        }
      }
    }
  }

  .case-sensitive {
    padding-left: 20px;
    .ant-checkbox-wrapper {
      color: var(--saas-Title-Text);
    }
  }
}

.textarea-popover {
  background: var(--Form-input-bg);
  color: var(--saas-font-size-dark-black);

  .ant-popover-inner {
    background: var(--Form-input-bg);
    color: var(--saas-font-size-dark-black);
    border-color: var(--Form-input-borderColor);

    .ant-popover-arrow-content {
      background: var(--Form-input-bg);
    }

    .ant-popover-inner-content {
      background: var(--Form-input-bg);
      color: var(--saas-font-size-dark-black);
    }

    .ant-input {
      background: var(--Form-input-bg);
      border-color: var(--Form-input-borderColor);
    }
  }
}

.ant-modal-header {
  background: var(--saas-Background-Header);

  .ant-modal-title {
    color: var(--saas-Title-Text);
  }
}

.ant-modal-wrap {
  .ant-modal-content {
    .ant-modal-close {
      color: var(--saas-Title-Text);
    }

    .ant-modal-body {
      background: var(--saas-Background-Header);
    }
  }
}

.ant-drawer {
  .ant-drawer-content {
    background: var(--saas-Background-Header);
    color: var(--saas-Title-Text);

    .ant-drawer-header {
      background: var(--saas-Background-Header) !important;

      .ant-drawer-title,
      .ant-drawer-close {
        color: var(--saas-Title-Text);
        background-color: var(--saas-Background-Header);

        svg {
          path {
            fill: var(--saas-Title-Text);
          }
        }
      }
    }

    .ant-drawer-footer {
      .ant-checkbox-wrapper {
        color: var(--saas-Title-Text);
      }
    }
  }
}