/* --- 全局与布局 --- */
:root {
  --primary-color: #4a69bd;
  --primary-dark: #3c5aa6;
  --dark-blue: #2c3e50;
  --background-color: #f8f9fa;
  --card-background: #ffffff;
  --font-color: #343a40;
  --sub-font-color: #6c757d;
  --border-color: #dee2e6;
  --green: #2ecc71;
  --red: #e74c3c;
  --purple: #8e44ad;
  --gold: #f1c40f;
  --yellow: #f7b500; /* 新增黄色变量 */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
}

body {
  font-family: 'Noto Sans SC', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  background-color: var(--background-color);
  color: var(--font-color);
  display: grid;
  grid-template-areas: "nav header" "nav main";
  grid-template-columns: 250px 1fr;
  grid-template-rows: 70px 1fr;
  height: 100vh;
  overflow: hidden;
}

header {
  grid-area: header;
  background: var(--card-background);
  padding: 0 30px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

nav {
  grid-area: nav;
  background: var(--dark-blue);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding-top: 20px;
}

main {
  grid-area: main;
  padding: 25px 30px;
  overflow-y: auto;
}

/* --- 导航栏 --- */
.nav-header {
  padding: 0 25px 25px 25px;
  font-size: 1.6em;
  font-weight: bold;
  text-align: center;
  color: var(--gold);
}

nav ul { list-style: none; padding: 0; margin: 0; flex-grow: 1; }
nav li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 30px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  border-left: 4px solid transparent;
  opacity: 0.8;
}
nav li:hover { background: #34495e; opacity: 1; }
nav li.active {
  background: #1f2c39;
  border-left-color: var(--gold);
  font-weight: 500;
  opacity: 1;
}
.nav-footer { padding: 20px 30px; }
.nav-footer .btn { display: block; width: 100%; text-align: center; margin-bottom: 10px; }

/* --- 顶部统计 --- */
.stats-container { display: flex; gap: 40px; }
.stat-item { display: flex; align-items: center; gap: 15px; }
.stat-item .icon {
  font-size: 1.8em; width: 50px; height: 50px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--background-color);
}
.stat-item .label { font-size: 0.9em; color: var(--sub-font-color); }
.stat-item .value { font-size: 1.5em; font-weight: bold; }

/* --- 主内容区 --- */
#main-content > div { display: none; }
#main-content > div.active { display: block; animation: fadeIn 0.5s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid var(--border-color);
}
.page-header h2 { margin: 0; font-size: 2em; }
.search-box { display: flex; align-items: center; background: var(--card-background); padding: 5px 15px; border-radius: 20px; border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }
.search-box span { margin-right: 8px; color: var(--sub-font-color); }
.search-box input { border: none; outline: none; padding: 8px 5px; background: transparent; width: 220px; font-size: 1em; }

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

