.#{$ns}Drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: $zindex-modal;
  overflow: hidden;
  outline: 0;
  font-family: system-ui, -apple-system, Helvetica Neue, sans-serif;

  &-content {
    position: absolute;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    background: var(--Drawer-bg);
    background-clip: padding-box;
    outline: 0;
    z-index: 2;
    border: var(--Drawer-content-borderWidth) solid var(--Drawer-content-borderColor);
    border-radius: var(--Drawer-content-borderRadius);
    transition: transform ease-in-out var(--animation-duration);
  }

  &-overlay {
    transition: ease-out opacity var(--animation-duration);
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    background: var(--Drawer-overlay-bg);
    opacity: 0;

    &.in {
      opacity: 1;
    }
  }

  &-header {
    padding: var(--Drawer-header-padding);
    background: var(--Drawer-header-bg);
    @include clearfix();
    display: flex;
    border-bottom: var(--Drawer-content-borderWidth) solid var(--Drawer-header-borderColor);
    border-top-left-radius: var(--Drawer-content-borderRadius);
    border-top-right-radius: var(--Drawer-content-borderRadius);
  }

  &-title {
    font-size: var(--Drawer-title-fontSize);
    color: var(--Drawer-title-fontColor);
  }

  &-close {
    position: absolute;
    color: var(--Drawer-close-color);
    line-height: 1;
    text-decoration: none;

    svg {
      width: 30px;
      height: 30px;
      fill: var(--Drawer-close-color);
    }

    &:not(.is-disabled) {
      cursor: pointer;

      &:hover {
        text-decoration: none;
        color: var(--Drawer-close-onHover-color);

        svg {
          fill: var(--Drawer-close-onHover-color);
        }
      }
    }
  }

  &-body {
    padding: var(--Drawer-body-padding);
    flex-basis: 0;
    flex-grow: 1;
    overflow: auto;
  }

  &-footer {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: var(--Drawer-footer-padding);
    border-top: var(--Drawer-content-borderWidth) solid var(--Drawer-footer-borderColor);
    border-bottom-left-radius: var(--Drawer-content-borderRadius);
    border-bottom-right-radius: var(--Drawer-content-borderRadius);

    .#{$ns}Button {
      margin-left: var(--gap-xs);
    }

    .#{$ns}Drawer-info {
      flex-basis: 0;
      flex-grow: 1;
      text-align: left;
      align-self: center;
    }

    .#{$ns}Drawer-error {
      color: var(--danger);
      white-space: pre-wrap;
    }
  }

  &.#{$ns}Drawer--noOverlay {
    pointer-events: none;

    .#{$ns}Drawer-close svg {
      margin-top: px2rem(2px);
      width: var(--gap-md);
      height: var(--gap-md);
      fill: #99a6ad;
    }
  }

  .#{$ns}Drawer-resizeCtrl {
    position: absolute;
    border: var(--borderWidth) solid var(--borderColor);
    background: var(--white);
    border-radius: var(--borderRadius);
    font-size: var(--fontSizeSm);
    line-height: px2rem(10px);
    text-align: center;
    user-select: none;
  }
}

.flow_dom_drawer {
  &.pc {
    // 往下便宜50像素用
    height: calc(100vh - var(--headerBarHeight));
    top: var(--headerBarHeight);
  }


  .#{$ns}Table {
    .#{$ns}TableTable-contentWrap {
      .#{$ns}TableTable-content {
        height: auto !important;
        max-height: calc(100vh - 250px);
      }
    }
  }
}

