/* ==========================================================================
   global-polish.css — 旧页面（未套用 .pretty-page 的页面）统一视觉提升层
   设计原则：
   - 仅增强既有共享类（.card / .page-header / .data-table / .btn / .stats-grid 等），
     不新增类，因此「所有旧页面」零改动即可整体变好看。
   - 强调色统一走 var(--primary)，而 --primary 已被 subject.css 按学科覆盖，
     所以这里所有高亮都会自动带上学科色。
   - 不触碰 .pp-* 类，避免与已美化的 pretty 页冲突。
   ========================================================================== */

/* 页头：卡片化 + 学科图标（由 base.html 的脚本自动把 .page-header 拆成
   .ph-icon + .ph-text + .page-actions，无需逐个模板改，所有旧页面零成本美化） */
.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    margin-bottom: 22px;
    background: linear-gradient(120deg, var(--primary-light, #f5f8ff), #fff 72%);
    border: 1px solid var(--gray-200);
    border-left: 5px solid var(--primary);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 18px rgba(16,24,40,.06);
}
.page-header::before { display: none; }  /* 旧竖条不再需要，已由 .ph-icon 替代 */
body[data-subject] .ph-icon::before { content: var(--subj-icon); }
.page-header .ph-icon {
    flex: none;
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    font-size: 27px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(16,24,40,.10);
}
.page-header .ph-text { flex: 1 1 auto; min-width: 0; }
.page-header .page-actions {
    margin-left: auto;
    flex: none;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.page-header h1 {
    font-size: 23px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: .3px;
}
.page-header h2 {
    font-size: 21px;
    font-weight: 700;
    color: var(--gray-900);
}
.page-header p,
.page-header .subtitle {
    margin-top: 4px;
    color: var(--gray-500);
    font-size: 13.5px;
}

/* 卡片：圆角 + 柔和阴影 + 顶部学科色细条 + 悬浮微抬升 */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-top: 3px solid var(--primary);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 18px rgba(16,24,40,.06);
    margin-bottom: 18px;
    overflow: hidden;
    transition: transform .16s, box-shadow .16s;
}
.card:hover {
    box-shadow: 0 8px 28px rgba(16,24,40,.12);
}
.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--gray-100);
    background: linear-gradient(180deg, #fcfdff, #f8fafc);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.card-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-800);
}
.card-body { padding: 18px; }

/* 数据表格：渐变表头 + 悬浮学科色 + 首列加重 + 圆角 */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 18px rgba(16,24,40,.06);
}
.data-table th {
    text-align: left;
    padding: 12px 14px;
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    color: var(--gray-600);
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: .4px;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: middle;
}
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover td { background: var(--primary-light, #eff6ff); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody td:first-child { color: var(--gray-900); font-weight: 500; }

/* 按钮：主按钮带学科色阴影，所有按钮悬浮更顺滑 */
.btn {
    transition: all .15s;
    border-radius: var(--radius);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 2px 8px -2px var(--primary);
}
.btn-primary:hover {
    filter: brightness(1.05);
    box-shadow: 0 4px 14px -3px var(--primary);
}
.btn-outline {
    border-color: var(--primary);
    color: var(--primary);
    background: #fff;
}
.btn-outline:hover { background: var(--primary-light, #eff6ff); }

/* 筛选栏：卡片化 */
.filter-bar {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 18px rgba(16,24,40,.06);
    padding: 14px 18px;
    margin-bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

/* 首页统计卡：图标底色学科色 + 左侧强调条 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 18px rgba(16,24,40,.06);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform .16s, box-shadow .16s;
    overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(16,24,40,.12); }
.stat-icon {
    flex: none;
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    border-radius: 12px;
    background: var(--primary-light, #eff6ff);
}
.stat-number { font-size: 28px; font-weight: 700; color: var(--gray-900); line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* 首页快捷操作卡：图标学科色 + 悬浮边框 */
.action-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 18px rgba(16,24,40,.06);
    text-decoration: none;
    color: inherit;
    transition: all .18s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.action-card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(16,24,40,.12); border-color: var(--primary); }
.action-icon {
    flex: none;
    width: 46px; height: 46px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    border-radius: 12px;
    background: var(--primary-light, #eff6ff);
}
.action-text { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.action-desc { font-size: 12.5px; color: var(--gray-500); line-height: 1.5; }

/* 学科分布条形图：填充色走学科色 */
.bar-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark, var(--primary)));
    transition: width .5s ease;
}
.subj-tab.active { background: var(--primary); border-color: var(--primary); }

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 50px 24px;
    color: var(--gray-500);
    background: #fff;
    border: 1px dashed var(--gray-300);
    border-radius: 12px;
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h2 { font-size: 18px; color: var(--gray-700); margin-bottom: 6px; }
.empty-state p { font-size: 14px; margin-bottom: 16px; }

/* 移动端微调 */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-number { font-size: 23px; }
    .stat-icon { width: 40px; height: 40px; font-size: 22px; }
    .action-card { padding: 16px; }
    .page-header { flex-wrap: wrap; gap: 12px; padding: 12px 14px; }
    .page-header .ph-icon { width: 44px; height: 44px; font-size: 22px; }
    .page-header .page-actions { margin-left: 0; width: 100%; }
    /* 宽表格在手机上可横向滚动，避免被 .data-table 的 overflow:hidden 裁切导致看不全 */
    .data-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table thead th, .data-table tbody td { white-space: nowrap; }
}
