@import '../variables.less';
@import './base';

/* antd 默认样式重置 */

.@{ant-prefix}-modal-mask-blur {
  backdrop-filter: none !important;
}

// 表单
.@{ant-prefix}-form,
.@{ant-prefix}-drawer,
.@{ant-prefix}-modal {
  .@{ant-prefix}-input-textarea-show-count.@{ant-prefix}-input-textarea-in-form-item {
    &::after {
      background: transparent;
    }
  }
  .@{ant-prefix}-drawer-body {
    .@{ant-prefix}-form-item {
      .@{ant-prefix}-form-item-label {
        &.@{ant-prefix}-form-item-label-left {
          & > .@{ant-prefix}-form-item-required::before {
            position: absolute;
            top: calc(50% - 7px);
            left: -8px;
            margin: 0;
            right: inherit;
          }
        }
      }
    }
  }

  .@{ant-prefix}-form-item {
    &.@{ant-prefix}-form-item-with-help {
      transition: none;
    }

    // label 超过130px换行
    .@{ant-prefix}-form-item-label {
      flex: 0 0 @zaui-form-label-width;
      padding-right: 16px;
      overflow: initial;
      line-height: 1;
      white-space: pre-wrap;
      .@{ant-prefix}-form-item-required {
        position: relative;
        &::before {
          position: absolute;
          top: calc(50% - 7px);
          left: -8px;
          margin: 0;
        }
      }

      & > label {
        word-break: break-all;

        // 隐藏冒号
        &::after {
          display: none;
        }
      }

      &.@{ant-prefix}-form-item-label-left {
        & > .@{ant-prefix}-form-item-required::before {
          right: -10px;
          left: unset;
        }
      }
    }

    .@{ant-prefix}-form-item-explain-error {
      .set-text-size();
    }
  }

  // 字体颜色
  .@{ant-prefix}-form-item-label > label,
  .@{ant-prefix}-picker-input > input,
  .@{ant-prefix}-input,
  .@{ant-prefix}-input-number,
  .@{ant-prefix}-select,
  .@{ant-prefix}-select-dropdown {
    .set-text-color();
    .set-text-size();
  }

  .@{ant-prefix}-form-item {
    margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1));
  }
}

.@{ant-prefix}-input[disabled],
.@{ant-prefix}-select-disabled,
.@{ant-prefix}-select-disabled.@{ant-prefix}-select:not(.@{ant-prefix}-select-customize-input)
  .@{ant-prefix}-select-selector,
.@{ant-prefix}-input-number-disabled,
.@{ant-prefix}-picker-input > input[disabled],
.@{ant-prefix}-select-disabled.@{ant-prefix}-select-multiple .@{ant-prefix}-select-selection-item {
  .set-disabled-color();
}

