@import '../../var/index.less';
@import './icon.less';
// @import "./default.less";

.ta {
  // defauult layout
  &-default-layout {
    &-main {
      margin-left: 0;
    }
  }

  // header
  &-layout-header {
    box-shadow: 0 3px 20px rgb(0 0 0 / 7%);

    &-trigger {
      // display: none !important;
    }

    &-logo {
      width: auto !important;
      border-bottom: none !important;

      img {
        width: 120px !important;
        // margin-right: @gapy !important;
        object-fit: contain;
        margin-right: 0 !important;
      }
    }

    .ta-layout-breadcrumb {
      display: none !important;
    }

    &-action {
      .search-item,
      .fullscreen-item {
        display: none !important;
      }
    }
  }

  // tab
  &-layout-multiple-header {
    .ta-multiple-tabs {
      height: 40px;
      line-height: 40px;
      padding: 8px 4px 0;
      background-color: @content-bg;
      border-bottom: 1px solid #d6defd !important;
      box-shadow: 0 0 10px rgb(0 0 0 / 7%);

      .ant-tabs.ant-tabs-card .ant-tabs-nav {
        background-color: @content-bg;

        .ant-tabs-tab {
          // color: inherit !important;
          background-color: transparent !important;
          border: none !important;

          &.ant-tabs-tab-active {
            color: @primary-color !important;
            font-weight: 700 !important;
          }

          .ant-tabs-close-x {
            display: flex;
            align-items: center;
            justify-content: center;
            position: absolute;
            top: 0;
            right: 1px;
            background: #d8e0ff;
            border-radius: 50%;
            padding: 2px;
            width: 14px !important;
            height: 14px !important;

            svg {
              fill: #000;
            }
          }
        }

        .ant-tabs-ink-bar {
          visibility: visible !important;
          // left: 8px !important;
        }
      }

      .ant-tabs-extra-content {
        display: none !important;
      }

      &-content__info {
        font-size: 14px !important;
        line-height: 28px !important;
      }
    }
  }

  // side bar
  &-layout-sideBar {
    padding: 10px 0;
    border-right: 1px solid #eaeaea;
    box-shadow: 0 3px 20px rgb(0 0 0 / 7%);

    &:not(.ant-layout-sider-collapsed) {
      .ta-menu {
        .ta-menu-submenu-title,
        .ta-menu-item[collapse='false'] {
          margin: 0 20px;
        }
      }

      &-item:not(.ta-menu-item[collapse='false']) {
        padding: 9px 24px !important;
        margin: 0 20px !important;
      }
    }

    .ta-menu {
      color: @secondary-text-color;

      // .ta-menu-submenu-title,
      // .ta-menu-item[collapse="false"] {
      //   margin: 0 20px;
      // }

      &-opened {
        .ta-menu-submenu-title + .ta-menu {
          background-color: @content-bg;
        }
      }

      .ta-menu-item-active:not(.ta-menu-submenu) {
        background: @primary-color !important;
        box-shadow: 0 4px 10px rgb(41 77 242 / 30%);
        border-radius: @primary-border-radius;
        color: #fff !important;

        &::after {
          background-color: transparent !important;
        }
      }

      // &-item:not(.ta-menu-item[collapse="false"]) {
      //   padding: 9px 24px !important;
      //   margin: 0 20px !important;
      // }

      &-submenu-title-icon {
        right: 20px !important;
      }
    }

    &.ant-layout-sider-has-trigger {
      padding-bottom: 10px !important;

      .ant-layout-sider-trigger {
        position: absolute;
        top: 50%;
        left: 100%;
        width: 20px !important;
        bottom: auto;

        &::before {
          content: '';
          position: absolute;
          top: -20px;
          left: 0;
          width: 0;
          height: 0;
          border-style: solid;
          border-width: 20px 0 0 20px;
          border-color: transparent transparent transparent #fff;
        }

        &::after {
          content: '';
          position: absolute;
          bottom: -20px;
          left: 0;
          width: 0;
          height: 0;
          border-style: solid;
          border-width: 20px 20px 0 0;
          border-color: #fff transparent transparent;
        }
      }
    }

    &--fixed {
      .ta-app-logo {
        margin-top: -10px;
        padding-bottom: 10px;
      }

      .ta-layout-menu-logo {
        img {
          width: auto;
          object-fit: contain;
        }
      }
    }
  }

  //page wrapper
  &-page-wrapper {
    padding: @gapy @gapx @gapx;

    .ant-page-header {
      padding: 0;

      &-content {
        padding-top: 0;
      }
    }

    .ta-page-wrapper-content {
      margin: 0 !important;
      // padding-top: @gapy;
    }

    &.full {
      display: flex;
      flex-direction: column;
      position: relative;
      height: 100%;

      .ta-page-wrapper-content {
        flex: 1;
      }
    }
  }

  //button
  &-basic-button {
    padding: 0 12px;
    &:not(.ant-btn-link, .ant-btn-text) {
      min-width: 100px;
    }
  }

  //table
  &-basic-table {
    position: relative;
    top: 0;
    bottom: 0;
    left: 0;
    max-width: 100%;
    height: 100%;

    .can-operational-font-size-12 {
      font-size: 12px;
    }

    &--full-height {
      // tablecontent 撑满，可能会导致横向滚动条消失! start
      display: flex;
      flex-direction: column;

      .ant-table-wrapper,
      .ant-spin-container,
      .ant-table,
      .ant-table-content,
      .ant-table-scroll {
        flex: 1;
        display: flex;
        flex-direction: column;
      }

      .ant-table-body {
        // flex: 1 1 0%;
      }

      .ant-spin-nested-loading > div > .ant-spin {
        max-height: fit-content;
      }
    }

    .ant-spin-container {
      height: 100%;
    }

    .ant-spin-nested-loading {
      flex: 1;
    }

    &-operations {
      position: relative;
      // margin-top: @gapy;

      .ta-basic-table-filter,
      .ta-basic-table-custom-action {
        margin-bottom: @gapy;
      }

      &-mask {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: @content-bg;
        opacity: 50%;
      }
    }

    .ta-button {
      & + .ta-button {
        margin-left: @gapy;
      }
    }

    .ant-table-placeholder {
      border: none !important;
    }

    .ant-table {
      background: transparent;
    }

    .ant-table-wrapper {
      padding: @gapy @gapy 12px !important;
      border-radius: @primary-border-radius !important;
    }

    .ant-table-title {
      padding: 0 !important;
      margin-bottom: @gapy;
    }

    .ant-table-thead {
      th {
        position: relative;
        border-bottom: none;

        &.ant-table-column-has-actions.ant-table-column-has-filters {
          padding-right: 0 !important;
        }

        .anticon-filter,
        .ant-table-filter-icon {
          top: 45%;
          right: 4px;
          transform: translateY(-50%);
          height: auto;
        }

        // &.ant-table-column-has-actions.ant-table-column-has-sorters {
        //   cursor: auto !important;
        // }

        // & .ant-table-header-column .ant-table-column-sorters:hover::before {
        //   background: transparent !important;
        // }

        .ant-table-column-sorter {
          position: absolute;
          top: 45%;
          right: 10px;
          transform: translateY(-50%);
        }
      }

      tr th:last-child {
        &::after {
          height: 0 !important;
        }
      }
    }

    .ant-table-content {
      border-top-left-radius: @primary-border-radius !important;
      border-top-right-radius: @primary-border-radius !important;
      background-color: #fff;
    }

    .ant-table-tbody {
      .ant-btn-link {
        min-width: auto !important;
        padding: 0 !important;

        & + .ant-btn-link {
          margin-left: 10px;
        }
      }
    }

    .ant-table-tbody > tr > td {
      border-bottom: 1px solid #eaeaea !important;
      height: 42px;
    }

    .ant-table-pagination {
      display: inline-block;
      position: relative;
      width: 100%;
      text-align: right;
      margin-top: 0 !important;
      // padding: (@gapy / 2) @gapy !important;
      padding: 8px 0 0 !important;

      border-bottom-left-radius: @primary-border-radius !important;
      border-bottom-right-radius: @primary-border-radius !important;
      font-size: 12px;
      color: #555;
      line-height: 16px;
      zoom: 1;
      background-color: #fff;
      margin-bottom: 0 !important;

      &::after {
        content: ' ';
        display: block;
        font-size: 0;
        height: 0;
        clear: both;
        visibility: hidden;
      }

      .ant-pagination-total-text,
      .ant-pagination-options {
        float: left;
      }

      .ant-select-selector,
      .ant-pagination-item {
        border-radius: @primary-border-radius;
      }

      .ant-pagination-disabled {
        opacity: 25%;
      }

      .ant-pagination-item {
        margin-right: 6px !important;

        a {
          padding: 0 10px;
          border: 1px solid @primary-color;
          color: @primary-color;
          border-radius: @primary-border-radius;
          background-color: #fff;
        }

        &-active {
          a {
            color: #fff;
            background-color: @primary-color;
          }
        }
      }

      .ant-select-selection-item,
      .ant-select-dropdown [role='option'],
      .ant-select-item-option-content {
        text-align: left;
        font-size: 12px;
        color: #555;
        line-height: 16px;
      }

      .ant-pagination-prev,
      .ant-pagination-next {
        min-width: 70px !important;
        color: @primary-color;
        border: 1px solid @primary-color;
        border-radius: @primary-border-radius;
        background-color: #fff !important;
      }

      .ant-pagination-prev {
        margin-right: 6px !important;
      }
    }

    .ant-table .ant-table-thead > tr > th {
      height: 42px;
      padding: 8px !important;
      font-size: 14px !important;
      font-weight: bold !important;
    }

    .ant-table-footer {
      background-color: #fff;
      border-top: 1px solid #eaeaea;
      border-bottom: 1px solid #eaeaea;
    }
  }

  // form
  &-basic-form {
    // .ant-form-item {
    //   margin-bottom: @gapy !important;
    // }

    &-vertical {
      .ant-form-item {
        margin-bottom: 16px;
      }
    }

    .ant-form-item {
      &-explain,
      &-extra {
        text-align: right;
      }
    }

    &--editable {
      // common
      border-top: 1px solid #eaeaea;
      border-left: 1px solid #eaeaea;

      > .ant-row {
        margin-left: 0 !important;
        margin-right: 0 !important;

        > .ant-col {
          padding-left: 0 !important;
          padding-right: 0 !important;
        }

        > .ant-col-12 {
          // &:nth-child(2n-1) {
          //   padding-right: 0 !important;
          // }
          // &:nth-child(2n) {
          //   padding-left: 0 !important;
          // }
        }
      }

      .ant-form-item-label,
      .ant-form-item-control {
        border-bottom: 1px solid #eaeaea;
        border-right: 1px solid #eaeaea;
        justify-content: center;
      }

      // rewrite
      .ant-form-item {
        height: 100%;
        margin-bottom: 0 !important;
        position: relative;
      }

      .ant-form-item-label {
        background-color: #f8f8fb;

        label {
          color: #555;
          font-size: 14px;
          line-height: 18px;
          min-height: 36px;
          white-space: normal;
          padding: 5px;
          height: auto;
        }
      }

      .ant-form-item-control {
        &-input {
          position: relative;
          min-height: 36px;
          // padding: 2px 40px 2px 15px;
          padding: 2px 12px;
        }
      }

      .ant-form-item-explain {
        padding: 0 15px;

        &.ant-show-help-leave,
        &.ant-show-help-leave-active {
          animation: none;
          color: #ed6f6f;
        }

        // position: absolute;
        // top: 50%;
        // transform: translateY(-50%);
        // right: 30px;
        // // top: 100%;
        // // // left: 15px;
        // // right: 0px;
        // padding: 2px 0;
        // background: #fff;
        // z-index: 2;
        font-size: 12px;
      }

      .ta-form-item {
        position: relative;

        &__cell {
          white-space: normal;
          word-break: break-all;
          overflow: hidden;
          min-height: 32px;
          padding: 5px 8px 5px 0;
          line-height: 22px;

          // position: absolute;
          // top: 0;
          // left: 0;
          // width: 100%;
          // height: 100%;
          // z-index: 1;
          &.number-cell {
            text-align: right;
            padding-right: 27px;
          }
          &.disabled {
            cursor: not-allowed;
            color: rgba(0, 0, 0, 0.6);
          }
        }

        .ta-form-item--editable-icon {
          display: none;
          position: absolute;
          right: 0;
          top: 10px;
          color: @primary-color;
        }

        &--editable {
          cursor: pointer;

          .ant-picker-container {
            // 临时注释掉 ，在表单最下面时候时间选择组件会显示不全 by hyb
            // top: 0 !important;
            // left: 0 !important;
            // min-width: 100% !important;
            .ant-calendar {
              min-width: 100% !important;
            }
          }

          &:hover {
            background-color: rgb(248 248 251 / 60%);

            .ant-form-item-control-input {
              background-color: rgb(248 248 251 / 60%);
            }

            .ta-form-item--editable-icon {
              display: inline-block;
            }
          }
        }

        &--diseditable {
          cursor: not-allowed;

          &:hover {
            .ta-form-item--editable-icon {
              display: inline-block;
              color: #555;
            }
          }
        }
      }
    }

    .ant-input-number,
    .ant-picker {
      width: 100% !important;
    }

    .ant-input-number {
      &-input {
        text-align: right;
        padding-right: 26px;

        &::-webkit-input-placeholder {
          text-align: left;
        }
      }
    }

    .ant-select-multiple {
      .ant-select-selection-item {
        background: #e6edff63;
        border: 1px solid #3c6cfe;

        .ant-select-selection-item-content {
          color: #3351c7;
        }
      }

      .ant-select-selection-item-remove {
        .anticon {
          background: #d6defd;
          border-radius: 50%;

          svg {
            margin: 2px;
            color: #0a1840;
          }
        }
      }
    }
  }

  // modal
  &-basic-modal {
    // .ant-modal {
    //   top: 20px !important;
    // }

    // .ant-btn {
    //   min-width: 80px;
    //   height: 30px !important;
    //   line-height: 1 !important;
    // }

    .ant-modal-content {
      border-radius: @primary-border-radius;
    }

    .ant-modal-header {
      padding: 10px 24px;
      border-radius: @primary-border-radius @primary-border-radius 0 0;
    }

    .ant-modal-title {
      font-size: 16px;
      line-height: 20px;
      font-weight: 700;
      color: #0d1b42;

      .ta-basic-title {
        color: #0d1b42;
      }
    }

    .ant-modal-close-x {
      height: 45px;
      line-height: 45px;
    }

    .ant-modal-close {
      right: 4px;

      .ant-modal-close-x {
        width: 46px;
        height: 46px;
        line-height: 46px;
      }
    }

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

      .ant-form-item-label label {
        color: #555;
      }

      .scroll-container .scrollbar__wrap {
        margin-bottom: 0 !important;
      }
    }

    .ant-modal-footer {
      padding: 10px 24px;
    }
  }
}

