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

// 容器样式
.container {
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  background-color: #f5f6fa;
}

// 主内容区域
.mainContent {
  height: 100vh;
  overflow: hidden;
  
  .contentCard {
    height: 100%;
    border: none !important;

    :global(.ant-card-body) {
      padding: 12px 24px;
      // height: calc(100vh - 24px);
      // overflow: hidden;
    }
  }
}

// 组织架构树卡片样式
.treeCard {
  height: 600px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;

  .treeContainer {
    height: 520px;
    overflow-y: auto;

    &::-webkit-scrollbar {
      width: 6px;
    }

    &::-webkit-scrollbar-track {
      background: rgba(0, 0, 0, 0.02);
    }

    &::-webkit-scrollbar-thumb {
      background: rgba(0, 0, 0, 0.15);
      border-radius: 3px;
      
      &:hover {
        background: rgba(0, 0, 0, 0.25);
      }
    }
  }

  .orgTree {
    .ant-tree-node-content-wrapper {
      border-radius: 4px;
      transition: all 0.3s ease;
      padding: 4px 8px;

      &:hover {
        background-color: #f0f9ff;
        transform: translateX(2px);
      }

      &.ant-tree-node-selected {
        background-color: #e6f7ff !important;
        box-shadow: 0 2px 8px rgba(24, 144, 255, 0.2);
      }
    }
  }
}

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

  .node-title {
    flex: 1;
    font-size: 14px;
    margin-left: 8px;
    color: #333;
  }

  .node-count {
    color: #999;
    font-size: 12px;
    margin-left: auto;
    background: #f0f0f0;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
  }
}

// 主要内容卡片样式
.mainCard {
  height: calc(100vh - 60px);
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  
  .ant-card-body {
    padding: 0;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
}

// 头部区域
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
  height: 64px;
  
  h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
  }
}

// 内容区域
.content {
  flex: 1;
  padding: 20px 24px 28px 24px;
  overflow-y: auto;
  overflow-x: hidden;
   min-height: 0; // 关键：允许flex子元素收缩
  height: calc(100vh - 180px); // 减去头部高度和其他空间，强制设置高度
  max-height: calc(100vh - 180px); // 明确最大高度，确保滚动条出现
  
  &::-webkit-scrollbar {
    width: 8px;
  }

  &::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 4px;
  }

  &::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 4px;

    &:hover {
      background: rgba(0, 0, 0, 0.28);
    }
  }
  
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.18) rgba(0, 0, 0, 0.02);
}

// 表单卡片
.formCard {
  margin-bottom: 20px;
  border-radius: 8px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);

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

  .ant-card-head {
    border-bottom: 1px solid #f0f0f0;
    
    .ant-card-head-title {
      font-size: 15px;
      font-weight: 600;
      color: #333;
    }
  }

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

// 表单项
.formItem {
  margin-bottom: 16px;
  
  &:last-child {
    margin-bottom: 0;
  }
  
  label {
    // display: block;
    font-weight: 500;
    color: #333;
    font-size: 14px;
    margin-bottom: 6px;
  }
}

.readOnlyField {
  background-color: #f9fafb;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  color: #374151;
  font-size: 14px;
}

/* 岗位列表 */
.positionList {
  .positionItem {
    margin-bottom: 12px;
  }

  .addButton {
    color: #2d5cf6;
    padding: 0;
    height: auto;
    font-size: 14px;
    
    &:hover {
      color: #1d4ed8;
    }
  }
}

/* 人员要求区域 */
.requirementSection {
  .formItem {
    margin-bottom: 20px;

    .ant-radio-group {
      display: flex;
      gap: 16px;
    }
  }
}

/* 人员列表 */
.personList {
  .personItem {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 12px;
    transition: all 0.2s;

    &:hover {
      border-color: #d1d5db;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    }
  }

  .personInfo {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .personDetails {
    .personName {
      font-size: 14px;
      font-weight: 500;
      color: #262626;
      margin-bottom: 2px;
    }

    .personMeta {
      font-size: 12px;
      color: #6b7280;
    }
  }

  .addButton {
    color: #2d5cf6;
    padding: 0;
    height: auto;
    font-size: 14px;
    
    &:hover {
      color: #1d4ed8;
    }
  }
}

// 响应式设计
@media (max-width: 1200px) {
  .treeCard {
    height: 300px;
  }
  
  .mainCard {
    height: auto;
    max-height: 80vh;
    min-height: 500px;
    
    .content {
      max-height: 65vh;
      
      &::-webkit-scrollbar {
        width: 4px;
      }
    }
  }
}

// 页面特定样式
.container {
  .ant-btn-primary {
    background: linear-gradient(135deg, #2d5cf6 0%, #4c7bff 100%);
    border: none;
    border-radius: 6px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(45, 92, 246, 0.3);
    transition: all 0.3s ease;
    
    &:hover,
    &:focus {
      background: linear-gradient(135deg, #4c7bff 0%, #6b8fff 100%);
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(45, 92, 246, 0.4);
    }
  }
  
  .ant-btn:not(.ant-btn-primary) {
    border-radius: 6px;
    transition: all 0.3s ease;
    
    &:hover,
    &:focus {
      border-color: #4c7bff;
      color: #2d5cf6;
    }
  }

  .ant-input,
  .ant-select-selector,
  .ant-picker {
    border-radius: 6px;
    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);
    }
  }
}