/* --- 学生卡片 --- */
.student-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }
.student-card {
  background: var(--card-background);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid var(--border-color);
}
.student-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.card-header { display: flex; justify-content: space-between; align-items: center; }
.card-header .name { font-size: 1.3em; font-weight: bold; color: var(--primary-color); }
.card-header .group { font-size: 0.8em; background: #eef2f7; color: var(--primary-dark); padding: 5px 12px; border-radius: 15px; font-weight: 500; }
.card-body .label { font-size: 0.85em; color: var(--sub-font-color); }
.card-body .points { font-size: 3em; font-weight: bold; color: var(--font-color); line-height: 1; }
.card-actions { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 15px; border-top: 1px solid var(--border-color);}

.card-admin-icons {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== MODIFICATION START: Unified Icon Button Styling ===== */

/* 统一的 .icon-btn 基础样式 */
.icon-btn {
  cursor: pointer;
  font-size: 1.1em;
  padding: 6px 10px;
  border-radius: 8px;
  color: white; /* 默认文字/图标颜色为白色 */
  transition: background-color 0.2s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.icon-btn.record-btn {
  background-color: #17a2b8;
  box-shadow: 0 2px 4px rgba(23, 162, 184, 0.3);
}
.icon-btn.record-btn:hover {
  background-color: #138496;
}

.icon-btn:hover {
  transform: translateY(-1px);
}

/* 调整积分按钮 (+) */
.icon-btn.points-btn {
  background-color: #ff87af;
  box-shadow: 0 2px 4px rgba(231, 59, 208, 0.3);
}
.icon-btn.points-btn:hover {
  background-color: #f63273;
}

/* 编辑学生按钮 */
.icon-btn.edit-btn {
  background-color: #86baf0b1;
  box-shadow: 0 2px 4px rgba(247, 181, 0, 0.3);
}
.icon-btn.edit-btn:hover {
  background-color: #005bf9b1;
}

/* 删除学生按钮 (保持简洁，无背景色) */
.icon-btn.delete-btn {
  background-color: transparent;
  box-shadow: none;
  color: var(--red);
  font-size: 1.4em; /* 恢复稍大一点的字体，因为它没有背景 */
  padding: 2px; /* 减少padding */
}
.icon-btn.delete-btn:hover {
  background-color: #ec2a2ab1; /* 悬停时一个淡淡的红色背景 */
  color: #b42111;
}

/* ===== MODIFICATION END ===== */

/* --- 表格样式 --- */
.styled-table {
  width: 100%; border-collapse: collapse; background: var(--card-background);
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}
.styled-table th, .styled-table td { padding: 18px 20px; text-align: left; border-bottom: 1px solid var(--border-color); }
.styled-table th { background-color: #f8f9fa; font-weight: 600; color: var(--sub-font-color); text-transform: uppercase; font-size: 0.85em; }
.styled-table tbody tr:last-child td { border-bottom: none; }
.styled-table tbody tr:hover { background-color: #f1f3f5; }
.styled-table .actions .btn-sm { margin-right: 8px; }

/* --- 通用按钮 --- */
.btn {
  padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer;
  font-weight: 500; transition: all 0.2s ease; display: inline-flex;
  align-items: center; gap: 8px; font-size: 0.95em;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #27ae60; }
.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { background: #7d3c98; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #c0392b; }

.btn-pink { background: #ff87af; color: #fff; }
.btn-pink:hover { background: #f63273; }

.btn-sm { padding: 6px 12px; font-size: 0.85em; }
.btn-info { background: #17a2b8; color: #fff; }
.btn-info:hover { background: #138496; }

/* --- 模态框 --- */
.modal {
  display: none; position: fixed; z-index: 1000; left: 0; top: 0;
  width: 100%; height: 100%; background-color: rgba(0,0,0,0.6);
  align-items: center; justify-content: center;
}
.modal.active { display: flex; animation: fadeIn 0.3s; }
.modal-content {
  background-color: #fff; padding: 30px; border: none;
  width: 90%; max-width: 500px; border-radius: 12px;
  box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease-out;
}
@keyframes slideIn { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border-color); padding-bottom: 15px; margin-bottom: 25px;
}
.modal-header h2 { margin: 0; font-size: 1.5em; }
.close-btn { color: #aaa; font-size: 28px; font-weight: bold; cursor: pointer; transition: color 0.2s; }
.close-btn:hover { color: #333; }
form label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--sub-font-color); }
form input, form select {
  width: 100%; padding: 12px; margin-bottom: 20px;
  border: 1px solid var(--border-color); border-radius: 8px;
  font-size: 1em; transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
form input:focus, form select:focus {
  outline: none; border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.2);
}
.form-actions { text-align: right; margin-top: 10px; }

/* --- 奖品商城样式 --- */
.rewards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 25px;
}
.reward-card {
  background: var(--card-background);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid var(--border-color);
}
.reward-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.reward-card .name { font-size: 1.2em; font-weight: bold; margin-bottom: 10px; }
.reward-card .cost { font-size: 2em; font-weight: bold; color: var(--primary-color); margin-bottom: 20px; }
.reward-card .cost::after { content: ' 积分'; font-size: 0.5em; font-weight: normal; color: var(--sub-font-color); }
.reward-card .actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.reward-card .actions .btn { width: 100%; justify-content: center; }
.reward-card .admin-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 15px; border-top: 1px solid var(--border-color); padding-top: 10px; }

.styled-table td.actions {
  display: flex;
  gap: 8px; /* 给按钮之间增加一些间距 */
}
.styled-table .actions .btn-sm { 
    margin-right: 0; /* 移除旧的 margin，因为我们用了 gap */
}



/* 兑换模态框信息样式 */
.redeem-info {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}
.redeem-info p { margin: 5px 0; font-size: 1.1em; }

/* --- 仪表盘布局 --- */
.dashboard-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 25px;
  align-items: start;
}
.student-cards-grid-wrapper { min-width: 0; }

/* --- 排行榜样式  --- */
.leaderboard-container {
  background: var(--card-background);
  border-radius: 12px;
  padding: 20px 25px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.leaderboard-container h3 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.4em;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
}

/* --- 修改点: 同时选中两个排行榜的 ol 元素 --- */
#leaderboard-list,
#group-leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* --- 修改点: 同时选中两个排行榜的 li 元素 --- */
#leaderboard-list li,
#group-leaderboard-list li {
  display: flex;
  align-items: center;
  gap: 15px; /* 设置列之间的统一间距 */
  padding: 12px 0;
  border-bottom: 1px solid #f1f3f5;
  font-size: 1.05em;
}

/* --- 修改点: 同时选中两个排行榜的最后一个 li 元素 --- */
#leaderboard-list li:last-child,
#group-leaderboard-list li:last-child {
  border-bottom: none;
}

/* --- 修改点: 同时选中两个排行榜的 .rank 元素 --- */
#leaderboard-list .rank,
#group-leaderboard-list .rank {
  flex-shrink: 0; /* 防止被压缩 */
  font-weight: bold;
  font-size: 1.1em;
  color: var(--sub-font-color);
  width: 30px; /* 固定宽度 */
  text-align: right;
}

/* --- 修改点: 同时选中两个排行榜的 .name 元素 --- */
#leaderboard-list .name,
#group-leaderboard-list .name {
  flex-grow: 1; /* 关键！让名字占据所有剩余空间，将积分推到最右边 */
  font-weight: 500;
  white-space: nowrap; /* 防止名字换行 */
  overflow: hidden; /* 超出部分隐藏 */
  text-overflow: ellipsis; /* 超出部分显示... */
}

/* --- 修改点: 同时选中两个排行榜的 .points 元素 --- */
#leaderboard-list .points,
#group-leaderboard-list .points {
  flex-shrink: 0; /* 防止被压缩 */
  font-weight: bold;
  color: var(--primary-color);
}

/* --- 修改点: 同时为两个排行榜的前三名 .rank 添加特殊颜色 --- */
#leaderboard-list li:nth-child(1) .rank, #group-leaderboard-list li:nth-child(1) .rank { color: var(--gold); }
#leaderboard-list li:nth-child(2) .rank, #group-leaderboard-list li:nth-child(2) .rank { color: #a1a7ac; } /* 银色 */
#leaderboard-list li:nth-child(3) .rank, #group-leaderboard-list li:nth-child(3) .rank { color: #cd7f32; } /* 铜色 */

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

/* In style.css */

/* --- 表格排序功能样式 (新增) --- */
.styled-table th.sortable {
  cursor: pointer;
  position: relative; /* 用于定位箭头 */
  user-select: none; /* 防止点击时选中文本 */
  transition: background-color 0.2s ease;
}

.styled-table th.sortable:hover {
  background-color: #e9ecef; /* 鼠标悬停时的背景色 */
}

/* 排序指示器 (箭头) 的样式 */
.styled-table th.sortable span {
  position: absolute;
  right: 15px; /* 箭头距离右侧的距离 */
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1em;
  color: var(--sub-font-color);
  opacity: 0.5;
}

/* 当前排序列的样式 */
.styled-table th.sortable.sorted-asc,
.styled-table th.sortable.sorted-desc {
  color: var(--primary-color); /* 高亮当前排序列的文字颜色 */
}

.styled-table th.sortable.sorted-asc span,
.styled-table th.sortable.sorted-desc span {
  opacity: 1; /* 只显示当前排序列的箭头 */
}

/* In style.css */

/* --- 排行榜头部与切换按钮样式 (新增) --- */
.leaderboard-header {
  /* 移除 flex 布局相关属性 */
  text-align: center; /* 让标题文本居中 */
  margin-bottom: 15px; /* 调整与下方按钮的间距 */
  padding-bottom: 20px;
  border-bottom: 1px solid #e9ecef; 
}

.leaderboard-header h3 {
  margin: 0;
  font-size: 1.4em;
  /* 移除了 text-align, border-bottom, padding-bottom，因为它们现在由父容器处理 */
}

/* 切换按钮容器：设计成一个完整的分段控件 */
.leaderboard-toggle {
  display: flex;
  justify-content: center; /* 让按钮组在容器内居中 */
  background-color: #f1f3f5;
  border-radius: 9px;
  padding: 5px;
  border: 1px solid var(--border-color);
  width: fit-content; /* 宽度自适应内容 */
  margin: 0 auto 20px auto; /* 关键：上下边距20px，左右自动居中 */
}

.toggle-btn {
  border: none;
  background-color: transparent;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 500;
  color: var(--sub-font-color);
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background-color: var(--card-background);
  color: var(--primary-color);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* In style.css */

/* --- 幸运大转盘样式 (新增) --- */
.turntable-main-layout {
  display: grid;
  /* --- ↓↓↓ 修改点 ↓↓↓ --- */
  /* 将原来的固定宽度改为比例宽度，让左栏占据2份空间，右栏占据1份 */
  grid-template-columns: 2fr 1fr; 
  gap: 30px;
  align-items: start;
}

.turntable-wrapper {
  position: relative;
  /* --- ↓↓↓ 修改点 ↓↓↓ --- */
  /* 将包装器的尺寸与新的canvas尺寸保持一致 */
  width: 650px;
  height: 650px;
  margin: 0 auto;
}

#turntable-canvas {
  width: 100%;
  height: 100%;
}

.turntable-pointer {
  position: absolute;
  /* 将指针定位在父容器的顶部中心 */
  top: -15px; /* 向上移动一点，让指针尖端正好指向转盘边缘 */
  left: 50%;
  transform: translateX(-50%); /* 仅水平居中，不再垂直移动 */
  
  /* 使用 border 创建一个向下的三角形 */
  width: 0;
  height: 0;
  border-left: 25px solid transparent;
  border-right: 25px solid transparent;
  border-top: 40px solid var(--red); /* 使用 border-top 来创建一个指向下方的三角形 */

  z-index: 10;
  filter: drop-shadow(0 4px 5px rgba(0,0,0,0.3)); /* 增加一点阴影使其更立体 */
}

/* 我们可以顺便让开始按钮更有质感 */
.btn-spin {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border-radius: 50%;
  font-size: 1.2em;
  font-weight: bold;
  z-index: 11; /* 确保在指针之上 */
  padding: 0;
  justify-content: center;
  border: 5px solid white; /* 添加白色边框 */
  box-shadow: 0 5px 10px rgba(0,0,0,0.2); /* 添加阴影 */
}

.turntable-controls {
  background: var(--card-background);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.turntable-setting {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.turntable-setting label {
  font-weight: 500;
  margin-bottom: 0;
}

#turntable-cost-input {
  width: 80px;
  margin-bottom: 0;
}

.btn-spin:hover {
  /* 关键：同时应用“居中”和“上移”两个 transform 效果 */
  transform: translate(-50%, -50%) translateY(-2px);
  
  /* 我顺便优化了一下阴影，让它浮起来的效果更明显 */
  box-shadow: 0 8px 15px rgba(0,0,0,0.25);
}

/* --- 新增：UI反馈系统样式 --- */

/* 通知 (Toast) 容器 */
#notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 单个通知的样式 */
.notification {
  padding: 15px 20px;
  border-radius: 8px;
  color: #fff;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInFromRight 0.5s ease-out forwards;
  opacity: 0;
}

.notification.fade-out {
  animation: slideOutToRight 0.5s ease-in forwards;
}

/* 成功和错误状态的颜色 */
.notification.success {
  background-color: var(--green);
}
.notification.error {
  background-color: var(--red);
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutToRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* 确认对话框的按钮间距 */
#confirm-modal .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}


/* --- 批量修改小组成员弹窗样式 (优化版) --- */
.student-selection-container {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 25px;
}

.student-list-box {
  width: 48%;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  height: 300px; /* 增加了高度以容纳更多内容 */
  overflow-y: auto; /* 关键：当内容超出高度时，自动显示垂直滚动条 */
  background-color: #f8f9fa;
}

.student-list-box strong {
  display: block;
  text-align: center;
  margin-bottom: 15px;
  font-weight: 600;
  color: var(--dark-blue);
  font-size: 1.1em;
}

.student-list-box ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
  /* 关键：将列表拆分成两列 */
  column-count: 2;
  column-gap: 15px;
}

.student-list-box li {
  padding: 8px 12px;
  margin-bottom: 6px;
  background-color: var(--card-background);
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  border: 1px solid var(--border-color);
  font-weight: 500;
  /* 防止列表项跨列断开 */
  break-inside: avoid;
  page-break-inside: avoid;
}

.student-list-box li:hover {
  background-color: var(--primary-color);
  color: white;
}


/* --- 打印中心视图样式 --- */
.print-options-container {
  display: grid;
  grid-template-columns: 1fr 1fr; /* 两列布局 */
  gap: 30px;
}

.print-option-card {
  background: var(--card-background);
  border-radius: 12px;
  padding: 25px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.print-option-card h3 {
  margin-top: 0;
  font-size: 1.4em;
  color: var(--primary-color);
}

.print-option-card p {
  flex-grow: 1; /* 让p标签占据多余空间，使按钮对齐到底部 */
  color: var(--sub-font-color);
  line-height: 1.6;
}

.print-selection {
  display: flex;
  gap: 15px;
  align-items: center;
}

.print-selection select {
  flex-grow: 1;
  margin-bottom: 0;
}

/* --- 成就系统样式 --- */
.name-line {
  display: flex;
  align-items: center;
  gap: 8px; /* 名字和头衔之间的间距 */
  flex-wrap: wrap; /* 如果空间不足，允许换行 */
}

.achievement-title {
  padding: 3px 10px;
  border-radius: 12px; /* 圆角胶囊形状 */
  font-size: 0.8em; /* 字体小一点 */
  font-weight: 600; /* 字体加粗 */
  color: #fff; /* 文字统一为白色 */
  text-shadow: 0 1px 2px rgba(0,0,0,0.2); /* 文字轻微阴影，增加质感 */
  box-shadow: inset 0 -2px 1px rgba(0,0,0,0.15); /* 内部阴影，增加立体感 */
}

/* --- 不同等级头衔的专属颜色 --- */
.achievement-title[data-tier="积分新秀"] {
  background: linear-gradient(135deg, #2ecc71, #28b463); /* 绿色系 */
}
.achievement-title[data-tier="积分达人"] {
  background: linear-gradient(135deg, #3498db, #2980b9); /* 蓝色系 */
}
.achievement-title[data-tier="积分大师"] {
  background: linear-gradient(135deg, #9b59b6, #8e44ad); /* 紫色系 */
}
.achievement-title[data-tier="积分王者"] {
  background: linear-gradient(135deg, #f39c12, #e67e22); /* 橙色/金色系 */
}
.achievement-title[data-tier="积分战神"] {
  background: linear-gradient(135deg, #e74c3c, #c0392b, #d35400); /* 红色/传说色系 */
  animation: shimmer 2s infinite; /* 为最高等级增加闪光动画 */
}

/* 闪光动画 */
@keyframes shimmer {
  0% { opacity: 0.8; }
  50% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0.8; }
}

/* --- 酷炫升级：卡片辉光效果 --- */
.student-card {
  /* 为辉光效果增加平滑过渡 */
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.student-card.tier-rookie:hover { box-shadow: 0 0 20px rgba(46, 204, 113, 0.5); }
.student-card.tier-expert:hover { box-shadow: 0 0 20px rgba(52, 152, 219, 0.5); }
.student-card.tier-master:hover { box-shadow: 0 0 20px rgba(155, 89, 182, 0.5); }
.student-card.tier-king:hover { box-shadow: 0 0 20px rgba(243, 156, 18, 0.6); }
.student-card.tier-god:hover { box-shadow: 0 0 25px rgba(231, 76, 60, 0.7); }


/* --- 酷炫升级：“积分战神”徽章进化 --- */
.achievement-title[data-tier="积分战神"] {
  /* 移除旧动画，使用新的背景动画 */
  animation: none; 
  background: linear-gradient(
    -45deg, 
    #ff0000, 
    #ff7300, 
    #fffb00, 
    #48ff00, 
    #00ffd5, 
    #002bff, 
    #7a00ff, 
    #ff00c8, 
    #ff0000
  );
  background-size: 400% 400%; /* 关键：背景尺寸远大于元素 */
  animation: gradient-flow 3s ease infinite; /* 应用新的流动动画 */
  border: 1px solid rgba(255,255,255,0.3);
}

/* 定义流光背景动画 */
@keyframes gradient-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 移除旧的 shimmer 动画（如果存在） */
@keyframes shimmer { /* 可以安全地保留或删除此段 */ }


/* --- 酷炫升级：晋升（Level Up）动画 --- */
.level-up-fx {
  /* 应用动画：名称、时长、缓动函数 */
  animation: level-up-glow 1.5s ease-out;
}

@keyframes level-up-glow {
  0% {
    transform: scale(1);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
  }
  25% {
    transform: scale(1.08); /* 放大卡片 */
    box-shadow: 0 0 30px rgba(253, 222, 5, 0.9),  /* 强烈的金色辉光 */
                inset 0 0 15px rgba(255, 230, 112, 0.8); /* 内部发光 */
  }
  100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); /* 恢复正常阴影 */
  }
}


/* --- 班级概览排序按钮样式 --- */
.sort-controls {
  display: flex;
  gap: 10px;
  margin: 0 15px; /* 与其他按钮保持一些间距 */
}

.sort-btn {
  background-color: #f8f9fa; /* 默认浅灰色背景 */
  color: var(--sub-font-color);
  padding: 8px 15px;
  border: 1px solid var(--border-color);
}

.sort-btn:hover {
  background-color: #e9ecef;
  border-color: #ced4da;
}

/* 激活状态的按钮 */
.sort-btn.active {
  background-color: var(--primary-color);
  color: #fff;
  border-color: var(--primary-dark);
}

.sort-indicator {
  display: inline-block;
  width: 1em; /* 保证按钮宽度不会因有无箭头而跳动 */
  margin-left: 6px;
  font-weight: bold;
}


/* ========== 在 style.css 文件末尾添加以下代码 ========== */

/* --- 批量选择学生复选框容器样式 --- */
.student-checkbox-container {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  background-color: #f8f9fa;
  display: grid;
  /* 自动填充列，每列最小150px */
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.student-checkbox-container .checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--card-background);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.student-checkbox-container .checkbox-item:hover {
    background-color: #eef2f7;
}

/* 让复选框本身恢复正常大小 */
.student-checkbox-container .checkbox-item input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* 让学生姓名标签充满整个项目，方便点击 */
.student-checkbox-container .checkbox-item label {
  margin-bottom: 0;
  font-weight: normal;
  color: var(--font-color);
  width: 100%;
  cursor: pointer;
}
/* ==================================================== */


/* --- 导出选择模态框样式 --- */
.export-choices {
  display: flex;
  flex-direction: column; /* 垂直排列 */
  gap: 15px; /* 按钮之间的间距 */
  margin-top: 20px;
}

.export-choices .btn {
  width: 100%; /* 按钮宽度占满 */
  justify-content: center; /* 按钮内容居中 */
  padding: 12px;
  font-size: 1em;
}


/* 在 style.css 文件末尾添加 */
/* --- 积分记录撤回样式 --- */
#record-table tbody tr.record-undone {
  background-color: #f8f9fa;
  color: #adb5bd;
  text-decoration: line-through; /* 添加删除线 */
}

#record-table tbody tr.record-undone:hover {
  background-color: #f1f3f5;
}


.group-management-layout {
  display: grid;
  grid-template-columns: 2fr 1fr; /* 表格占2/3，排行榜占1/3 */
  gap: 30px;
  align-items: start;
}