// size
@include media-breakpoint-up(sm) {
  .#{$ns}Drawer .#{$ns}Drawer-content {
    width: var(--Drawer-widthBase);
    height: var(--Drawer-widthBase);
  }

  .#{$ns}Drawer--xs .#{$ns}Drawer-content {
    width: var(--Drawer-widthXs);
    height: var(--Drawer-widthXs);
  }

  .#{$ns}Drawer--sm .#{$ns}Drawer-content {
    width: var(--Drawer-widthSm);
    height: var(--Drawer-widthSm);
  }

  .#{$ns}Drawer--md .#{$ns}Drawer-content {
    width: var(--Drawer-widthMd);
    height: var(--Drawer-widthMd);
  }

  .#{$ns}Drawer--lg .#{$ns}Drawer-content {
    width: var(--Drawer-widthLg);
    height: var(--Drawer-widthLg);
  }

  .#{$ns}Drawer--xl .#{$ns}Drawer-content {
    width: var(--Drawer-widthXl);
    height: var(--Drawer-widthXl);
  }

}

.#{$ns}Drawer {
  .#{$ns}Drawer-content {
    .#{$ns}Drawer-body {
      .#{$ns}Tabs--content-tiled.#{$ns}Combination {
        margin: 0;
      }
    }
  }
}


// positons
.#{$ns}Drawer--top .#{$ns}Drawer-content.in,
.#{$ns}Drawer--right .#{$ns}Drawer-content.in,
.#{$ns}Drawer--bottom .#{$ns}Drawer-content.in,
.#{$ns}Drawer--left .#{$ns}Drawer-content.in {
  transform: translate3d(0, 0, 0);
}

.#{$ns}Drawer--top {
  .#{$ns}Drawer-close {
    top: 100%;
    margin-top: var(--gap-sm);
    left: var(--gap-sm);
  }

  &.#{$ns}Drawer--noOverlay {
    .#{$ns}Drawer-close {
      top: var(--gap-base);
      right: var(--gap-base);
      left: auto;
      margin-top: 0;
    }
  }

  .#{$ns}Drawer-content {
    top: 0;
    bottom: auto;
    left: 0;
    right: 0;
    width: 100%;
    transform: translate3d(0, -100%, 0);
    box-shadow: 0 10px 10px -10px rgba(0, 0, 0, 0.2);
    min-height: 120px;
  }

  .#{$ns}Drawer-resizeCtrl {
    bottom: px2rem(-6px);
    left: 50%;
    cursor: ns-resize;
    width: px2rem(24px);
    height: px2rem(12px);
  }
}

.#{$ns}Drawer--right {
  .#{$ns}Drawer-close {
    right: 100%;
    margin-right: var(--gap-sm);
    top: var(--gap-sm);
  }

  &.#{$ns}Drawer--noOverlay {
    .#{$ns}Drawer-close {
      top: var(--gap-base);
      right: var(--gap-base);
      margin-right: 0;
    }
  }

  .#{$ns}Drawer-content {
    top: 0;
    bottom: 0;
    left: auto;
    right: 0;
    height: 100%;
    transform: translate3d(100%, 0, 0);
    box-shadow: -10px 0 10px -10px rgba(0, 0, 0, 0.2);
    min-width: 120px;
  }

  .#{$ns}Drawer-footer {
    justify-content: flex-end;

    .#{$ns}Button {
      margin-left: 0;
      margin-right: var(--gap-xs);
    }

    .#{$ns}Drawer-info {
      flex-basis: 0;
      flex-grow: 1;
      order: 10;
      align-self: center;
      text-align: right;
    }

    .#{$ns}Drawer-error {
      color: var(--danger);
    }
  }

  .#{$ns}Drawer-resizeCtrl {
    left: px2rem(-6px);
    top: 50%;
    cursor: ew-resize;
    writing-mode: vertical-lr;
    width: px2rem(12px);
    height: px2rem(24px);
  }
}

