/* 全局样式 */
:root {
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
  --border-radius: 8px;
  --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --sidebar-bg: var(--dark-color);
  --sidebar-header-bg: rgba(255, 255, 255, 0.1);
  --sidebar-link-hover: rgba(255, 255, 255, 0.1);
  --top-nav-bg: white;
  --top-nav-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --main-content-bg: #f1f3f5;
  --card-bg: white;
  --card-header-bg: white;
  --table-header-bg: #f8f9fa;
  --modal-header-bg: var(--primary-color);
  --modal-header-color: white;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  color: var(--dark-color);
  background-color: var(--light-color);
}

/* 小屏幕上整体文字稍微缩小，避免挤压 */
@media (max-width: 992px) {
  body {
    font-size: 16px;
  }
}

/* 侧边栏样式 */
.sidebar {
  width: 300px;
  background: var(--sidebar-bg);
  color: white;
  min-height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1001;
  transition: all 0.3s ease;
  overflow-y: auto;
}

.sidebar.collapsed {
  width: 0;
  overflow: hidden;
}

/* 中等屏幕时侧边栏稍微变窄，给内容更多空间 */
@media (max-width: 1200px) {
  .sidebar {
    width: 260px;
  }
  .main-content {
    margin-left: 260px;
  }
}

@media (max-width: 992px) {
  .sidebar {
    width: 230px;
  }
  .main-content {
    margin-left: 230px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
}

.sidebar-header {
  padding: 2.5rem;
  background: var(--sidebar-header-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 1.25rem;
  font-weight: 600;
  min-height: 83px;
  display: flex;
  align-items: center;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
}

.sidebar-menu li {
  margin: 0;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  padding: 1.8rem 2.5rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 5px solid transparent;
  font-size: 1.3rem; /* 调大字体大小 */
  gap: 1.5rem; /* 增加图标和文字之间的间距 */
}

.sidebar-menu a i {
  font-size: 1.4rem; /* 调大图标大小 */
  width: 35px; /* 增加图标宽度，使其更突出 */
  text-align: center;
}

.sidebar-menu a:hover {
  background: var(--sidebar-link-hover);
  color: white;
  border-left-color: var(--primary-color);
}

.sidebar-menu a.active {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-left-color: var(--primary-color);
}

/* 主内容区域样式 */
.main-content {
  margin-left: 300px;
  flex: 1;
  background: var(--main-content-bg);
  min-height: 100vh;
  transition: all 0.3s ease;
}

.main-content.expanded {
  margin-left: 0;
}

@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
  }
}

/* 顶部导航栏样式 */
.top-nav {
  background: var(--top-nav-bg);
  padding: 2rem 2rem;
  box-shadow: var(--top-nav-shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 999;
  min-height: 83px;
}

/* 侧边栏遮罩层 - 移动端 */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  cursor: pointer;
}

.sidebar-overlay.active {
  display: block;
}

@media (max-width: 768px) {
  .sidebar-overlay {
    display: none;
  }
  
  .sidebar-overlay.active {
    display: block;
  }
}

/* 年份选择器特定样式 */
#yearSelect {
  font-size: 1.25rem;
  padding: 0.625rem 1rem;
  width: 130px;
  line-height: 1.4;
}

/* 增大Chrome和Safari中的上下箭头 */
#yearSelect::-webkit-inner-spin-button,
#yearSelect::-webkit-outer-spin-button {
  height: 35px !important;
  width: 28px !important;
  transform: scale(1.2);
  opacity: 1 !important;
}

/* 加载动画 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0, 123, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 图表容器样式 */
.chart-container {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
  height: 400px;
  position: relative;
}

.chart-container canvas {
  position: absolute;
  top: 2rem;
  left: 0;
  width: 100% !important;
  height: calc(100% - 2rem) !important;
}

/* 仪表盘样式 */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* 仪表盘卡片栅格在不同屏幕宽度下自适应列数 */
@media (max-width: 1200px) {
  .dashboard-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 992px) {
  .dashboard-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-cards {
    grid-template-columns: 1fr;
  }
}

.dashboard-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.dashboard-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.dashboard-card .icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.dashboard-card .number {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--dark-color);
}

.dashboard-card .label {
  color: var(--secondary-color);
  font-size: 0.9rem;
}

/* 卡片样式 */
.card {
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  margin-bottom: 1.5rem;
  background: white;
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e9ecef;
  font-weight: 600;
  font-size: 1.2rem;
}

.card-body {
  padding: 1.5rem;
  background: white;
}

/* 表格样式 */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

/* 窗口变窄时表格字体和单元格内边距收缩，配合 bootstrap 的 .table-responsive 一起适配 */
@media (max-width: 992px) {
  .table {
    font-size: 0.9rem;
  }
  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
  }
}

/* 手机端优化：更紧凑的布局和间距 */
@media (max-width: 576px) {
  .top-nav {
    padding: 0.75rem 0.75rem;
  }

  .sidebar-header {
    padding: 1.5rem;
  }

  .sidebar-menu a {
    padding: 1.2rem 1.5rem;
    font-size: 1.05rem;
    gap: 1rem;
  }

  .sidebar-menu a i {
    font-size: 1.2rem;
    width: 28px;
  }

  .container-fluid {
    padding: 0 0.75rem;
  }

  .card-header,
  .card-body {
    padding: 1rem;
  }

  .dashboard-card {
    padding: 1.1rem;
  }

  .dashboard-card .number {
    font-size: 1.6rem;
  }

  .table {
    font-size: 0.8rem;
  }

  .table th,
  .table td {
    padding: 0.5rem 0.35rem;
  }
}

.table th,
.table td {
  padding: 1.25rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
}

.table th {
  background: #f8f9fa;
  font-weight: 600;
  color: var(--dark-color);
}

/* 内容容器样式 */
.container-fluid {
  padding: 0 2rem;
  max-width: 100%;
}

@media (max-width: 768px) {
  .container-fluid {
    padding: 0 1rem;
  }
}

/* 分页样式 */
nav.pagination {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

nav.pagination ul.pagination {
  display: flex;
  gap: 0.5rem;
}

/* 搜索框样式 */
.search-box {
  position: relative;
  display: inline-block;
}

.search-box input.form-control {
  padding-right: 30px;
}

.search-box .search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
  pointer-events: none;
}

/* 待培训提醒动画 */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
  20%, 40%, 60%, 80% { transform: translateX(8px); }
}

.shake {
  animation: shake 1.5s ease-in-out infinite;
}

/* 待培训图标样式 - 默认颜色 */
#untrainedEmployeesCard .icon i {
}

/* 待培训图标样式 - 有待培训人员时 */
#untrainedEmployeesCard .icon i.has-untrained {
  color: #dc3545;
}