// ant-table
.@{ant-prefix}-table {
  .@{ant-prefix}-table-row.@{ant-prefix}-table-row-selected > .@{ant-prefix}-table-cell-row-hover {
    background-color: #e6f4ff !important;
  }
  .@{ant-prefix}-empty-normal {
    margin: calc(var(--zaui-space-size-lg; 32px) * var(--zaui-size; 1)) 0;
  }
  .@{ant-prefix}-table-tbody {
    .@{ant-prefix}-table-cell-fix-left-last:after {
      width: 8px;
    }
  }
  &.pro-table-no-stripe {
    .@{ant-prefix}-table-tbody {
      .@{ant-prefix}-table-row {
        background: #fff !important;
      }
    }
  }

  // 空态图白色
  .@{ant-prefix}-table-placeholder {
    td {
      background: #ffffff !important;
    }
  }

  .set-text-size();
  color: @zaui-text;

  .@{ant-prefix}-table-thead {
    .@{ant-prefix}-table-cell {
      &::before {
        display: none;
      }
    }
  }

  .@{ant-prefix}-table-thead > tr > th {
    background: @zaui-table-header-bg;
    border-bottom: none;

    .@{ant-prefix}-dropdown-trigger {
      .anticon-down {
        width: 0;
        height: 0;
        margin: 0 0 1px 4px;
        border-top: 6px solid #909090;
        border-right: 5px solid transparent;
        border-left: 5px solid transparent;
        transition: transform 0.8s;

        svg {
          display: none;
        }
      }
    }
  }

  .@{ant-prefix}-table-tbody {
    .@{ant-prefix}-table-row:nth-child(even) {
      background-color: @zaui-table-strip-bg;
    }

    tr.@{ant-prefix}-table-row:hover td {
      background-color: @zaui-table-hover-bg;
    }

    & > tr > td {
      border-bottom: none;
    }

    tr.@{ant-prefix}-table-row-selected {
      &:hover > td {
        background: @zaui-table-selected-hover-bg;
      }

      td {
        background: @zaui-table-selected-bg;
      }
    }
  }

  .@{ant-prefix}-table-thead > tr > th,
  .@{ant-prefix}-table-footer {
    .set-text-color();
    .set-text-size();
  }

  .@{ant-prefix}-table-tbody > tr > td {
    .set-text-size();

    .@{ant-prefix}-btn {
      .set-text-size();
    }
  }

  // 表格空显示-
  .@{ant-prefix}-table-content {
    .@{ant-prefix}-table-tbody {
      .@{ant-prefix}-table-cell:empty:before {
        content: '-';
      }
    }

    .@{ant-prefix}-table-cell-fix-right {
      &.@{ant-prefix}-table-cell:empty:before {
        content: none;
      }
    }
  }

  &.@{ant-prefix}-table-scroll-horizontal {
    table .@{ant-prefix}-table-tbody .@{ant-prefix}-table-row:nth-child(even) td {
      background: @zaui-table-strip-bg;
    }
  }

  & table {
    .@{ant-prefix}-table-thead > tr > th,
    .@{ant-prefix}-table-tbody > tr > td,
    .@{ant-prefix}-table tfoot > tr > th,
    .@{ant-prefix}-table tfoot > tr > td {
      padding: calc(4px + var(--zaui-size) * 8px);
    }
    .@{ant-prefix}-table-tbody
      > tr
      > td
      > .@{ant-prefix}-table-wrapper:only-child
      .@{ant-prefix}-table,
    .@{ant-prefix}-table-tbody
      > tr
      > td
      > .@{ant-prefix}-table-expanded-row-fixed
      > .@{ant-prefix}-table-wrapper:only-child
      .@{ant-prefix}-table {
      margin-top: calc(var(--zaui-size) * -16px);
      margin-bottom: calc(var(--zaui-size) * -16px);
    }
  }

  &.@{ant-prefix}-table-scroll-horizontal table {
    .@{ant-prefix}-table-thead > tr > th,
    .@{ant-prefix}-table-tbody > tr > td,
    .@{ant-prefix}-table tfoot > tr > th,
    .@{ant-prefix}-table tfoot > tr > td {
      padding: calc(4px + var(--zaui-size) * 8px);
    }

    // 偶数行背景色设置
    .@{ant-prefix}-table-tbody {
      .@{ant-prefix}-table-row:nth-child(even) {
        background-color: @zaui-table-strip-bg;

        & td.@{ant-prefix}-table-cell-fix-right,
        & td.@{ant-prefix}-table-cell-fix-left {
          background-color: @zaui-table-strip-bg;
        }
      }

      .@{ant-prefix}-table-row:hover > td {
        background-color: @zaui-table-strip-bg;
      }

      tr.@{ant-prefix}-table-row-selected {
        &:hover > td {
          background: @zaui-table-selected-bg !important;
        }

        td {
          background: @zaui-table-selected-bg !important;
        }
      }

      tr td {
        border-bottom: none;
      }
    }
  }

  // 开启scroll时，会新增一行tr影响偶数行底色
  &.@{ant-prefix}-table-scroll-horizontal {
    table {
      .@{ant-prefix}-table-tbody {
        .@{ant-prefix}-table-row:nth-child(even) {
          &:hover td,
          &:hover td.@{ant-prefix}-table-cell-fix-right,
          &:hover td.@{ant-prefix}-table-cell-fix-left {
            background-color: @zaui-table-hover-bg !important;
          }

          & td,
          & td.@{ant-prefix}-table-cell-fix-right,
          & td.@{ant-prefix}-table-cell-fix-left {
            background-color: #fff !important;
          }

          & td {
            background-color: #fff;
          }
        }

        .@{ant-prefix}-table-row:nth-child(odd) {
          background-color: @zaui-table-strip-bg;

          & td {
            background-color: @zaui-table-strip-bg !important;
          }
        }
      }
    }
  }

  .@{ant-prefix}-table-cell {
    .@{ant-prefix}-btn-link {
      height: auto;
      padding: 0;
      user-select: text;
    }

    a {
      color: var(--zaui-brand, #006aff);
      user-select: text;
    }
  }

  &.@{ant-prefix}-table-fixed-header {
    .@{ant-prefix}-table-tbody {
      .@{ant-prefix}-table-row:nth-child(even) {
        td {
          background: #ffffff;
        }
      }

      &.@{ant-prefix}-table-tbody-virtual {
        .@{ant-prefix}-table-row:nth-child(odd),
        .@{ant-prefix}-table-row:nth-child(even) {
          background-color: transparent !important;
        }
      }

      .@{ant-prefix}-table-row:nth-child(odd) {
        background-color: @zaui-table-strip-bg;

        td {
          background: @zaui-table-strip-bg;
        }
      }
    }
  }
}

// ant-tabs
.@{ant-prefix}-tabs {
  overflow: inherit !important;
  .set-text-color();

  .@{ant-prefix}-tabs-nav-list {
    &.@{ant-prefix}-tabs-card {
      .@{ant-prefix}-tabs-tab {
        margin-right: 10px;
        padding: 8px var(--zaui-space-size-md, 16px);
      }
    }

    .@{ant-prefix}-tabs-tab {
      .set-text-size();
      margin-left: 0;
      padding: 12px var(--zaui-space-size-md, 16px);
    }
  }

  .@{ant-prefix}-tabs-nav {
    margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1));
  }

  .@{ant-prefix}-tabs-nav .@{ant-prefix}-tabs-tab-btn {
    font-size: var(--zaui-font-size-lg, 16px);
  }

  &.@{ant-prefix}-tabs-card {
    .@{ant-prefix}-tabs-tab {
      margin-right: 10px !important;
      padding: 8px calc(var(--zaui-space-size-md, 16px) * var(--zaui-size, 1)) !important;
    }

    .@{ant-prefix}-tabs-nav .@{ant-prefix}-tabs-tab-btn {
      font-size: var(--zaui-font-size, 14px);
    }
  }
}