.#{$ns}Drawer--bottom {
  .#{$ns}Drawer-close {
    bottom: 100%;
    margin-bottom: var(--gap-sm);
    left: var(--gap-sm);
  }

  &.#{$ns}Drawer--noOverlay {
    .#{$ns}Drawer-close {
      top: var(--gap-base);
      right: var(--gap-base);
      left: auto;
      margin-bottom: 0;
    }
  }

  .#{$ns}Drawer-content {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    transform: translate3d(0, 100%, 0);
    box-shadow: 0 -10px 10px -10px rgba(0, 0, 0, 0.2);
    min-height: 120px;
  }

  .#{$ns}Drawer-resizeCtrl {
    top: px2rem(-6px);
    left: 50%;
    cursor: ns-resize;
    width: px2rem(24px);
    height: px2rem(12px);
  }
}

.#{$ns}Drawer--left {
  .#{$ns}Drawer-close {
    left: 100%;
    margin-left: var(--gap-sm);
    top: var(--gap-sm);
  }

  &.#{$ns}Drawer--noOverlay {
    .#{$ns}Drawer-close {
      left: auto;
      right: var(--gap-base);
      top: var(--gap-base);
    }
  }

  .#{$ns}Drawer-content {
    top: 0;
    bottom: 0;
    right: auto;
    left: 0;
    height: 100%;
    transform: translate3d(-100%, 0, 0);
    box-shadow: 10px 0 10px -10px rgba(0, 0, 0, 0.2);
    border-width: 0 var(--Drawer-content-borderWidth) 0 0;
    min-width: 120px;
  }

  .#{$ns}Drawer-resizeCtrl {
    right: px2rem(-6px);
    top: 50%;
    cursor: ew-resize;
    writing-mode: vertical-lr;
    width: px2rem(12px);
    height: px2rem(24px);
  }
}

/* Aug 更多操作 */
.#{$ns}Drawer-moreActions {
  position: absolute;
  left: #{px2rem(24px)};
  line-height: 30px;
  cursor: pointer;

  &-list {
    min-width: 60px;

    li {
      padding: 3px 0;

      a {
        color: var(--DropDown-menuItem-color);
      }
    }
  }
}

.#{$ns}Drawer.is-mobile {
  font-family: system-ui, -apple-system, Helvetica Neue, sans-serif;

  .#{$ns}Drawer-header {
    background-color: var(--saas-main-bg);
    height: 38px;
    line-height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-color: var(--saas-Border-Dividers);
    .icon-title-left {
      path {
        fill: var(--saas-Title-Text) !important;
      }
    }

    .#{$ns}Drawer-title {
      color: var(--saas-Title-Text);
      font-size: 16px;
      font-weight: 500;
      flex: 1;
      @include ellipsis();
    }
  }

  .#{$ns}Drawer-content {
    width: 100%;
    border-radius: 0;
    border: none;
  }

  .#{$ns}Drawer-body {
    padding: 0;
    // overflow: hidden;
  }

  .#{$ns}Drawer-footer {
    justify-content: space-between;
    height: 53px;
    line-height: 53px;
    box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.3);
    align-items: center;
    padding: 10px 16px;

    .#{$ns}Button {
      flex: 1;
      font-size: 14px;
      font-family: system-ui, -apple-system, Helvetica Neue, sans-serif;
      margin: 0;

      &:not(:first-child) {
        margin-left: 12px;
        margin-right: 0;
      }
    }
  }

  .#{$ns}Drawer-title {
    text-align: center;
  }

  .#{$ns}Drawer-back {
    float: left;
    font-size: 22px;
    color: #000;
    cursor: pointer;
  }

  .#{$ns}Drawer-moreActions {
    position: relative;
    left: 0;
  }
}

.#{$ns}Drawer.is-mobile.picker-modal {
  z-index: 1011;
}

//企微ios移动端底部优化
.#{$ns}Drawer.ios-space.is-mobile {

  >.#{$ns}Drawer-overlay,
  >.#{$ns}Drawer-content {
    height: calc(100% - 32px);
    box-shadow: none;

    .#{$ns}Drawer-footer {
      box-shadow: none;
    }
  }
}

