/* You can add global styles to this file, and also import other style files */

@import "~ng-zorro-antd/ng-zorro-antd.less";
@import "~ng-zorro-antd/resizable/style/entry.less";

@menu-collapsed-width: 100%;

/******** ant样式 ********/

// 布局
.ant-layout {
  height: 100%;
  background: transparent;
}

// 布局侧边栏
.ant-layout-sider {
  &:not([nztheme]) {
    background: transparent;
  }

  &>.ant-layout-sider-children {
    overflow: hidden;

    &:hover {
      overflow: auto;
    }
  }
}

// 布局内容
.ant-layout-content {
  flex: 1;
  overflow: auto;
}

// 表格
.ant-table-wrapper {
  tr {

    th:last-child:empty,
    td:last-child:empty {
      border: none !important;
    }

    td:last-child:empty {
      background: transparent;
    }
  }

  .ant-table-bordered {
    &>.ant-table-container {
      border: 1px solid #f0f0f0;

      &>.ant-table-content>table {
        &>thead>tr>th .nz-resizable-handle::before {
          content: none;
        }

        &>tbody>.ant-table-placeholder>.nz-disable-td {
          border: none;
        }
      }
    }
  }

  .ant-table-container {
    overflow: auto;
  }

  .ant-table-placeholder {
    .nz-disable-td {
      text-align: left;

      .ant-empty {
        display: inline-block;
        position: sticky;
        left: 50%;
        transform: translateX(-50%);
      }
    }
  }

  .ant-table-filter-column-title {
    width: 100%;
  }

  .ant-table-column-sorters {
    max-width: 100%;

    &>span:first-child {
      flex: 1;
      overflow: hidden;
    }
  }

  .nz-resizable-resizing {
    z-index: 1000;
    pointer-events: none;
  }

  .nz-resizable-handle {
    display: flex;
    justify-content: center;

    &::before {
      content: '';
      width: 1px;
      background: #e8e8e8;
    }
  }

  .nz-resizable-preview {
    border-width: 0;
    border-right-width: 1px;
  }
}

// 页头
.ant-page-header {
  padding: 16px 0 0;
  height: 100%;
  display: flex;
  flex-direction: column;

  .ant-page-header-heading {
    padding: 0 24px;

    .ant-page-header-heading-extra .ant-btn+.ant-btn-group {
      margin-left: 12px;
    }
  }

  .ant-page-header-content {
    padding: 12px 24px 0;
  }

  .ant-page-header-footer {
    flex: 1;
    overflow: hidden;
    background: #f0f2f5;

    &>.ant-tabs-top,
    &>.ant-tabs-bottom {
      &>.ant-tabs-nav {
        padding: 0 24px;
        background: #fff;
      }
    }
  }
}

// 表单
.ant-form {
  &.ant-form-inline {
    .ant-form-item {
      margin-bottom: 24px;
    }

    .ant-form-item-with-help {
      margin-bottom: 0;
    }
  }
}