// 按钮
.@{ant-prefix}-btn {
  &.@{ant-prefix}-btn-dangerous {
    color: @zaui-danger;
  }
  .set-text-color();
  font-size: @zaui-font-size;

  .@{ant-prefix}-btn-primary {
    color: #fff;
    background: @zaui-brand;
    border-color: @zaui-brand;
  }

  &.@{ant-prefix}-btn-primary[disabled],
  &.@{ant-prefix}-btn-primary[disabled]:hover,
  &.@{ant-prefix}-btn-primary[disabled]:focus,
  &.@{ant-prefix}-btn-primary[disabled]:active {
    color: #fff;
    text-shadow: none;
    background: @zaui-brand;
    border-color: @zaui-brand;
    box-shadow: none;
    opacity: 0.6;
  }

  &.@{ant-prefix}-btn-link[disabled],
  &.@{ant-prefix}-btn-link[disabled]:hover,
  &.@{ant-prefix}-btn-link[disabled]:focus,
  &.@{ant-prefix}-btn-link[disabled]:active {
    color: @zat-disabled-color !important;
    text-shadow: none;
    background: none;
    border-color: none;
    box-shadow: none;
    opacity: 0.6;
  }

  &.@{ant-prefix}-btn-link {
    .set-brand-color() !important;
    background: none !important;
    box-shadow: none !important;
    &:hover {
      color: @zaui-brand !important;
    }
  }
}