//移动端表单页表格的抽屉样式，这里直接使用了antd的drawer
.ant-drawer.row-edit-drawer,
.ant-modal.row-edit-drawer {
  .ant-modal-header {
    color: #333;
    font-weight: 500;
    padding: 0;
    font-size: 14px;
    bottom: 0;

    .edit-row-header {
      display: flex;
      justify-content: space-between;
      padding: 0 16px;
      cursor: pointer;

      .close-edit {
        position: unset;
        font-size: 12px;
      }
    }

    .Modle_edit-row-header {
      padding: 0px;
    }

  }

  .ant-modal-body {
    max-height: calc(100vh - 94px);
    overflow-y: auto;
  }

  .edit-row-header {
    color: var(--saas-font-size-black);
    font-weight: 500;
    font-size: 14px;
    height: 40px;
    line-height: 40px;

    @include media-breakpoint-down(sm) {
      height: 38px;
      line-height: 38px;
      font-family: system-ui, -apple-system, Helvetica Neue, sans-serif;
      font-size: 16px;
      font-weight: 500;
      text-align: center;
      letter-spacing: 0px;
      color: #000;
      position: relative;
      background-color: #fff;

      .close-edit {
        position: absolute;
        top: 0;
        color: #000;
        font-size: 22px;
        left: 16px;
      }
    }
  }

  .Modle_edit-row-header {
    display: flex;
    justify-content: space-between;

    .close-title {
      flex: 1;
    }

    .close-edit {
      color: #000;
      font-size: 22px;
      width: 36px;
      position: relative;
      left: 0;

      svg {
        top: 0;
      }
    }
  }

  .ant-drawer-body {
    padding: 0;
    background-color: var(--them-bg-color);
    display: flex;
    flex-direction: column;

    .scroll-body {
      flex: 1;
      overflow: hidden;

      .#{$ns}TreeControl {
        border: none;

        .#{$ns}Tree-itemText {
          flex: 0;
          padding: .25rem;
        }
      }
    }

    .#{$ns}Form-advanced {
      .#{$ns}Form-item {
        .#{$ns}Form-value {
          .#{$ns}DateRangePicker-placeholder {
            margin-right: 0px
          }

          .#{$ns}DateRangePicker-toggler {
            display: none;
          }
        }
      }
    }
  }

  .ant-drawer-footer {
    display: flex;
    height: 53px;
    line-height: 53px;
    padding: 10px 16px;

    .ant-btn {
      flex: 1;
      font-size: 14px;
      font-family: system-ui, -apple-system, Helvetica Neue, sans-serif;
      margin: 0;

      &:not(:first-child) {
        margin-left: 12px;
        margin-right: 0;
      }
    }
  }
}

@include media-breakpoint-down(sm) {
  .ant-drawer.row-edit-drawer {
    position: fixed;

    .ant-drawer-body {
      .#{$ns}Form--horizontal.inModal {
        padding-top: 8px;
      }
    }
  }
}

//离线相关样式
.offline-drawer {
  .offline-table-container {
    .ant-table {
      z-index: 1;

      .ant-table-container {
        .ant-table-thead tr th {
          padding: 7px 10px;
          text-align: center;
        }

        .ant-table-tbody tr td {
          padding: 7px 10px;
        }
      }
    }
  }
}


.offline-drawer {
  transform: unset !important;

  .ant-drawer-header {
    padding: 0 12px;

    .ant-drawer-header-title {
      height: 38px;
      line-height: 38px;

      .ant-drawer-close {
        margin: 0;
      }

      .ant-drawer-title {
        text-align: center;
        padding-right: 28px;
      }
    }
  }

  .ant-drawer-body {
    padding: 0;
    background-color: #fafafa;

    .offline-form-container {
      form.#{$ns}Form {
        padding-top: 0;
      }
    }

    .offline-scan-num {
      background: #f7f8fa;
      position: sticky;
      top: 0;
      z-index: 2;
      height: 64px;
      line-height: 64px;
      display: flex;
      flex-direction: column;
      justify-content: center;

      &>div {
        height: 48px;
        line-height: 48px;
        background: #fff;
        padding: 0 0 0 16px;
        font-size: 15px;
        color: rgba(0, 0, 0, 0.9);
        font-weight: 500;
      }
    }
  }
}

