@import '~@/utils/utils.less';

.dataDictContainer,
.staffInfoContainer {
  min-height: 90vh;
  height: 90vh;
  // background-color: #f5f6fa;

  .announcementBar {
    background: #e6f7ff;
    border: 1px solid #91d5ff;
    margin-bottom: 16px;
    border-radius: 6px;
    overflow: hidden;

    .announcement {
      display: flex;
      align-items: center;

      .announcementLabel {
        background-color: #fef3c7;
        color: #92400e;
        border-radius: 4px;
        padding: 4px 8px;
        font-size: 12px;
        font-weight: 500;
        margin-right: 12px;
        white-space: nowrap;
        display: flex;
        align-items: center;

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

      .scrollContainer {
        flex: 1;
        overflow: hidden;
        white-space: nowrap;
      }

      .scrollContent {
        display: inline-block;
        animation: scroll 30s linear infinite;
        color: #666;
        font-size: 14px;
      }
    }
  }

  .mainContent {
    // padding: 12px;

    .contentCard {
      .ant-card-head {
        .ant-card-head-title {
          font-size: 18px;
          font-weight: 600;
          color: #333;
        }
      }
    }

    .treeCard {
      height: 600px;
      border: 1px solid #e8e8e8;
      border-radius: 8px;

      /* 搜索框样式 */
      .tree-search {
        margin-bottom: 16px;
        
        .ant-input-affix-wrapper {
          border-radius: 8px;
          border: 1px solid #d9d9d9;
          box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
          transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
          
          &:hover {
            border-color: #40a9ff;
            box-shadow: 0 2px 8px rgba(24, 144, 255, 0.1);
          }
          
          &:focus-within {
            border-color: #1890ff;
            box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
          }
          
          .ant-input {
            border: none;
            box-shadow: none;
            font-size: 13px;
            
            &::placeholder {
              color: #bfbfbf;
              font-style: italic;
            }
          }
          
          .ant-input-prefix {
            color: #bfbfbf;
            margin-right: 8px;
          }
        }
      }

      .treeHeader {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 14px;
        font-weight: 500;
      }

      .treeContainer {
        height: 480px; /* 减少高度为搜索框留空间 */
        overflow-y: auto;

        /* 自定义滚动条样式 */
        &::-webkit-scrollbar {
          width: 6px;
        }

        &::-webkit-scrollbar-track {
          background: transparent;
        }

        &::-webkit-scrollbar-thumb {
          background: #d9d9d9;
          border-radius: 3px;

          &:hover {
            background: #bfbfbf;
          }
        }

        .orgTree {
          .ant-tree-treenode {
            padding: 2px 0;

            .ant-tree-node-content-wrapper {
              border-radius: 6px;
              transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
              padding: 6px 10px;
              margin: 1px 0;

              &:hover {
                background: linear-gradient(135deg, #f0f9ff 0%, #e6f7ff 100%);
                transform: translateX(3px);
                box-shadow: 0 2px 8px rgba(24, 144, 255, 0.15);
              }

              &.ant-tree-node-selected {
                background: linear-gradient(135deg, #e6f7ff 0%, #bae7ff 100%) !important;
                box-shadow: 0 3px 12px rgba(24, 144, 255, 0.25);
                border-left: 3px solid #1890ff;
              }
            }

            .ant-tree-iconEle {
              margin-right: 10px;
              display: flex;
              align-items: center;
              justify-content: center;
              width: 20px;
              height: 20px;
            }

            .ant-tree-title {
              font-size: 14px;
              font-weight: 500;
            }

            /* 展开/收起图标样式 */
            .ant-tree-switcher {
              width: 20px;
              height: 20px;
              display: flex;
              align-items: center;
              justify-content: center;
              
              .ant-tree-switcher-icon {
                color: #8c8c8c;
                font-size: 12px;
                transition: all 0.3s ease;
                
                &:hover {
                  color: #1890ff;
                }
              }
            }
          }
        }
      }
    }

    /* Tree节点标题样式 */
    .tree-node-title {
      display: flex;
      align-items: center;
      width: 100%;
      transition: all 0.3s ease;

      .anticon {
        font-size: 16px;
        margin-right: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        border-radius: 6px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: rgba(24, 144, 255, 0.06);
        
        &:hover {
          background: rgba(24, 144, 255, 0.12);
          transform: scale(1.08);
          box-shadow: 0 2px 8px rgba(24, 144, 255, 0.15);
        }
      }

      .node-title {
        flex: 1;
        font-size: 14px;
        color: #333;
        font-weight: 500;
        transition: color 0.3s ease;
      }

      .node-count {
        color: #999;
        font-size: 11px;
        margin-left: auto;
        background: #f5f5f5;
        padding: 2px 8px;
        border-radius: 10px;
        min-width: 20px;
        text-align: center;
        font-weight: 500;
        transition: all 0.3s ease;
        
        &:hover {
          background: #e6f7ff;
          color: #1890ff;
        }
      }
    }

    .searchCard {
      margin-bottom: 16px;
      border-radius: 8px;
      border: 1px solid #e8e8e8;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);

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

      /* 搜索表单容器样式 */
      .searchFormContainer {
        .searchForm {
          .ant-form-item {
            margin-bottom: 16px;

            .ant-form-item-label {
              font-weight: 500;
              color: #333;
              
              label {
                color: #333 !important;
                font-size: 14px;
              }
            }

            .ant-input,
            .ant-select-selector,
            .ant-picker {
              border-radius: 6px;
              border: 1px solid #d9d9d9;
              transition: all 0.3s ease;

              &:hover {
                border-color: #4c7bff;
              }

              &:focus,
              &.ant-select-focused .ant-select-selector,
              &.ant-picker-focused {
                border-color: #2d5cf6;
                box-shadow: 0 0 0 2px rgba(45, 92, 246, 0.2);
              }
            }

            .ant-select-selection-placeholder,
            .ant-input::placeholder,
            .ant-picker-input input::placeholder {
              color: #bfbfbf;
            }
          }
        }
      }

      /* 搜索按钮样式 */
      .searchButton {
        background: linear-gradient(135deg, #2d5cf6 0%, #4c7bff 100%);
        border: none;
        border-radius: 6px;
        color: white;
        font-weight: 500;
        font-size: 14px;
        box-shadow: 0 2px 8px rgba(45, 92, 246, 0.3);
        transition: all 0.3s ease;
        height: 32px;
        padding: 0 16px;

        &:hover,
        &:focus {
          background: linear-gradient(135deg, #4c7bff 0%, #6b8fff 100%);
          transform: translateY(-1px);
          box-shadow: 0 4px 12px rgba(45, 92, 246, 0.4);
          color: white;
        }

        &:active {
          transform: translateY(0);
        }
      }

      /* 重置按钮样式 */
      .resetButton {
        background: #fff;
        border: 1px solid #d9d9d9;
        color: #666;
        border-radius: 6px;
        font-weight: 500;
        font-size: 14px;
        transition: all 0.3s ease;
        height: 32px;
        padding: 0 16px;

        &:hover,
        &:focus {
          border-color: #4c7bff;
          color: #2d5cf6;
        }

        .anticon {
          color: #ff7875;
        }
      }

      /* 展开按钮样式 */
      .expandButton {
        color: #2d5cf6;
        font-size: 14px;
        padding: 0 8px;
        height: 32px;
        
        &:hover,
        &:focus {
          color: #4c7bff;
        }
      }
    }

    .actionBar {



      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16px;

      .totalInfo {
        color: #666;
        font-size: 14px;
        font-weight: 500;
      }

      .exportButton {
        background: linear-gradient(135deg, #52c41a 0%, #73d13d 100%);
        border: none;
        color: white;
        border-radius: 8px;
        font-weight: 500;
        font-size: 14px;
        box-shadow: 0 4px 12px rgba(82, 196, 26, 0.3);
        transition: all 0.3s ease;
        // margin-top: -8px;
        height: 35px;
        padding: 0 16px;


        &:hover,
        &:focus {
          background: linear-gradient(135deg, #73d13d 0%, #95de64 100%);
          transform: translateY(-2px);
          box-shadow: 0 6px 20px rgba(82, 196, 26, 0.4);
          color: white;
        }

        &:active {
          transform: translateY(0);
        }

        .anticon {
          color: white;
        }
      }


      .addButton {
        background: linear-gradient(135deg, #fa8c16 0%, #ffa940 100%);
        border: none;
        border-radius: 8px;
        font-weight: 600;
        font-size: 14px;
        box-shadow: 0 4px 12px rgba(250, 140, 22, 0.3);
        transition: all 0.3s ease;
        // margin-top: -8px;
        height: 35px;
        padding: 0 16px;


        &:hover,
        &:focus {
          background: linear-gradient(135deg, #ffa940 0%, #ffc069 100%);
          transform: translateY(-2px);
          box-shadow: 0 6px 20px rgba(250, 140, 22, 0.4);
        }

        &:active {
          transform: translateY(0);
        }
      }
    }

    .tableCard {
      border-radius: 8px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
      padding-bottom: 10px;

      .ant-table-wrapper {
        max-height: 600px;
        overflow-y: auto;

        /* 自定义滚动条样式 */
        &::-webkit-scrollbar {
          width: 8px;
        }

        &::-webkit-scrollbar-track {
          background: #f5f5f5;
          border-radius: 4px;
        }

        &::-webkit-scrollbar-thumb {
          background: #d9d9d9;
          border-radius: 4px;

          &:hover {
            background: #bfbfbf;
          }
        }

        .ant-table-thead>tr>th {
          background-color: #fafafa;
          font-weight: 600;
          color: #333;
          border-bottom: 1px solid #e8e8e8;
          position: sticky;
          top: 0;
          z-index: 1;
        }

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

          >td {
            border-bottom: 1px solid #f0f0f0;
          }
        }
      }

      .paginationWrapper {
        margin-top: 20px;
        text-align: right;

        .ant-pagination {
          .ant-pagination-total-text {
            color: #666;
          }

          .ant-pagination-item {
            border-radius: 4px;

            &.ant-pagination-item-active {
              background-color: #2d5cf6;
              border-color: #2d5cf6;
            }
          }

          .ant-pagination-prev,
          .ant-pagination-next {
            border-radius: 4px;
          }
        }
      }
    }
  }
}

.mainContent {
  // padding: 12px;

  .contentCard {
    border: none !important;
    .ant-card-head {
      .ant-card-head-title {
        font-size: 18px;
        font-weight: 600;
        color: #333;
      }
    }
  }

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

    .totalInfo {
      color: #666;
      font-size: 14px;
    }
  }

  :global {
    .ant-card-body {
      padding: 0 24px;
    }
  }
}

/* 元数据域信息区域样式 */
.metadataInfoSection {
  background-color: #f9fafb;
  border-radius: 8px;
  padding: 16px;
  margin: 12px 0;
  border: 1px solid #e5e7eb;

  .metadataField {
    margin-bottom: 16px;

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

  .metadataLabel {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
  }

  .metadataInput,
  .metadataTextarea {
    border-radius: 4px;
    border: 1px solid #d1d5db;
    background-color: #ffffff;
    
    &:focus {
      border-color: #2d5cf6;
      box-shadow: 0 0 0 1px #2d5cf6;
    }

    &[readonly] {
      background-color: #f9fafb;
      cursor: default;
    }
  }

  .metadataInput {
    font-size: 14px;
    padding: 8px 12px;
  }

  .metadataTextarea {
    font-size: 14px;
    padding: 8px 12px;
    resize: vertical;
    min-height: 60px;
  }
}

/* 表格卡片样式优化 */
.tableCard {
  .ant-card-body {
    padding: 24px;
  }

  .ant-card-head {
    border-bottom: 1px solid #f0f0f0;
  }

  .ant-card-head-title {
    font-size: 18px;
    font-weight: 600;
    color: #262626;
  }
}

/* 树形卡片样式 */
.treeCard {
  height: 100%;
  
  .ant-card-body {
    padding: 16px;
    height: calc(100% - 57px);
    overflow: hidden;
  }

  .ant-card-head {
    border-bottom: 1px solid #f0f0f0;
  }

  .ant-card-head-title {
    font-size: 16px;
    font-weight: 600;
    color: #262626;
  }
}

/* 树容器样式 */
.treeContainer {
  height: calc(100% - 50px);
  overflow-y: auto;
  padding-top: 8px;

  /* 自定义滚动条 */
  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
  }

  &::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
    
    &:hover {
      background: #94a3b8;
    }
  }
}

/* 树搜索样式 */
.tree-search {
  margin-bottom: 12px;

  .ant-input {
    border-radius: 4px;
    border: 1px solid #d1d5db;
    
    &:focus {
      border-color: #2d5cf6;
      box-shadow: 0 0 0 1px #2d5cf6;
    }
  }

  .ant-input-prefix {
    color: #9ca3af;
  }
}

/* 树节点样式 */
.orgTree {
  .ant-tree-node-content-wrapper {
    border-radius: 4px;
    transition: all 0.2s;
    
    &:hover {
      background-color: #f3f4f6;
    }

    &.ant-tree-node-selected {
      background-color: #dbeafe !important;
      color: #2d5cf6;
    }
  }

  .ant-tree-switcher {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .ant-tree-iconEle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.tree-node-title {
  display: flex;
  align-items: center;
  
  .node-title {
    margin-left: 8px;
    font-size: 14px;
    color: #374151;
  }

  .node-count {
    margin-left: 4px;
    font-size: 12px;
    color: #9ca3af;
  }
}

/* 响应式样式 */
@media (max-width: 768px) {
  .metadataInfoSection {
    padding: 12px;
    margin-bottom: 16px;

    .metadataField {
      margin-bottom: 12px;
    }

    .metadataLabel {
      font-size: 13px;
    }

    .metadataInput,
    .metadataTextarea {
      font-size: 13px;
      padding: 6px 10px;
    }
  }

  .tableCard .ant-card-body {
    padding: 16px;
  }

  .treeCard .ant-card-body {
    padding: 12px;
  }
}

@keyframes scroll {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-50%);
  }
}

// 响应式设计
@media (max-width: 1200px) {
  .staffInfoContainer {
    .mainContent {
      .searchCard {
        .ant-row {
          .ant-col {
            margin-bottom: 16px;
          }
        }
      }
    }
  }
}

// 自定义主题色
.ant-btn-primary {
  background-color: #2d5cf6;
  border-color: #2d5cf6;

  &:hover,
  &:focus {
    background-color: #4c7bff;
    border-color: #4c7bff;
  }
}

.ant-tree .ant-tree-node-selected {
  background-color: #e6f7ff !important;
}

.ant-select-focused .ant-select-selector,
.ant-input-affix-wrapper-focused,
.ant-input:focus,
.ant-input-focused {
  border-color: #2d5cf6 !important;
  box-shadow: 0 0 0 2px rgba(45, 92, 246, 0.2) !important;
}

// 标签样式优化
.ant-tag {
  border-radius: 4px;
  font-size: 12px;
}

// 按钮组间距调整
.ant-space-item {
  .ant-btn+.ant-btn {
    margin-left: 8px;
  }
}

// 表格链接按钮样式
.ant-btn-link {
  padding: 0 4px;
  font-size: 12px;
}