// button tabs
.button-tabs {
  &.ant-tabs {
    .ant-tabs-bar {
      border: none;
    }

    .ant-tabs-ink-bar {
      display: none !important;
    }

    .ant-tabs-tab {
      padding: 1px 0;
      z-index: 1;
    }
  }

  &--loose {
    .ant-tabs-tab {
      .ant-btn {
        color: rgb(0 0 0 / 25%);
        background: #f5f5f5;
        border-color: #eaeaea;
      }

      &-active {
        z-index: 2;

        .ant-btn {
          color: #fff;
          background: #276dff;
          border-color: #276dff;
        }
      }
    }
  }

  &--tight {
    &.ant-tabs {
      .ant-tabs-tab {
        margin-right: -4px !important;

        &-active {
          z-index: 2;

          .ant-btn {
            color: #fff;
            background: #276dff;
            border-color: #276dff;
          }
        }
      }
    }
  }
}

// ==========================================================================================
//     ta-badge
// ==========================================================================================
.ta-badge {
  display: inline-block;
  min-width: 50px;
  min-height: 20px;
  border-radius: 20px 20px 20px 0;
  color: #fff;
  font-size: 12px;
  text-align: center;
  padding-top: 1px;

  &--prepare {
    background-color: #3351c7;
  }

  &--wait {
    background-color: #ffac3e;
  }

  &--ok {
    background-color: #2cc8b2;
  }

  &--fail {
    background-color: #ff7171;
  }
}

// back to top
.ant-back-top {
  right: 20px !important;
  bottom: 60px !important;
}

// 修复表格跳动fixed
.ant-table-fixed-header .ant-table-scroll .ant-table-header {
  margin-bottom: 0px !important;
}

// 顶部 button group
.ta-page {
  &-tabs {
    padding: 16px 24px 0;

    .ta-button-group {
      margin-bottom: 0;
    }

    & + .ta-page-wrapper {
      padding-top: 0;
      padding-bottom: 0;

      .ta-page-wrapper-content {
        padding-top: 16px;
      }
    }
  }
}
