@import '../../style/themes/default.less';

@component-prefix-cls: ~'@{qn-prefix}-pro-table';

.@{component-prefix-cls} {
  height: 100%;
  overflow-y: auto;
  background: #fff;
  border-radius: 4px 4px 0 0;
  box-shadow: 0 0 8px 0 #f0f0f0;

  .@{qn-prefix}-guide-link {
    padding: 0 12px;
  }

  .ant-page-header {
    height: 48px;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #ebebeb;

    .ant-page-header-heading {
      align-items: center;
      height: 24px;
      line-height: 24px;
    }

    .ant-page-header-heading-extra {
      .ant-space {
        gap: 0 !important;

        .ant-space-item:not(:last-child) {
          margin-right: 20px;
        }
      }
    }

    .ant-page-header-heading-left {
      margin: 0;

      .ant-page-header-heading-title {
        font-size: 16px;
        line-height: 40px;
      }
    }
  }

  .ant-pro-page-container-children-content {
    margin: 0;
  }

  .ant-pro-card-body,
  .ant-card-body {
    padding: 0;
  }

  .ant-table-wrapper {
    padding-top: 60px;
  }

  .ant-table.ant-table-middle .ant-pro-table {
    margin: 0 18px;
  }

  .ant-table.ant-table-middle {
    .ant-table-container {
      padding-right: 16px;
      padding-left: 16px;
    }

    .ant-table-cell {
      line-height: 20px;
    }

    .ant-table-thead {
      height: 36px;

      th {
        padding-top: 6px;
        padding-bottom: 6px;
        color: #646566;
        font-weight: 400;
        font-size: 13px;
        background-color: #f7f7f7;
        border-bottom-width: 0;

        &::before {
          display: none;
        }
      }

      .ant-table-column-sorters,
      .ant-table-filter-column-title {
        padding-top: 0;
        padding-bottom: 0;
      }

      .ant-table-filter-column {
        display: inline-block;
        width: 100%;
      }
    }

    .ant-table-tbody td {
      color: #333;
      font-size: 13px;

      a {
        font-size: 13px;
      }
    }

    th:first-child {
      padding-left: 12px;
    }

    th:last-child {
      padding-right: 12px;
    }

    td:first-child {
      padding-left: 12px;
    }

    td:last-child {
      padding-right: 12px;
    }

    .ant-table-expanded-row {
      overflow: hidden;

      .ant-table-wrapper {
        padding-top: 0;
      }

      .ant-table-container::before {
        box-shadow: none;
      }

      .ant-table-tbody > tr:last-child > td {
        border-bottom: none;
      }

      .ant-table-cell-fix-right-first::after,
      .ant-table-cell-fix-right-last::after {
        content: none;
      }

      .ant-table-expanded-row-fixed {
        .ant-pro-card,
        .ant-card {
          padding-top: 0;
        }

        width: calc(100vw - 96px);
        padding: 12px 6px;

        .ant-table-container {
          background: #fafafa;
        }

        .ant-table-tbody td {
          background: #fafafa;
        }
      }

      .ant-table-container {
        padding-right: 16px;
        padding-left: 16px;
      }

      > .ant-table-cell {
        padding: 10px 0;
        background-color: #fff;

        .ant-table-expanded-row-fixed {
          margin: 0 0;
          padding: 0;
        }
      }
    }

    .ant-table-expanded-row .ant-table {
      padding-bottom: 0;
    }

    .ant-table-selection-column {
      padding-left: 12px;
      text-align: left;
    }

    .ant-table-row-expand-icon-cell {
      width: 1px;
    }

    .ant-table-thead > tr > th,
    .ant-table-tbody > tr > td,
    tfoot > tr > td {
      white-space: nowrap;
    }

    .ant-table-container table > thead > tr th.ant-table-row-expand-icon-cell,
    .ant-table-container table > tbody > tr td.ant-table-row-expand-icon-cell {
      left: -1px;
      padding: 0;
    }

    .ant-table-tbody > tr > td:last-child,
    .ant-table-container table > thead > tr:first-child th:last-child {
      text-align: right;
    }
  }

  .@{qn-prefix}-pro-search {
    position: absolute;
    z-index: 900;
    width: calc(100% - 32px);
  }

  .ant-pagination {
    margin: 0;
    padding: 8px 16px;
    background-color: #fff;
    border-top: 1px solid #eaeaea;

    .ant-pagination-options {
      order: 4;
      padding-left: 8px;

      .ant-select-selector {
        padding: 0;
        border: 0 none;
        box-shadow: none;

        &:hover {
          border: 0 none;
        }
      }

      .ant-select-arrow {
        position: absolute;
        right: 0;
      }
    }

    .ant-pagination-total-text {
      order: 5;
    }
  }

  .ant-skeleton {
    padding: 60px 16px 0;
  }

  &-head {
    display: flex;
    align-items: center;
    font-weight: 500;
    font-size: 16px;

    &-title {
      margin-right: 2px;
      color: #323233;
    }

    &-total {
      color: #999;
    }
  }

  &-extra-action {
    &:not(:last-child) {
      margin-right: 14px;
    }
  }

  &-extra-action-text {
    padding-right: 4px;
    color: var(--primary-color, #ff6a00);
    font-size: 14px;
    line-height: 24px;
  }

  &-extra-action-icon {
    color: var(--primary-color, #ff6a00) !important;
    font-size: 14px;
  }

  &-content {
    position: relative;
    height: 100%;
  }
}

.@{component-prefix-cls}.@{component-prefix-cls}-hide-search {
  .ant-table-wrapper {
    padding-top: 16px;
  }
}
