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

// 使用与OnBoarding相同的基础样式
.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;
    }
  }
}

// 组织架构树样式 - 与OnBoarding保持一致
.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-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: 72px;
  // background: #fafafa;
}

// 内容区域
.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);
}

// 按钮样式
.createBtn {
  background: linear-gradient(135deg, #2d5cf6 0%, #4c7bff 100%);
  border: none;
  box-shadow: 0 2px 8px rgba(45, 92, 246, 0.3);
  
  &:hover {
    background: linear-gradient(135deg, #4c7bff 0%, #6b8fff 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 92, 246, 0.4);
  }
}

.saveBtn {
  background: linear-gradient(135deg, #2d5cf6 0%, #4c7bff 100%);
  border: none;
  box-shadow: 0 2px 8px rgba(45, 92, 246, 0.3);
  
  &:hover {
    background: linear-gradient(135deg, #4c7bff 0%, #6b8fff 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 92, 246, 0.4);
  }
}

// 区块卡片
.sectionCard {
  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: 16px;
      font-weight: 600;
      color: #333;
    }
  }

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

// 表单样式
.formItem {
  margin-bottom: 16px;
  
  .formLabel {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
  }
  
  .formInput,
  .formTextArea {
    border-radius: 6px;
    border: 1px solid #d9d9d9;
    transition: all 0.3s ease;
    
    &:hover {
      border-color: #4c7bff;
    }
    
    &:focus,
    &.ant-input-focused {
      border-color: #2d5cf6;
      box-shadow: 0 0 0 2px rgba(45, 92, 246, 0.2);
    }
  }
}

// 上传区域
.uploadContainer {
  display: flex;
  align-items: center;
  
  .coverUpload {
    margin-right: 8px;
    
    .uploadArea {
      width: 64px;
      height: 64px;
      border: 1px dashed #d9d9d9;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #fafafa;
      cursor: pointer;
      transition: all 0.3s ease;
      
      &:hover {
        border-color: #2d5cf6;
        background: #f0f9ff;
      }
      
      .uploadIcon {
        font-size: 24px;
        color: #bfbfbf;
      }
    }
  }
  
  .uploadText {
    font-size: 12px;
    color: #666;
  }
}

// 课程管理区域
.courseSection {
  .courseSectionHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    
    .courseSectionTitle {
      font-weight: 500;
      color: #333;
      font-size: 14px;
    }
    
    .searchInput {
      width: 128px;
      border-radius: 4px;
    }
  }
  
  .courseList {
    height: 256px;
    overflow-y: auto;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 8px;
    background: #fafafa;
    
    &::-webkit-scrollbar {
      width: 4px;
    }

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

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

// 课程项
.courseItem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  
  &:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #e8e8e8;
  }
  
  &:last-child {
    margin-bottom: 0;
  }
  
  .courseInfo {
    flex: 1;
    
    .courseName {
      display: block;
      font-weight: 500;
      color: #333;
      font-size: 14px;
      margin-bottom: 2px;
    }
    
    .courseInstructor {
      font-size: 12px;
      color: #666;
    }
  }
  
  .courseDuration {
    background: rgba(45, 92, 246, 0.1);
    color: #2d5cf6;
    border: none;
    border-radius: 12px;
    font-size: 12px;
    padding: 2px 8px;
  }
}

.courseItemSelected {
  background: #f0f0f0 !important;
  cursor: not-allowed;
  
  &:hover {
    transform: none;
    box-shadow: none;
  }
}

// 已选课程项
.selectedCourseItem {
  margin-bottom: 8px;
  padding: 12px;
  background: rgba(45, 92, 246, 0.05);
  border-radius: 6px;
  border: 1px solid rgba(45, 92, 246, 0.1);
  
  &:last-child {
    margin-bottom: 0;
  }
  
  .courseItemHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    
    .courseActions {
      display: flex;
      align-items: center;
      gap: 4px;
      
      .scheduleBtn {
        color: #2d5cf6;
        font-size: 12px;
        padding: 0;
        height: auto;
        
        &:hover {
          text-decoration: underline;
        }
      }
      
      .removeBtn {
        color: #ff4d4f;
        
        &:hover {
          background: rgba(255, 77, 79, 0.1);
        }
      }
    }
  }
}

// 时间设置区域
.scheduleSettings {
  background: #f5f5f5;
  padding: 8px 12px;
  border-radius: 4px;
  
  .scheduleRow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    
    .scheduleLabel {
      font-size: 12px;
      color: #666;
      white-space: nowrap;
    }
    
    .dateInput {
      flex: 1;
      height: 28px;
      font-size: 12px;
    }
    
    .timeInput {
      width: 96px;
      height: 28px;
      font-size: 12px;
    }
  }
  
  .scheduleActions {
    display: flex;
    justify-content: flex-end;
    
    .confirmBtn {
      height: 24px;
      font-size: 12px;
      padding: 0 12px;
    }
  }
}

// 底部操作按钮
.actionButtons {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
}

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

// 页面特定样式
.container {
  .ant-btn-primary {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
  }
  
  .ant-btn:not(.ant-btn-primary) {
    border-radius: 6px;
    transition: all 0.3s ease;
    
    &:hover,
    &:focus {
      border-color: #4c7bff;
      color: #2d5cf6;
    }
  }
}