// 表单控件
.ant-form-item-control {
  min-width: 0;
  flex: 1;

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

// 输入框
:not(input):not(textarea).ant-input {
  cursor: text;

  &:empty:before {
    content: attr(placeholder);
    color: #bfbfbf;
  }

  &[disabled] {
    pointer-events: none;
  }
}

// 描述列表
.ant-descriptions {
  .ant-descriptions-view table {
    table-layout: fixed;
  }

  &.ant-descriptions-bordered .ant-descriptions-item-label {
    width: 120px;
  }
}

// 抽屉
.ant-drawer {
  .ant-drawer-content-wrapper {
    max-width: 100%;
    max-height: 100%;
  }

  .ant-drawer-body {
    background: #f0f2f5;
  }
}

// 空状态
.ant-empty {
  .ant-empty-description {
    margin: 0;
  }
}

// 时间轴
.ant-timeline {
  .ant-timeline-item:last-child {
    padding-bottom: 0;
  }
}

// 头像
.ant-avatar {
  .anticon:not(:last-child) {
    display: none;
  }
}

// 排版
.ant-typography {
  color: inherit;
}

.ant-typography h1,
.ant-typography h2,
.ant-typography h3,
.ant-typography h4,
.ant-typography h5,
.ant-typography p,
h1.ant-typography,
h2.ant-typography,
h3.ant-typography,
h4.ant-typography,
h5.ant-typography,
div.ant-typography {
  margin: 0;
}

/******** cortex样式 ********/

// 页面内容
.ctx-page-content {
  height: 100%;
  overflow: auto;
  border-top: 1px solid #f0f0f0;
}

// 加载中固定
.ctx-spin-fixed {
  height: 100%;

  &>div>.ant-spin {
    max-height: none;
  }

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

// 标签固定
.ctx-tabs-fixed {
  height: 100%;

  &.ant-tabs-card {
    &.ant-tabs-top>.ant-tabs-content-holder>.ant-tabs-content {
      border: 1px solid #f0f0f0;
      border-top: none;
    }

    &.ant-tabs-right>.ant-tabs-content-holder>.ant-tabs-content {
      border: 1px solid #f0f0f0;
      border-right: none;
    }

    &.ant-tabs-bottom>.ant-tabs-content-holder>.ant-tabs-content {
      border: 1px solid #f0f0f0;
      border-bottom: none;
    }

    &.ant-tabs-left>.ant-tabs-content-holder>.ant-tabs-content {
      border: 1px solid #f0f0f0;
      border-left: none;
    }
  }

  &.ant-tabs-top>.ant-tabs-nav::before {
    border-bottom: 1px solid #f0f0f0;
  }

  &.ant-tabs-bottom>.ant-tabs-nav::before {
    border-top: 1px solid #f0f0f0;
  }

  &>.ant-tabs-nav {
    margin: 0;

    .ant-tabs-tab-btn {
      font-weight: normal;
    }
  }

  &>.ant-tabs-content-holder {
    &>.ant-tabs-content {
      height: 100%;

      &>.ant-tabs-tabpane {
        padding: 0;
        overflow: auto;
      }
    }
  }
}

// 卡片
.ctx-card {
  &>.ant-card-head {
    border: none;
    padding: 16px 24px;

    .ant-card-head-wrapper {
      flex-wrap: wrap;
      justify-content: space-between;
      margin: -4px -12px;
    }

    .ant-card-head-title {
      padding: 0;
      flex: none;
      line-height: 32px;
      margin: 4px 12px;
    }

    .ant-card-extra {
      padding: 0;
      margin: 4px 12px;
    }
  }

  &>.ant-card-body:not(:first-child) {
    padding-top: 0;
  }
}

// 卡片固定
.ctx-card-fixed {
  height: 100%;
  display: flex;
  flex-direction: column;

  &>.ant-card-body {
    flex: 1;
    overflow: auto;
  }
}

/** 含蓄的表单 */
.ctx-form-implicit {
  .ant-form-item {
    margin: 0;
  }

  .ant-form-item-explain {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: -8px;
    z-index: 1000;
    transform: translateY(-100%);
    background: #fff;
    padding: 8px 12px;
    border-radius: 2px;
    box-shadow: 0 3px 6px -4px rgba(0, 0, 0, .12),
      0 6px 16px 0 rgba(0, 0, 0, .08),
      0 9px 28px 8px rgba(0, 0, 0, .05);
    transition: all .3s;

    &::before {
      content: '';
      display: block;
      width: 8px;
      height: 8px;
      position: absolute;
      bottom: -3px;
      left: 16px;
      transform: rotate(45deg);
      background: transparent;
      border-width: 4px;
      border-style: solid;
      border-color: transparent #fff #fff transparent;
      box-shadow: 3px 3px 7px rgba(0, 0, 0, .07);
    }

    &::after {
      content: "";
      display: block;
      width: 100%;
      height: 8px;
      position: absolute;
      bottom: 0;
      left: 0;
      transform: translateY(100%);
    }
  }

  .ant-form-item:hover>.ant-form-item-control>.ant-form-item-explain {
    visibility: visible;
    opacity: 1;
  }
}

// 表格固定
.ctx-table-fixed {
  height: 100%;

  &>.ant-spin-nested-loading {
    height: 100%;

    &>.ant-spin-container {
      height: 100%;
      display: flex;
      flex-direction: column;

      &>.ant-table {
        flex: 1;
        overflow: hidden;

        &>.ant-table-container {
          height: 100%;

          &>.ant-table-content>table>thead>tr>th {
            position: sticky !important;
            top: 0;
            z-index: 998;

            &.ant-table-selection-column {
              z-index: 999;
            }
          }
        }
      }

      &>.ant-table-pagination {
        margin-bottom: 0;
        overflow: hidden;
      }
    }
  }
}

// 表格设置
.ctx-table-setting {
  .ant-popover-title {
    line-height: 32px;
  }

  .ant-popover-inner-content {
    padding: 8px 0;
    max-height: 560px;
    overflow: auto;
  }

  td {
    padding: 4px 8px !important;
    border-bottom: none !important;
  }

  .anticon {
    cursor: move;
    color: rgba(0, 0, 0, .45);
    padding-right: 4px;
  }
}

// 表格树形切换器
.ctx-table-tree-switcher {
  a {
    display: flex;
    align-items: center;
    color: rgba(0, 0, 0, .85);

    &:hover {
      color: #40a9ff;
    }
  }

  .anticon {
    margin-right: 4px;
    width: 16px;
  }

  .anticon-caret-right {
    font-size: 10px;
  }
}

// 按钮
.ctx-btn-link {
  display: inline;
  padding: 0;
  height: auto;
  line-height: normal;

  &>span {
    display: inline;
  }
}

// 蓝色图标模态确认框
.ctx-modal-confirm-icon-blue .ant-modal-confirm-body>.anticon {
  color: #1890ff;
}

// 绿色图标模态确认框
.ctx-modal-confirm-icon-green .ant-modal-confirm-body>.anticon {
  color: #52c41a;
}

// 红色图标模态确认框
.ctx-modal-confirm-icon-red .ant-modal-confirm-body>.anticon {
  color: #ff4d4f;
}