.offline-picture-drawer {
  .ant-drawer-body {
    padding: 0;

    .offline-picture-item {
      margin: 8px;
    }
  }
}

.textarea-drawer {
  transform: unset !important;
  top: 0 !important;

  .ant-drawer-header {
    padding: 0;

    .ant-drawer-header-title {
      height: 38px;
      line-height: 38px;

      .ant-drawer-close {
        margin: 0;
        width: 36px;
        height: 100%;
      }

      .ant-drawer-title {
        text-align: center;
      }
    }

    .ant-drawer-extra {
      width: 36px;
      height: 100%;
      line-height: 38px;

      .ant-btn {
        padding: 0;
        width: 100%;
        text-align: center;
      }
    }
  }

  .ant-drawer-body {
    padding: 0;
    background-color: var(--saas-main-bg);
    padding: 16px 12px 20px;
    overflow: auto;

    .ant-input-textarea {
      border-bottom: 1px solid var(--saas-Border-Dividers);

      textarea {
        color: var(--saas-Title-Text);
        font-size: 15px;

        &::-webkit-input-placeholder {
          color: var(--saas-Placeholder-Text);
        }

        &::-moz-placeholder {
          color: var(--saas-Placeholder-Text);
        }

        &::-ms-input-placeholder {
          color: var(--saas-Placeholder-Text);
        }
      }

      &.disabled {
        textarea {
          color: var(--Form-down-input-noteditable);
        }
      }
    }

  }

  .ant-drawer-footer {
    .textarea-drawer-footer {
      width: 100%;
      text-align: right;

      .ant-btn {
        border-radius: 5px;
      }
    }
  }
}

.summary-modal-wrap {
  z-index: 1111;
}

.summary-modal {
  .ant-modal-content {
    border-radius: 12px;

    .ant-modal-header {
      font-size: 18px;
      color: #000;
      font-weight: 500;
      border-radius: 12px 12px 0 0;
      border-color: var(--saas-Border-Dividers);
    }

    .ant-modal-body {
      padding: 16px 24px;

      .summary-row-box {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        margin-top: 10px;
        font-size: 14px;
        text-align: left;

        &:nth-child(1) {
          margin-top: 0;
        }

        .field-name {
          width: 114px;
          font-size: 14px;
          color: var(--saas-Placeholder-Text);
          padding-right: 4px;
        }

        .field-value {
          flex: 1;
          color: var(--saas-Title-Text);
          font-weight: 500;
        }
      }
    }
    .ant-modal-footer {
      border-color: var(--saas-Border-Dividers);
      background: var(--saas-Background-Header);
    }
  }
}

.summary-modal.tableRotate {
  top: 50%;
  transform: translateY(-50%);

  .ant-modal-content {
    .ant-modal-body {
      max-height: 50vw;
      overflow: auto;
    }
  }
}

