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

/* 组织架构页面样式 */
.organ-chart-page {
  padding: 16px;
  background-color: #f9fafb;
  min-height: 100vh;
  
  /* 自定义滚动条样式 */
  &::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  
  &::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
  }
  
  &::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
    
    &:hover {
      background: #a8a8a8;
    }
  }
  
  /* 内容滚动区域的滚动条样式 */
  div[style*="overflowY: auto"] {
    &::-webkit-scrollbar {
      width: 6px;
    }
    
    &::-webkit-scrollbar-track {
      background: transparent;
    }
    
    &::-webkit-scrollbar-thumb {
      background: #d9d9d9;
      border-radius: 3px;
      
      &:hover {
        background: #bfbfbf;
      }
    }
  }

  /* 树形组件卡片样式 */
  .treeCard {
    height: 600px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;

    .treeContainer {
      height: 520px;
      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: 4px;
            transition: background-color 0.2s;

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

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

  /* 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;
    }
  }
}

/* 公告栏样式 */
.organ-chart-announcement {
  margin-bottom: 24px;
  border-radius: 6px;
  overflow: hidden;
}

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

.announcement-badge {
  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;
  }
}

.announcement-content {
  overflow: hidden;
  flex: 1;
}

.marquee-text {
  white-space: nowrap;
  animation: marquee 20s linear infinite;
  display: inline-block;
  
  span {
    font-size: 14px;
    margin-right: 32px;
    
    &:last-child {
      margin-right: 0;
    }
  }
}

@keyframes marquee {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* 组织架构侧边栏样式 */
.org-sidebar {
  height: fit-content;
  
  .ant-card-body {
    padding: 16px 8px 16px 16px;
  }
  
  /* 树形组件滚动区域样式 */
  .ant-tree {
    &::-webkit-scrollbar {
      width: 4px;
    }
    
    &::-webkit-scrollbar-track {
      background: transparent;
    }
    
    &::-webkit-scrollbar-thumb {
      background: #d9d9d9;
      border-radius: 2px;
      
      &:hover {
        background: #bfbfbf;
      }
    }
  }
}

/* Tree节点标题样式 */
.tree-node-title {
  display: flex;
  align-items: center;
  
  .node-text {
    flex: 1;
    font-size: 14px;
    margin-left: 8px;
  }
  
  .node-count {
    color: #999;
    font-size: 12px;
    margin-left: auto;
  }
}

.org-node {
  background-color: #F5F6FA;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
  
  &.has-children {
    cursor: pointer;
  }
  
  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  }
}

.node-content {
  display: flex;
  align-items: center;
  
  .node-icon {
    color: #6b7280;
    display: flex;
    align-items: center;
    
    .anticon {
      color: #6b7280;
    }
  }
}

.node-text {
  font-size: 14px;
  margin-left: 8px;
}

.expand-icon {
  font-size: 12px;
  color: #9ca3af;
}

.org-children {
  margin-left: 24px;
}

/* 筛选区域样式 */
.filter-section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 18px;
  font-weight: 500;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.year-selector {
  display: flex;
  align-items: center;
  
  span {
    font-size: 14px;
    color: #6b7280;
    margin-right: 8px;
  }
}

/* 主要内容区样式 */
.main-content {
  border-radius: 6px;
}

/* 组织架构图样式 */
.org-chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.org-chart-node {
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  
  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  }
}

.company-node {
  background: #2D5CF6;
  color: #fff;
  width: 192px;
  margin-bottom: 16px;
  
  :global(.ant-card-body) {
    padding: 12px;
  }
  
  .node-title {
    font-weight: 500;
    font-size: 16px;
  }
  
  .node-count {
    font-size: 12px;
    opacity: 0.8;
  }
}

.center-row {
  width: 100%;
}

.center-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.center-node {
  background: #dbeafe;
  width: 160px;
  margin-bottom: 16px;
  
  :global(.ant-card-body) {
    padding: 12px;
  }
  
  .node-title {
    font-weight: 500;
  }
  
  .node-count {
    font-size: 12px;
    color: #6b7280;
  }
}

.department-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.department-node {
  background: #eff6ff;
  width: 128px;
  
  :global(.ant-card-body) {
    padding: 8px;
  }
  
  .node-title {
    font-size: 14px;
  }
  
  .node-count {
    font-size: 12px;
    color: #6b7280;
  }
}

/* 统计卡片样式 */
.statistics-row {
  margin-top: 32px;
}

.stat-card {
  background: #F5F6FA;
  border-radius: 6px;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.stat-title {
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
}

.stat-icon {
  .anticon {
    font-size: 20px;
    color: #2d5cf6;
  }
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 4px;
}

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

/* 图表区域样式 */
.chart-section {
  margin-top: 32px;
}

.chart-title {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 16px;
}

.chart-container {
  background: #F5F6FA;
  border-radius: 6px;
}

/* 图表区域样式 */
.charts-row {
  margin-top: 16px;
}

.chart-section {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  
  :global(.ant-card-head-title) {
    font-size: 16px;
    font-weight: 500;
  }
  
  :global(.ant-card-body) {
    padding: 20px;
  }
}

/* 统计描述样式 */
.stat-desc {
  margin-top: 8px;
  font-size: 12px;
  color: #52c41a;
}

/* 响应式样式 */
@media (max-width: 768px) {
  .organ-chart-page {
    padding: 8px;
  }
  
  .announcement-badge {
    display: none;
  }
  
  .announcement-content {
    overflow: hidden;
  }
  
  .filter-actions {
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
  }
  
  .center-row {
    flex-direction: column;
    align-items: center;
    gap: 24px;
  }
  
  .statistics-row {
    :global(.ant-col) {
      margin-bottom: 16px;
    }
  }
  
  .charts-row {
    :global(.ant-col) {
      margin-bottom: 16px;
    }
  }
  
  /* 移动端下的滚动优化 */
  .organ-chart-page {
    padding: 8px;
  }
  
  .org-sidebar {
    margin-bottom: 16px;
  }
}

/* 移动端触摸滚动优化 */
@media screen and (max-width: 768px) {
  .organ-chart-page {
    -webkit-overflow-scrolling: touch;
    
    div[style*="overflowY: auto"] {
      -webkit-overflow-scrolling: touch;
    }
  }
  
  /* 移动端隐藏滚动条但保留滚动功能 */
  .org-sidebar .ant-tree {
    &::-webkit-scrollbar {
      display: none;
    }
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
}
