/* ============================================================
   会东中学高中部 - 学情管理系统
   样式表 (styles.css)
   ============================================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-bg: #eff6ff;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-width: 240px;
  --header-height: 60px;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.6;
}

/* === 登录页 === */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 420px;
  max-width: 90vw;
  overflow: hidden;
}
.login-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #fff;
  padding: 32px 40px;
  text-align: center;
}
.login-header h1 { font-size: 22px; margin-bottom: 6px; }
.login-header p { font-size: 13px; opacity: .85; }
.login-body { padding: 32px 40px; }
.login-body .form-group { margin-bottom: 18px; }
.login-body label { display: block; font-size: 13px; color: var(--gray-600); margin-bottom: 6px; font-weight: 500; }
.login-body input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--gray-300);
  border-radius: var(--radius); font-size: 14px; transition: border-color .2s;
}
.login-body input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.login-roles {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px;
}
.role-chip {
  padding: 8px 4px; text-align: center; border: 1px solid var(--gray-300);
  border-radius: var(--radius); cursor: pointer; font-size: 12px; transition: all .2s;
  background: #fff;
}
.role-chip:hover { border-color: var(--primary); background: var(--primary-bg); }
.role-chip.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.btn-login {
  width: 100%; padding: 12px; background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .2s;
}
.btn-login:hover { background: var(--primary-dark); }
.login-hint { text-align: center; margin-top: 16px; font-size: 12px; color: var(--gray-400); }
.login-online-badge {
  display: inline-block; margin-top: 10px; padding: 3px 10px;
  font-size: 12px; border-radius: 20px; color: #0F6E56;
  background: #E1F5EE; border: 1px solid #5DCAA5;
}
.login-online-badge.offline { color: #5F5E5A; background: #F1EFE8; border-color: #D3D1C7; }
.online-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #1D9E75;
  display: inline-block; margin-right: 12px; align-self: center;
}

/* === 主布局 === */
.app-layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-width);
  background: var(--gray-900);
  color: var(--gray-300);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-header h2 { font-size: 16px; color: #fff; }
.sidebar-header p { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-group { margin-bottom: 8px; }
.nav-group-title {
  padding: 8px 20px 4px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--gray-500);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; cursor: pointer; transition: all .2s;
  font-size: 13px; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: rgba(37,99,235,.15); color: #fff; border-left-color: var(--primary); }
.nav-item .nav-icon { width: 18px; text-align: center; font-size: 15px; }
.sidebar-footer {
  padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 11px; color: var(--gray-500);
}

/* 主内容区 */
.main-area {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--gray-800); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.user-info { font-size: 13px; }
.user-info .name { font-weight: 600; color: var(--gray-800); }
.user-info .role { font-size: 11px; color: var(--gray-500); }
.btn-logout {
  padding: 6px 14px; border: 1px solid var(--gray-300); background: #fff;
  border-radius: var(--radius); cursor: pointer; font-size: 12px; color: var(--gray-600);
  transition: all .2s;
}
.btn-logout:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.content-area { flex: 1; padding: 24px; }

/* === 通用组件 === */
.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 20px;
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; color: var(--gray-800); }
.card-body { padding: 20px; }

.btn {
  padding: 8px 16px; border: none; border-radius: var(--radius);
  cursor: pointer; font-size: 13px; font-weight: 500; transition: all .2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--gray-600); margin-bottom: 6px; font-weight: 500; }
.form-control {
  width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300);
  border-radius: var(--radius); font-size: 13px; transition: border-color .2s;
  background: #fff;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
select.form-control { cursor: pointer; }

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* === 表格 === */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--gray-50); padding: 10px 12px; text-align: left;
  font-weight: 600; color: var(--gray-600); border-bottom: 2px solid var(--gray-200);
  white-space: nowrap; position: sticky; top: 0;
}
.data-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table .text-right { text-align: right; }
.data-table .text-center { text-align: center; }

/* === 统计卡片 === */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; display: flex; align-items: flex-start; gap: 16px;
  transition: transform .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: #f3e8ff; color: #7c3aed; }