@include media-breakpoint-down(sm) {
  .columns-toggler-drawer {
    .ant-drawer-header {
      padding: 16px;
      border-bottom-color: var(--saas-Border-Dividers);

      &-title {
        .ant-drawer-close {
          position: absolute;
          right: 16px;
          background: var(--them-bg-color);
          width: 24px;
          height: 24px;
          border-radius: 100%;
          margin-right: 0;
          padding: 4px;
        }

        .ant-drawer-title {
          width: 100%;
          text-align: center;
          font-size: 18px;
          color: #000;
          font-weight: 500;
        }
      }
    }

    .ant-drawer-content {
      border-radius: 18px 18px 0 0;
    }

    .ant-drawer-body {
      padding: 0;

      .tpm-sel-confirm-container {
        background-color: var(--saas-Background-Header);

        .ant-btn {
          height: 60px;
          background-color: var(--saas-main-bg);

          &:nth-child(1) {
            color: #f5222d;
          }

          &:last-child {
            margin-top: 6px;
            color: var(--saas-Title-Text);
          }
        }

      }
    }
  }

  .columns-toggler-drawer-isMobile {
    .ant-drawer-content {
      .ant-drawer-wrapper-body {
        .ant-drawer-body {
          padding: 0;

          .#{$ns}Button {
            width: 100%;
            height: 60px;
            background-color: #fff;
            font-size: 16px;
            color: rgba(0, 0, 0, 0.9);
            border: none
          }

          .#{$ns}Button:nth-child(1) {
            color: #f5222d;
          }

          .#{$ns}Button:nth-child(2) {
            margin-top: 4px;
            border-top: 4px solid #f7f8fa;
          }
        }
      }
    }
  }

  .columns-toggler-drawer.field-table-drawer {
    .ant-drawer-content-wrapper {
      max-height: calc(100vh - 32px);

      .ant-drawer-wrapper-body {
        max-height: calc(100vh - 32px);

        .ant-drawer-header {
          &-title {
            .ant-drawer-title {
              text-align: left;
            }
          }
        }

        .ant-drawer-footer {
          text-align: right;

          .ant-btn {
            margin-left: 8px;
          }
        }
      }
    }

    .form-content-container {
      flex: 1;
      overflow-y: auto;
    }
  }

  .columns-toggler-drawer.ios-device {
    .ant-drawer-wrapper-body {
      padding-bottom: 32px;
    }
  }

  .tmp-setting-modal {
    .ant-modal-header {
      border-radius: 8px;
      border: none;
    }

    .ant-modal-content {
      border-radius: 8px;
      background-color: var(--saas-main-bg);
    }

    .ant-modal-body {
      padding: 12px 16px;
      padding-bottom: 0;
      background-color: var(--saas-main-bg) !important;
      .ant-form-item-required {
        color: var(--saas-Title-Text);
      }
    }
    .ant-modal-footer {
      background-color: var(--saas-main-bg);
      border-color: var(--saas-Border-Dividers);
    }
  }

  .columns-toggler-drawer.columns-toggler-tmp-sel {
    .ant-drawer-title {
      text-align: left;
    }

    .ant-drawer-body {
      padding: 0 16px;

      .tpm-sel-container {
        background-color: var(--saas-Border-Dividers);
      }

      .tem-sel-item {
        padding: 12px 8px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1px;
        background-color: var(--saas-main-bg);

        &:last-child {
          margin: 0;
        }

        &.active-tmp {
          color: var(--them-btn-color);
        }
      }
    }

    .ant-drawer-footer {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      padding: 14px 16px;

      .#{$ns}Button {
        margin-left: 8px;
      }
    }
  }

  .table-toolbar-pop {
    width: 100%;
    padding-top: 0;

    .ant-popover-content {
      &::after {
        content: '';
        height: 1px;
        display: block;
        background-color: var(--saas-main-bg);
        width: 100%;
        box-shadow: inset 0 0px 8px 10px rgba(0, 0, 0, 0.09);
      }
    }

    .ant-popover-inner {
      padding: 0 16px;
      border-radius: 0 0 16px 16px;
      box-shadow: none;
      background-color: var(--saas-main-bg);

      .ant-popover-inner-content {
        width: 100%;
        border-top: 1px solid #d8d8d8;
        padding: 0;

        .toolbar-container {
          background-color: var(--saas-main-bg);
          width: 100%;
          font-size: 12px;
          padding-bottom: 24px;

          .toolbar-item {
            display: inline-block;
            text-align: center;
            margin-top: 24px;
            width: 25%;

            &-icon {
              color: var(--saas-Title-Text);

              * {
                font-size: 20px;
              }
            }

            &-name {
              margin-top: 8px;
              color: var(--saas-Title-Text);
              text-align: center;
            }
          }
        }
      }
    }
  }
}