// 查核要点管理页面样式

.check-unit-mana {
  .check-unit-container {
    display: flex;
    height: 100%;
    padding: 16px;
  }

  // 左侧科室树样式
  .dept-tree {
    display: flex;
    flex-direction: column;
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    background: #fff;
    border-radius: 4px;
    height: calc(100vh - 80px);
    overflow: hidden;

    .search-wrapper {
      display: flex;
      align-items: center;
      padding: 12px;
      padding-bottom: 8px;
      flex-shrink: 0; // 防止搜索栏被压缩

      .search-input {
        flex: 1;
        border-radius: 4px;
        border: 1px solid #d9d9d9;

        .ant-input {
          border: none;
          box-shadow: none;
        }

        &:hover,
        &:focus-within {
          border-color: #3377ff;
        }
      }

      .add-button {
        margin-left: 8px;
        width: 24px;
        height: 24px;
        background: #fafcff;
        border-radius: 4px;
        border: 1px solid #dae2f2;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }

    .dept-list {
      flex: 1;
      overflow-y: auto;
      max-height: calc(100vh - 140px); // 限制最大高度，确保滚动可用

      // 加载更多提示样式
      .loading-more {
        text-align: center;
        padding: 12px;
        color: #999;
        font-size: 12px;

        span {
          color: #999;
        }
      }

      .no-more-data {
        text-align: center;
        padding: 12px;
        color: #999;
        font-size: 12px;
        border-top: 1px solid #f0f0f0;
        margin-top: 8px;

        span {
          color: #999;
        }
      }

      .dept-group {
        margin-bottom: 0;

        .dept-parent {
          display: flex;
          align-items: center;
          padding: 6px 12px 6px 8px;
          margin: 0 8px;
          cursor: pointer;
          height: 32px;
          box-sizing: border-box;
          border-radius: 4px;
          justify-content: space-between;

          .toggle-button {
            padding: 0;
            width: 16px;
            height: 16px;
            margin-right: 4px;
            border: none;
            line-height: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #999;
            background: transparent;

            .anticon {
              font-size: 16px;
            }

            &:hover {
              background: transparent;
              color: #333;
            }
          }

          .dept-title {
            flex: 1;
            font-size: 14px;
            color: #333;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            margin-right: 8px; // 给右侧按钮留出空间
          }

          .more-button {
            padding: 0;
            width: 16px;
            height: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #99a6bf;
            border-radius: 4px;
            background: #fff;

            .anticon {
              transform: rotate(90deg);
            }

            &:hover {
              background: #fff;
            }
          }

          &:hover {
            background-color: #f0f2f5;
          }

          &.selected {
            background: #f0f2f5;
            border: none;

            .dept-title {
              color: #17181a;
              font-weight: 500;
            }
          }
        }

        .dept-leaf {
          display: flex;
          align-items: center;
          justify-content: space-between;
          padding-left: 8px;
          padding-right: 8px;
          margin: 0 8px;
          cursor: pointer;
          height: 32px;
          box-sizing: border-box;
          border-radius: 4px;

          .dept-leaf-title {
            flex: 1;
            min-width: 0;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 14px;
            color: #17181a; // 颜色稍浅，区别于父节点
            margin-right: 8px; // 给右侧按钮留出空间
          }

          .dept-sort-circle {
            flex: 0 0 auto;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            line-height: 18px;
            color: #3377ff;
            border: 1px solid rgba(51, 119, 255, 0.5);
            background: rgba(51, 119, 255, 0.08);
          }

          .dept-leaf-text {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }

          &:hover {
            background-color: #f0f2f5;
          }

          &.selected {
            background: #f0f2f5;
            border: none;

            .dept-leaf-title {
              color: #17181a;
              font-weight: 500;
            }
          }

          .more-button {
            padding: 0;
            width: 16px;
            height: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #99a6bf;
            border-radius: 4px;
            background: #fff;

            .anticon {
              transform: rotate(90deg);
            }

            &:hover {
              background: #fff;
            }
          }
        }

        .dept-children {
          padding: 4px 0;

          .dept-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 12px 0 36px;
            margin: 0 8px;
            cursor: pointer;
            height: 32px;
            box-sizing: border-box;
            border-radius: 4px;

            > span {
              flex: 1;
              font-size: 14px;
              color: #333;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
              margin-right: 8px; // 给右侧按钮留出空间
            }

            &:hover {
              background-color: #f0f2f5;
            }

            &.selected {
              background: #f0f2f5;
              border: none;

              > span {
                color: #17181a;
                font-weight: 500;
              }
            }

            .more-button {
              padding: 0;
              width: 16px;
              height: 16px;
              display: flex;
              align-items: center;
              justify-content: center;
              color: #999;
              border-radius: 4px;
              background: #fff;

              .anticon {
                transform: rotate(90deg);
              }

              &:hover {
                background: #fff;
              }
            }
          }
        }

        .dept-empty {
          padding: 6px 10px 6px 30px;
          margin: 0 8px;
          color: #999;
          font-size: 13px;
        }
      }

      // 叶子节点样式（临床诊疗、后勤支援等）
      .dept-leaf-node {
        display: flex;
        align-items: center;
        padding: 6px 8px;
        margin: 4px 8px;
        cursor: pointer;
        height: 32px;
        box-sizing: border-box;
        background: transparent;
        border-radius: 0;

        .leaf-button {
          padding: 0;
          width: 20px;
          height: 20px;
          margin-right: 8px;
          border: none;
          display: flex;
          align-items: center;
          justify-content: center;
          color: #666;

          .anticon {
            font-size: 12px;
          }
        }

        .leaf-title {
          flex: 1;
          font-size: 14px;
          color: #333;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          margin-right: 8px; // 给右侧按钮留出空间
        }

        &:hover {
          background: #f5f5f5;
        }
      }
    }
  }

  // 右侧内容区样式
  .dept-content {
    flex: 1;
    padding-left: 16px;
    height: 100%;
    overflow: auto;

    .pfm-ant-card {
      box-shadow: none;
      background: #fff;
      border-radius: 4px;

      .pfm-ant-card-body {
        padding: 16px;
        padding-top: 0;
      }
    }

    .dept-header {
      padding: 0 0 16px;
      border-bottom: 1px solid #e6eaf2;
      display: flex;
      align-items: baseline;
      gap: 8px;

      .dept-title {
        font-size: 20px;
        font-weight: 600;
        color: #17181a;
      }

      .dept-info {
        font-size: 14px;
        color: #515866;
      }
    }

    .pfm-ant-tabs-nav {
      margin-bottom: 16px;
    }

    .tab-content {
      .toolbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;
      }

      .add-btn {
        background-color: #3377ff;
        border-color: #3377ff;
        border-radius: 4px;
        height: 24px;
        box-shadow: none;
        font-weight: 400;
        font-size: 14px;
        color: #ffffff;
        width: 56px;
        padding: 0;
        line-height: 22px;

        &:hover {
          background-color: #5591ff;
          border-color: #5591ff;
        }

        &:active {
          background-color: #1b5ee6;
          border-color: #1b5ee6;
        }
      }
    }

    .empty-state {
      height: calc(100vh - 96px);
      display: flex;
      align-items: center;
      justify-content: center;

      .empty-content {
        text-align: center;

        .empty-text {
          font-size: 14px;
          color: #8c8c8c;
        }
      }
    }
  }

  // 表格样式
  /* 表格样式已统一至 KCIMTable/style.less */

  .delete-btn {
    color: #3377ff;
  }

  // 员工选择相关样式
  .employee-select-modal {
    .pfm-ant-modal-header {
      border-bottom: 1px solid #f0f0f0;
      padding: 12px 16px;

      .pfm-ant-modal-title {
        font-size: 14px;
        font-weight: 500;
        color: #333;
      }
    }
  }
}

