/* ===================== 全局样式 ===================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f0f2f5; color: #333; min-height: 100vh;
}
a { color: #1890ff; text-decoration: none; }
a:hover { color: #40a9ff; }

/* ===================== 登录页 ===================== */
.page { display: none; }
.page.active { display: block; }

/* 全屏模糊毛玻璃背景层 */
.login-bg {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover; filter: blur(18px) saturate(1.25); transform: scale(1.12);
  z-index: 0; pointer-events: none;
}
.login-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 1; pointer-events: none;
  background: rgba(10,20,45,.28);
}
.login-container {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: transparent;
}
.login-card {
  background: rgba(255,255,255,.96); border-radius: 16px; padding: 44px 46px; width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,.9) inset;
  border: 1px solid rgba(255,255,255,.7);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo-img { height: 37px; margin-bottom: 16px; }
.login-header h1 { font-size: 24px; color: #1a237e; }
.login-header p { color: #888; margin-top: 4px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; margin-bottom: 6px; color: #555; font-weight: 500; }
.login-form input { width: 100%; padding: 12px 16px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 15px; transition: border-color 0.2s; }
.login-form input:focus { outline: none; border-color: #3949ab; }
.login-error { color: #e53935; font-size: 13px; margin-bottom: 12px; min-height: 20px; }

/* ===================== 通用组件 ===================== */
.btn {
  padding: 8px 20px; border: 1px solid #d9d9d9; background: #fff; border-radius: 6px;
  cursor: pointer; font-size: 14px; transition: all 0.2s; white-space: nowrap;
}
.btn:hover { border-color: #1890ff; color: #1890ff; }
.btn-primary { background: #1890ff; color: #fff; border-color: #1890ff; }
.btn-primary:hover { background: #40a9ff; color: #fff; }
.btn-danger { background: #ff4d4f; color: #fff; border-color: #ff4d4f; }
.btn-danger:hover { background: #ff7875; color: #fff; }
.btn-success { background: #52c41a; color: #fff; border-color: #52c41a; }
.btn-success:hover { background: #73d13d; color: #fff; }
.btn-small { padding: 4px 12px; font-size: 12px; }
.btn-full { width: 100%; padding: 12px; font-size: 16px; }

.card {
  background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s; cursor: pointer;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.section { margin-top: 24px; }
.section h3 { margin-bottom: 12px; font-size: 18px; color: #1a237e; }

.table-wrapper { overflow-x: auto; }
table {
  width: 100%; background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-collapse: collapse;
}
th { background: #fafafa; padding: 12px 16px; text-align: left; font-weight: 600; color: #555; border-bottom: 2px solid #e8e8e8; font-size: 13px; }
td { padding: 10px 16px; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
tr:hover td { background: #fafafa; }

.tag {
  display: inline-block; padding: 2px 10px; border-radius: 4px; font-size: 12px; font-weight: 500;
}
.tag-success { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tag-error { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }
.tag-info { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }
.tag-warning { background: #fffbe6; color: #faad14; border: 1px solid #ffe58f; }
.tag-blue { background: #f0f5ff; color: #2f54eb; border: 1px solid #adc6ff; }
.tag-admin { display: none; }
.tag-teacher { display: none; }

/* ===================== 顶部导航 ===================== */
.topbar {
  background: #fff; height: 56px; display: flex; align-items: center;
  padding: 0 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
}
.topbar-title { font-size: 16px; font-weight: 700; color: #1a237e; white-space: nowrap; }
.topbar-logo { height: 24px; margin-right: 10px; vertical-align: middle; }
.topbar-left { flex: 0 0 auto; margin-right: 24px; }
.topbar-center { flex: 1; overflow-x: auto; }
.topbar-right { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; }

.top-nav { display: flex; gap: 4px; }
.top-nav a {
  padding: 6px 14px; border-radius: 6px; font-size: 14px; color: #666; white-space: nowrap;
  transition: all 0.2s;
}
.top-nav a:hover { background: #f0f2f5; color: #1890ff; }
.top-nav a.active { background: #e6f7ff; color: #1890ff; font-weight: 500; }

.user-info { font-size: 14px; color: #555; }
.user-info strong { color: #1a237e; }

/* ===================== 主内容区 ===================== */
.main-content {
  margin-top: 56px; padding: 24px; max-width: 1400px; margin-left: auto; margin-right: auto;
}
.view { display: none; }
.view.active { display: block; }
.view-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
  flex-wrap: wrap; gap: 12px;
}
.view-header h2 { font-size: 22px; color: #1a237e; }
.view-header select { padding: 6px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; }

/* ===================== 首页统计 ===================== */
.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border-radius: 10px; padding: 20px; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.stat-card .num { font-size: 32px; font-weight: 700; color: #1a237e; }
.stat-card .label { font-size: 13px; color: #888; margin-top: 4px; }
.stat-card .rate { font-size: 28px; font-weight: 700; }

/* ===================== 课程卡 ===================== */
.course-card { padding: 0; overflow: hidden; }
.course-card-header {
  background: linear-gradient(135deg, #1a237e, #3949ab); color: #fff;
  padding: 20px; position: relative;
}
.course-card-header h4 { font-size: 16px; margin-bottom: 4px; }
.course-card-header .category-tag {
  position: absolute; top: 12px; right: 12px; font-size: 11px;
  background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 4px;
}
.course-card-body { padding: 16px 20px; }
.course-card-body p { color: #666; font-size: 13px; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.course-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; border-top: 1px solid #f0f0f0; font-size: 12px; color: #999;
}

/* ===================== 课时学习页 ===================== */
.lesson-content {
  background: #fff; border-radius: 10px; padding: 32px; min-height: 300px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); line-height: 1.8;
}
.lesson-content h3 { color: #1a237e; margin: 20px 0 10px; }
.lesson-content h3:first-child { margin-top: 0; }
.lesson-content ul, .lesson-content ol { padding-left: 24px; margin: 8px 0; }
.lesson-content li { margin: 4px 0; }
.lesson-content strong { color: #1a237e; }
.lesson-content .tip { background: #e6f7ff; border-left: 4px solid #1890ff; padding: 12px 16px; border-radius: 4px; margin: 16px 0; }

/* ===================== 考试 ===================== */
.exam-header {
  background: #fff; padding: 16px 24px; border-radius: 10px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 16px;
  position: sticky; top: 72px; z-index: 10;
}
#examTimer { font-size: 28px; font-weight: 700; color: #1a237e; font-family: monospace; }

.question-card {
  background: #fff; border-radius: 10px; padding: 20px; margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.question-card .q-header { margin-bottom: 12px; font-size: 13px; color: #888; }
.question-card .q-content { font-size: 15px; margin-bottom: 16px; line-height: 1.6; }
.question-card .q-options label {
  display: block; padding: 10px 16px; border: 1px solid #e8e8e8; border-radius: 8px;
  margin-bottom: 8px; cursor: pointer; transition: all 0.2s; font-size: 14px;
}
.question-card .q-options label:hover { border-color: #1890ff; background: #f0f8ff; }
.question-card .q-options input[type="radio"]:checked + span,
.question-card .q-options input[type="checkbox"]:checked + span { color: #1890ff; font-weight: 500; }
.question-card .q-options label.selected { border-color: #1890ff; background: #e6f7ff; }
.question-card .q-options input { margin-right: 8px; }

.exam-card {
  background: #fff; border-radius: 10px; padding: 20px; margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* 考试成绩 */
.result-card {
  background: #fff; border-radius: 16px; padding: 40px; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); max-width: 600px; margin: 0 auto;
}
.result-card .score-big { font-size: 72px; font-weight: 700; margin: 20px 0; }
.result-card .score-pass { color: #52c41a; }
.result-card .score-fail { color: #ff4d4f; }
.result-card .result-stats { display: flex; justify-content: center; gap: 40px; margin: 20px 0; }

/* ===================== 模式对话框 ===================== */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45); z-index: 1000;
}
.modal-overlay.show { display: block; }
.modal {
  display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: #fff; border-radius: 12px; width: 90%; max-width: 600px; max-height: 85vh;
  overflow-y: auto; z-index: 1001; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal.show { display: block; }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px; border-bottom: 1px solid #f0f0f0; position: sticky; top: 0;
  background: #fff; z-index: 1;
}
.modal-header h3 { font-size: 18px; color: #1a237e; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #999; padding: 4px 8px; border-radius: 4px; }
.modal-close:hover { background: #f0f0f0; color: #333; }
.modal-body { padding: 24px; }
.modal-body .form-group { margin-bottom: 16px; }
.modal-body label { display: block; margin-bottom: 6px; font-weight: 500; color: #555; font-size: 14px; }
.modal-body input, .modal-body select, .modal-body textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px;
  font-family: inherit;
}
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus { outline: none; border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.2); }
.modal-body textarea { min-height: 100px; resize: vertical; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }

/* ===================== 公告组件 ===================== */
.announcement-item {
  background: #fff; padding: 16px 20px; border-radius: 10px; margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.announcement-item h4 { font-size: 15px; margin-bottom: 4px; }
.announcement-item .meta { font-size: 12px; color: #999; }
.announcement-item p { margin-top: 8px; font-size: 13px; color: #666; }

/* ===================== 进度条 ===================== */
.progress-bar {
  height: 6px; background: #f0f0f0; border-radius: 3px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: linear-gradient(90deg, #1890ff, #52c41a); border-radius: 3px;
  transition: width 0.3s;
}

/* ===================== 响应式 ===================== */
.hidden { display: none !important; }

/* 角色可见性 */
body.role-admin .btn-admin { display: inline-block !important; }
body.role-admin .nav-admin { display: inline-block !important; }
body.role-teacher .btn-teacher { display: inline-block !important; }
body.role-teacher .nav-teacher { display: inline-block !important; }
body.role-teacher .nav-admin { display: inline-block !important; }
body.role-student .col-student { display: none; }

@media (max-width: 768px) {
  .topbar-center { display: none; }
  .card-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* ===================== 左侧导航（2026-08-18 重构） ===================== */
.side-nav {
  position: fixed; top: 56px; bottom: 0; left: 0; width: 210px;
  background: #fff; border-right: 1px solid #e8e8e8; padding: 14px 10px;
  overflow-y: auto; z-index: 99;
}
.side-nav .top-nav { flex-direction: column; gap: 2px; }
.side-nav .top-nav a {
  display: block; padding: 11px 14px; border-radius: 8px; font-size: 14px;
}
.side-nav .top-nav a:hover { background: #f0f2f5; color: #1890ff; }
.side-nav .top-nav a.active { background: #e6f7ff; color: #1890ff; font-weight: 600; }
.main-content { margin-top: 56px; margin-left: 210px; padding: 24px; }
@media (max-width: 768px) {
  .side-nav { width: 56px; padding: 10px 4px; }
  .side-nav .top-nav a { font-size: 0; text-align: center; padding: 12px 4px; }
  .side-nav .top-nav a::first-letter { font-size: 18px; }
  .main-content { margin-left: 56px; padding: 16px; }
}