.stat-info .stat-value { font-size: 28px; font-weight: 700; color: var(--gray-800); line-height: 1.2; }
.stat-info .stat-label { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.stat-info .stat-sub { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* === 预警标签 === */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 4px; font-size: 11px; font-weight: 600;
}
.badge-green { background: var(--success-light); color: var(--success); }
.badge-yellow { background: var(--warning-light); color: #92400e; }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }

/* === 提示条 === */
.alert {
  padding: 10px 14px; border-radius: 8px; font-size: 13px; line-height: 1.6;
}
.alert-warning {
  background: var(--warning-light); color: #92400e; border: 1px solid #fde68a;
}
.alert-info {
  background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe;
}

.warning-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 4px;
}
.warning-dot.green { background: var(--success); }
.warning-dot.yellow { background: var(--warning); }
.warning-dot.red { background: var(--danger); }

/* === 筛选栏 === */
.filter-bar {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
  align-items: flex-end;
}
.filter-bar .form-group { margin-bottom: 0; min-width: 140px; }
.filter-bar .form-group label { font-size: 11px; }

/* === Tab === */
.tabs {
  display: flex; gap: 2px; border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 20px; cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--gray-500); border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all .2s;
}
.tab:hover { color: var(--gray-800); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* === 进度条 === */
.progress-bar {
  height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden;
}
.progress-bar .fill { height: 100%; transition: width .3s; border-radius: 4px; }
.progress-bar .fill.green { background: var(--success); }
.progress-bar .fill.yellow { background: var(--warning); }
.progress-bar .fill.red { background: var(--danger); }

/* === 模态框 === */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal {
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg);
  width: 600px; max-width: 90vw; max-height: 85vh; display: flex;
  flex-direction: column;
}
.modal.modal-lg { width: 900px; }
.modal.modal-xl { width: 1200px; }
.modal-header {
  padding: 16px 24px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-400); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* === 学生画像 === */
.profile-card {
  display: flex; gap: 24px; align-items: flex-start;
}
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.profile-info h4 { font-size: 20px; margin-bottom: 4px; }
.profile-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.profile-meta-item { font-size: 13px; color: var(--gray-600); }
.profile-meta-item span { color: var(--gray-800); font-weight: 500; }

/* === 图表容器 === */
.chart-container { position: relative; height: 300px; padding: 16px; }
.chart-container.chart-sm { height: 220px; }
.chart-container.chart-lg { height: 400px; }

/* === 空状态 === */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--gray-400);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* === 响应式 === */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-area { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
}

/* === 工具类 === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 12px; }
.text-lg { font-size: 16px; }
.font-bold { font-weight: 600; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }
.flex-wrap { flex-wrap: wrap; }

/* 导入区域 */
.import-zone {
  border: 2px dashed var(--gray-300); border-radius: var(--radius);
  padding: 40px; text-align: center; cursor: pointer; transition: all .2s;
}
.import-zone:hover { border-color: var(--primary); background: var(--primary-bg); }
.import-zone .import-icon { font-size: 36px; color: var(--gray-400); margin-bottom: 12px; }

/* 表格容器 */
.table-wrap { overflow-x: auto; max-height: 600px; overflow-y: auto; }
.table-wrap .data-table th { position: sticky; top: 0; z-index: 10; }

/* 名次变化指示 */
.rank-up { color: var(--danger); font-weight: 600; } /* 红色=上升=进步 (中国习惯) */
.rank-down { color: var(--success); font-weight: 600; } /* 绿色=下降=退步 */
.rank-flat { color: var(--gray-400); }

/* 整改措施文本 */
.measure-text {
  font-size: 12px; color: var(--gray-600); max-width: 200px;
  white-space: pre-wrap; word-break: break-all;
}
.measure-text.empty { color: var(--gray-300); font-style: italic; }

/* 面包屑 */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-500); margin-bottom: 16px; }
.breadcrumb a { color: var(--primary); cursor: pointer; }
.breadcrumb a:hover { text-decoration: underline; }

/* 搜索框 */
.search-box {
  position: relative; width: 260px;
}
.search-box input {
  width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--gray-300);
  border-radius: var(--radius); font-size: 13px;
}
.search-box::before {
  content: '🔍'; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: 13px; opacity: .5;
}

/* === 批量操作 === */
.data-table .col-check {
  width: 40px; text-align: center; white-space: nowrap;
}
.data-table .col-check input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer; vertical-align: middle;
}
.data-table th.col-check input[type="checkbox"] {
  width: 16px; height: 16px;
}
.batch-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--danger-light);
  border: 1px solid #fca5a5; border-radius: var(--radius);
  margin-bottom: 16px; font-size: 13px; color: var(--danger);
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.batch-toolbar .batch-count { font-weight: 700; }
.batch-toolbar .btn { margin-left: auto; }
.batch-toolbar .btn-clear { margin-left: 0; color: var(--gray-600); }