// 分割线
.@{ant-prefix}-divider {
  .@{ant-prefix}-divider-inner-text {
    .set-text-color();
    .set-text-size();
  }
}

// 卡片
.@{ant-prefix}-card {
  margin-bottom: @zaui-space-size-md;

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

// 分页
.@{ant-prefix}-pagination {
  color: @zaui-text !important;
  font-size: @zaui-font-size !important;

  &.@{ant-prefix}-table-pagination {
    margin: @zaui-height-size-md 0;
  }

  .@{ant-prefix}-pagination-item {
    min-width: 32px;
    height: 32px;
    margin-right: 8px;
    font-size: @zaui-font-size;
    line-height: 32px;
    background-color: #f7f9fa;
    border: 0;
    border-radius: @zaui-border-radius;

    a {
      .set-text-color();

      &:hover {
        .set-brand-color();
      }
    }
  }

  .@{ant-prefix}-pagination-options-size-changer.@{ant-prefix}-select-show-arrow {
    margin-right: 5px;
  }

  .@{ant-prefix}-pagination-item-active a {
    color: #fff;
    background: @zaui-brand;
    border-radius: @zaui-border-radius;
  }

  .@{ant-prefix}-pagination-item-active:focus-visible a,
  .@{ant-prefix}-pagination-item-active:hover a {
    color: #fff;
  }

  .@{ant-prefix}-pagination-prev,
  .@{ant-prefix}-pagination-next,
  .@{ant-prefix}-pagination-jump-prev,
  .@{ant-prefix}-pagination-jump-next {
    min-width: 32px;
    height: 32px;
    line-height: 30px;
    background-color: #f7f9fa;
    border: 0;
    border-radius: @zaui-border-radius;
  }

  .@{ant-prefix}-pagination-prev,
  .@{ant-prefix}-pagination-next {
    svg {
      .set-text-color();
      .set-text-size();
    }

    &:hover {
      svg {
        color: @zaui-brand;
      }
    }
  }

  .@{ant-prefix}-pagination-prev .@{ant-prefix}-pagination-item-link,
  .@{ant-prefix}-pagination-next .@{ant-prefix}-pagination-item-link {
    min-width: 32px;
    height: 32px;
    line-height: 32px;
    background-color: #fafafa;
    border: 0;
    border-radius: @zaui-border-radius;
  }

  .@{ant-prefix}-select-single:not(.@{ant-prefix}-select-customize-input)
    .@{ant-prefix}-select-selector {
    .set-text-color();
    .set-text-size();
    width: 100%;
    height: 32px;
    padding: 0 12px;
  }

  .@{ant-prefix}-select:not(.@{ant-prefix}-select-customize-input) .@{ant-prefix}-select-selector {
    position: relative;
    background-color: #fafafa;
    border: 0;
    border-radius: @zaui-border-radius;
  }

  .@{ant-prefix}-pagination-jump-prev
    .@{ant-prefix}-pagination-item-container
    .@{ant-prefix}-pagination-item-link-icon,
  .@{ant-prefix}-pagination-jump-next
    .@{ant-prefix}-pagination-item-container
    .@{ant-prefix}-pagination-item-link-icon {
    color: @zaui-brand;
  }
}

// ant-descriptions
.@{ant-prefix}-descriptions {
  .@{ant-prefix}-descriptions-item-label,
  .@{ant-prefix}-descriptions-item-content {
    .set-text-color();
    .set-text-size();
  }
}

// ant-breadcrumb
.@{ant-prefix}-breadcrumb {
  .set-text-size();

  .@{ant-prefix}-breadcrumb-link {
    .set-lg-text-size();
  }
}

// ant-menu
.@{ant-prefix}-menu {
  color: @zaui-text !important;
  font-size: @zaui-font-size !important;

  .@{ant-prefix}-menu-item a {
    .set-text-color();
  }

  .@{ant-prefix}-menu-item-selected a,
  .@{ant-prefix}-menu-item-selected a:hover {
    .set-brand-color();
  }
}

.@{ant-prefix}-btn-primary {
  color: #fff;
}

// 下拉框三角样式替换
.@{ant-prefix}-select {
  .@{ant-prefix}-select-arrow,
  .@{ant-prefix}-select-suffix {
    .anticon-down {
      width: 0;
      height: 0;
      vertical-align: middle;
      border-top: 6px solid #909090;
      border-right: 5px solid transparent;
      border-left: 5px solid transparent;
      transition: transform 0.3s;

      svg {
        display: none;
      }
    }
  }

  // 多选样式重置
  &.@{ant-prefix}-select-multiple {
    &.@{ant-prefix}-select-disabled {
      .@{ant-prefix}-select-selection-item {
        border-color: #d9d9d9;
      }
    }
    .@{ant-prefix}-select-selection-item {
      align-items: center;
      padding-right: 7px;
      background: #f2f3f5;

      .@{ant-prefix}-select-selection-item-remove {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 14px;
        height: 14px;
        background: #e0e1e7;
        border-radius: 100%;

        .anticon-close {
          margin-top: 2px;
          color: #4e5969;
        }
      }
    }
  }
}

// 表格样式重置
.@{ant-prefix}-form {
  .pro-form-control {
    .@{ant-prefix}-btn-primary {
      margin-right: @zaui-height-size-md;
    }

    .@{ant-prefix}-btn-default {
      margin-left: 0;
    }
  }
}

// 弹窗
.@{ant-prefix}-modal {
  .@{ant-prefix}-modal-header {
    border-bottom: none;
  }

  .@{ant-prefix}-modal-footer {
    border-top: none;
  }
}

// 数字输入框
.@{ant-prefix}-input-number {
  width: 100%;
}
.@{ant-prefix}-input-number-disabled .@{ant-prefix}-input-number-input {
  color: @zaui-text;
}

// 间隔
.@{ant-prefix}-space {
  &.@{ant-prefix}-space-vertical {
    display: flex;
    width: 100%;
  }
}

// Cascader级联选择
.@{ant-prefix}-cascader {
  .@{ant-prefix}-cascader-menu {
    height: auto;
    max-height: 326px;
  }
}

.@{ant-prefix}-select-dropdown {
  // tree select 样式重置
  .@{ant-prefix}-select-tree .@{ant-prefix}-select-tree-node-content-wrapper {
    min-height: 0px;
    line-height: initial;
  }

  .@{ant-prefix}-select-tree .@{ant-prefix}-select-tree-treenode {
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .@{ant-prefix}-select-tree .@{ant-prefix}-select-tree-treenode {
    align-items: center;
  }
}

// 气泡框样式
.@{ant-prefix}-popover {
  width: max-content;
}

.@{ant-prefix}-picker.@{ant-prefix}-picker-disabled {
  background: var(--zaui-disabled-bg) !important;
}

.@{ant-prefix}-input-affix-wrapper-disabled {
  background: var(--zaui-disabled-bg) !important;
}

.@{ant-prefix}-picker {
  width: 100%;
}

// 遮罩样式调整
.@{ant-prefix}-drawer .@{ant-prefix}-drawer-mask.@{ant-prefix}-drawer-mask-blur {
  backdrop-filter: none;
}