// 覆盖 KCIMTable 的样式
.check-point-mana-container {
  .ant-pro-table {
    .ant-pro-table-list-toolbar {
      display: none; // 隐藏默认的工具栏
    }

    .ant-table-wrapper {
      .ant-table {
        .ant-table-thead > tr > th {
          background: #fafafa;
          font-weight: 600;
        }

        .ant-table-tbody > tr:hover > td {
          background: #f5f5f5;
        }
      }
    }
  }
}

// 新增按钮样式优化
.ant-btn-primary {
  box-shadow: 0 2px 4px rgba(24, 144, 255, 0.2);

  &:hover {
    box-shadow: 0 4px 8px rgba(24, 144, 255, 0.3);
  }
}

// 操作按钮样式
.ant-table-tbody {
  .ant-table-cell {
    a {
      margin-right: 12px;

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

.unitMana {
  margin: 16px;
  padding: 16px;
  background: #ffffff;
  border-radius: 4px;

  .toolBar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;

    .filter {
      display: flex;
      flex-direction: row;
      justify-content: flex-start;
      align-items: center;

      .filterItem {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
      }
    }

    .btnGroup {
      .add {
        cursor: pointer;
        display: inline-block;
        font-size: 14px;
        font-family: SourceHanSansCN-Normal, SourceHanSansCN;
        font-weight: 400;
        color: #ffffff;
        line-height: 24px;
        padding: 0 14px;
        background: #3377ff;
        border-radius: 4px;
      }
    }
  }
}

// 更多操作下拉菜单样式
.check-unit-add-dropdown {
  .pfm-ant-dropdown-menu {
    border-radius: 4px;
    overflow: hidden;
    padding: 4px;
  }

  .pfm-ant-dropdown-menu-item {
    &:hover,
    &.pfm-ant-dropdown-menu-item-selected {
      background: rgba(51, 119, 255, 0.08);
      color: #17181a;
      border-radius: 4px;
    }
  }
}

// 员工选择弹窗样式
.employee-select-modal {
  .ant-modal-footer {
    .ant-btn-primary {
      background-color: #3377ff !important;
      border-color: #3377ff !important;
      color: #ffffff !important;

      &:hover {
        background-color: #5591ff !important;
        border-color: #5591ff !important;
        color: #ffffff !important;
      }

      &:disabled {
        background-color: #f5f5f5 !important;
        border-color: #d9d9d9 !important;
        color: rgba(0, 0, 0, 0.25) !important;
      }
    }
  }
}
