/* ========== 全局字体和背景 ========== */
body {
  background-color: var(--bg-color, #f0f4f8);
  color: var(--text-color, #212529);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========== 卡片样式 ========== */
.card {
  background-color: var(--card-bg, white);
  border-color: var(--card-border, #dee2e6);
  border-radius: 1rem;
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

/* ========== 动画 ========== */
.animate-fadein {
  animation: fadein 0.8s ease-in-out;
}
@keyframes fadein {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: none; }
}

/* ========== 悬停缩放按钮/卡片 ========== */
.hover-scale:hover {
  transform: scale(1.05);
  transition: all 0.3s ease;
}

/* ========== 积分数字样式 ========== */
.score-highlight {
  color: #007bff;
  font-weight: bold;
  font-size: 1.2rem;
}

/* ========== 卡片网格 ========== */
.card-grid .card {
  min-height: 120px;
  text-align: center;
  padding-top: 20px;
}

/* ========== Loading 背景 ========== */
#loading {
  background: linear-gradient(to bottom, #ffffff, #f0f4f8);
}

/* ========== 表单增强样式 ========== */
input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  transition: border-color 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 0.1rem rgba(0, 123, 255, 0.25);
}

/* ========== 响应式文本截断（用于评论预览） ========== */
.text-truncate-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ========== 深色模式覆盖（冗余保障） ========== */
body.dark-mode .card {
  background-color: #1e1e1e;
  color: #f8f9fa;
}
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background-color: #2a2a2a;
  color: #f8f9fa;
  border-color: #444;
}
body.dark-mode .table {
  color: #f8f9fa;
}
body.theme-gradient {
  background: linear-gradient(to bottom right, #6a11cb, #2575fc);
  color: #fff;
}

body.theme-gradient .card {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

body.theme-gradient .navbar,
body.theme-gradient footer {
  background-color: rgba(0, 0, 0, 0.2) !important;
  color: #fff !important;
}

body.theme-gradient a {
  color: #a8d1ff;
}
/* ✅ 深色模式下 footer 字体颜色增强 */
body.dark-mode footer {
  background-color: #1e1e1e;
  color: #e0e0e0;
}
body.dark-mode footer a {
  color: #90caf9;
}
body.dark-mode .btn-primary {
  background-color: #1976d2;
  border-color: #1976d2;
}
body.dark-mode .btn-success {
  background-color: #2e7d32;
  border-color: #2e7d32;
}
body.dark-mode .btn:hover {
  filter: brightness(1.1);
}
/* ✅ 深色模式下统一所有文本颜色为浅色 */
body.dark-mode,
body.dark-mode p,
body.dark-mode span,
body.dark-mode div,
body.dark-mode a,
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6,
body.dark-mode label,
body.dark-mode button {
  color: #f1f1f1 !important;
}

/* ✅ 防止链接颜色太深 */
body.dark-mode a {
  color: #90caf9 !important;
}
body.dark-mode footer {
  background-color: #1e1e1e;
  color: #aaa;
}
body.dark-mode footer a {
  color: #90caf9;
}
body.dark-mode .navbar {
  background-color: #1e1e1e !important;
  color: #f0f0f0;
  border-color: #333;
}
body.dark-mode .navbar a,
body.dark-mode .navbar .text-muted {
  color: #f8f9fa !important;
}
.btn:hover {
  filter: brightness(1.1);
  transition: filter 0.3s ease;
}
.card {
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
