/* 主容器高度控制 */
.user-management-container {
  height: calc(100vh - 84px);
  padding: 12px;
  box-sizing: border-box;
  overflow: hidden;
  width: 100%; /* 确保容器占满页面宽度 */
}

.full-height-row {
  height: 100%;
  width: 100%; /* 确保行占满容器宽度 */
  margin: 0 !important;
}

.full-height-col {
  height: 100%;
  padding: 0 10px !important;
  width: 100%; /* 确保列占满分配的宽度 */
  box-sizing: border-box;
}

.full-height-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 右侧内容区域布局 */
.right-content {
  height: 100%;
  width: 100%; /* 添加明确的宽度 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-card {
  margin-bottom: 12px;
  flex-shrink: 0;
}

.table-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  width: 100%; /* 添加明确的宽度 */
}

/* 确保表格容器占满可用空间 */
.table-container {
  flex: 1;
  width: 100%;
  overflow: auto;
  min-height: 0;
}

/* 左侧树形结构基本样式 */
.tree-scroll-container {
  flex: 1;
  overflow: auto;
  padding: 8px 12px;
  min-height: 0;
}

.search-container {
  padding: 12px 16px;
  border-bottom: 1px solid #ebeef5;
  flex-shrink: 0;
}

/* 卡片头部样式优化 */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

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

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.dept-code-checkbox {
  margin-left: 8px;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.header-title {
  display: flex;
  align-items: center;
  font-weight: 500;
}

/* 分页容器 */
.pagination-container {
  padding: 12px 0 8px 0;
  flex-shrink: 0;
  border-top: 1px solid #ebeef5;
  width: 100%;
}

/* 空数据状态 */
.empty-data {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}

/* 强制el-card body填充高度 */
:deep(.el-card__body) {
  flex: 1;
  overflow: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
}

/* 表格头部样式 */
:deep(.el-card__header) {
  padding: 16px;
  border-bottom: 1px solid #ebeef5;
  flex-shrink: 0;
}

/* 左侧卡片特殊处理 */
:deep(.full-height-col:first-child .el-card__body) {
  padding: 0;
}

/* 确保卡片内容区域正确展示 */
:deep(.table-card .el-card__body) {
  flex: 1;
  overflow: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
}

/* 搜索表单样式优化 */
:deep(.search-card .el-form--inline .el-form-item) {
  margin-right: 10px;
  margin-bottom: 10px;
}

/* checkbox样式优化 */
:deep(.dept-code-checkbox.el-checkbox) {
  --el-checkbox-font-size: 12px;
}

:deep(.dept-code-checkbox .el-checkbox__label) {
  font-size: 12px;
  color: #606266;
}

/* 确保树容器不会横向溢出 */
:deep(.el-tree) {
  overflow-x: hidden;
  width: 100%;
}

:deep(.el-tree-node) {
  width: 100%;
  max-width: 100%;
}

/* 响应式修复 */
@media screen and (min-width: 1200px) {
  .full-height-col:last-child {
    flex: 0 0 70.83333%; /* 对应17/24的比例 */
    max-width: 70.83333%;
  }

  .full-height-col:first-child {
    flex: 0 0 29.16667%; /* 对应7/24的比例 */
    max-width: 29.16667%;
  }
}

@media screen and (min-width: 992px) and (max-width: 1199px) {
  .full-height-col:last-child {
    flex: 0 0 66.66667%; /* 对应16/24的比例 */
    max-width: 66.66667%;
  }

  .full-height-col:first-child {
    flex: 0 0 33.33333%; /* 对应8/24的比例 */
    max-width: 33.33333%;
  }
}

@media screen and (min-width: 768px) and (max-width: 991px) {
  .full-height-col:last-child {
    flex: 0 0 58.33333%; /* 对应14/24的比例 */
    max-width: 58.33333%;
  }

  .full-height-col:first-child {
    flex: 0 0 41.66667%; /* 对应10/24的比例 */
    max-width: 41.66667%;
  }
}

/* 响应式设计 */
@media screen and (max-height: 768px) {
  .user-management-container {
    height: calc(100vh - 60px);
    padding: 8px;
  }

  .tree-scroll-container {
    min-height: 150px;
  }

  .empty-data {
    height: 150px;
  }
}

@media screen and (max-width: 1200px) {
  .header-actions {
    gap: 4px;
  }
}

@media screen and (max-width: 768px) {
  .header-actions {
    flex-wrap: wrap;
    gap: 4px;
  }

  .dept-code-checkbox {
    display: none;
  }

  .user-management-container {
    padding: 4px;
  }

  .full-height-col {
    padding: 0 4px !important;
  }

  /* 小屏幕上将布局改为上下排列 */
  .full-height-col {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  .full-height-row {
    flex-direction: column;
  }

  .full-height-col:first-child {
    height: 40%;
    margin-bottom: 8px;
  }

  .full-height-col:last-child {
    height: 60%;
  }
}

/* 确保分页组件正确显示 */
:deep(.pagination-container .el-pagination) {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
}

/* 修复搜索区域在隐藏/显示时的动画效果 */
.search-card {
  transition: all 0.3s ease;
  overflow: hidden;
}

/* 优化加载状态显示 */
:deep(.el-loading-mask) {
  z-index: 2000;
}
