/* ============================================
   学海资源网 - 现代重设计 CSS
   配色方案: 蓝紫渐变 + 白色卡片 + 柔和阴影
   ============================================ */

/* ─── 基础重置 ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}
a { color: #4f46e5; text-decoration: none; transition: color .2s; }
a:hover { color: #7c3aed; }
img { max-width: 100%; height: auto; }
ul { list-style: none; }

/* ─── xuexi 新UI元素 ─── */
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 0; font-size: .85rem; }
.active-filter-label { color: var(--text-muted); font-weight: 500; }
.active-filter-tag { background: #eef2ff; color: var(--primary); padding: 3px 10px; border-radius: 20px; font-size: .82rem; }
.clear-filter { color: var(--danger); font-size: .82rem; margin-left: 4px; }
.tags-multirow { max-height: 160px; overflow-y: auto; }
.meta-type-badge { background: #fef3c7; color: #92400e; padding: 2px 8px; border-radius: 4px; font-size: .82rem; }
.meta-tags { color: var(--primary); font-size: .82rem; }
.meta-type { background: #fef3c7; color: #92400e; padding: 1px 6px; border-radius: 3px; font-size: .78rem; white-space: nowrap; }

/* ─── 详情页附件 ─── */
.attachment-previews { margin-top: 16px; }
.attachment-previews h3 { font-size: .95rem; margin-bottom: 8px; color: var(--text); }
.attachment-list { display: flex; flex-direction: column; gap: 8px; }
.attachment-item { display: flex; align-items: center; justify-content: space-between; background: #f9fafb; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.attachment-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.attachment-icon { font-size: 1.1rem; }
.attachment-name { font-weight: 500; font-size: .85rem; }
.attachment-size, .attachment-pages { color: var(--text-muted); font-size: .8rem; }
.attachment-preview-link { color: var(--primary); font-size: .82rem; font-weight: 500; }
.attachment-preview-link:hover { text-decoration: underline; }
.preview-cover-img { max-width: 100%; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,.1); cursor: zoom-in; }
.preview-hint { text-align: center; color: var(--text-muted); font-size: .8rem; margin-top: 6px; }

/* ─── 描述标签 ─── */
.desc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.desc-tag { display: inline-block; background: #eef2ff; color: var(--primary); padding: 4px 12px; border-radius: 20px; font-size: .82rem; transition: background .2s; }
.desc-tag:hover { background: #ddd6fe; }

/* ─── 管理后台 ─── */
.admin-stats .stat-card.highlight { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; }
.inline-stats { display: flex; flex-wrap: wrap; gap: 12px; padding: 8px 0; }
.inline-stat { background: #f9fafb; padding: 6px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: .85rem; }

/* ─── 颜色变量 ─── */
:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #818cf8;
    --secondary: #7c3aed;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
    --radius: 12px;
    --radius-sm: 8px;
}

/* ─── 按钮 ─── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 20px; border: 2px solid transparent; border-radius: var(--radius-sm);
    font-size: .9rem; font-weight: 600; cursor: pointer; transition: all .25s;
    text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,.4); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-large { padding: 12px 28px; font-size: 1.05rem; border-radius: var(--radius-sm); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 4px 12px; font-size: .8rem; border-radius: 6px; }
.btn-sm.danger { color: var(--danger); }
.btn-sm.danger:hover { background: #fee2e2; border-color: var(--danger); }

/* ─── 表单 ─── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border: 2px solid var(--border); border-radius: var(--radius-sm);
    font-size: .9rem; transition: border-color .2s; background: #fafafa;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); background: #fff;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group input[type="checkbox"] { width: auto; }

/* ─── 提示框 ─── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .9rem; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ─── 顶栏 ─── */
.site-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 0 1.5rem; position: sticky; top: 0; z-index: 1000;
    box-shadow: 0 2px 10px rgba(79,70,229,.3);
}
.header-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; gap: 1.5rem; height: 64px;
}
.logo { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; }
.logo-icon { font-size: 1.8rem; }
.logo-text { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.5px; }
.header-search { flex: 1; max-width: 480px; display: flex; }
.header-search input {
    flex: 1; padding: 8px 16px; border: none; border-radius: 20px 0 0 20px;
    font-size: .9rem; background: rgba(255,255,255,.15); color: #fff;
    transition: background .3s;
}
.header-search input::placeholder { color: rgba(255,255,255,.6); }
.header-search input:focus { background: rgba(255,255,255,.25); outline: none; }
.header-search button {
    padding: 8px 16px; border: none; border-radius: 0 20px 20px 0;
    background: rgba(255,255,255,.2); color: #fff; cursor: pointer; font-size: 1rem;
}
.header-search button:hover { background: rgba(255,255,255,.3); }
.header-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav-link {
    color: rgba(255,255,255,.85); padding: 6px 14px; border-radius: 20px;
    font-size: .9rem; font-weight: 500; transition: all .2s;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.15); }
.btn-register { background: rgba(255,255,255,.2); }
.btn-register:hover { background: rgba(255,255,255,.3); }
.user-link { display: flex; align-items: center; gap: 6px; }
.avatar-small {
    width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.25);
    display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700;
}
.mobile-menu-btn { display: none; background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }

/* ─── 学科导航 ─── */
.subject-nav {
    background: #fff; border-bottom: 1px solid var(--border);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.subject-nav-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; gap: 0; padding: 0 1rem;
}
.subject-item {
    display: flex; align-items: center; gap: 4px;
    padding: 10px 16px; white-space: nowrap;
    font-size: .85rem; font-weight: 500; color: var(--text-muted);
    border-bottom: 2px solid transparent; transition: all .2s;
}
.subject-item:hover, .subject-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.subject-icon { font-size: 1rem; }

/* ─── 主内容 ─── */
.main-content { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem; min-height: calc(100vh - 200px); }

/* ─── 首页 ─── */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius); padding: 3rem 2rem; margin-bottom: 2rem;
    text-align: center; color: #fff;
}
.hero-content h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: .8rem; }
.hero-content p { font-size: 1.05rem; opacity: .9; margin-bottom: 1.5rem; }
.hero-stats { display: flex; justify-content: center; gap: 2.5rem; margin-bottom: 2rem; }
.stat-item { display: flex; flex-direction: column; }
.stat-number { font-size: 1.8rem; font-weight: 800; }
.stat-label { font-size: .85rem; opacity: .8; }
.hero-search-box { max-width: 500px; margin: 0 auto; }
.hero-search-box form { display: flex; }
.hero-search-input {
    flex: 1; padding: 14px 20px; border: none; border-radius: 30px 0 0 30px;
    font-size: 1rem; background: rgba(255,255,255,.2); color: #fff;
}
.hero-search-input::placeholder { color: rgba(255,255,255,.6); }
.hero-search-input:focus { outline: none; background: rgba(255,255,255,.3); }
.hero-search-btn {
    padding: 14px 24px; border: none; border-radius: 0 30px 30px 0;
    background: #fff; color: var(--primary); font-weight: 700; font-size: .95rem; cursor: pointer;
    transition: all .3s;
}
.hero-search-btn:hover { background: #f0f0ff; }

/* ─── 区块卡片 ─── */
.section-card { background: #fff; border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.section-title { font-size: 1.25rem; font-weight: 700; color: var(--text); margin-bottom: 1rem; }
.section-header .section-title { margin-bottom: 0; }
.section-more { font-size: .9rem; color: var(--primary); font-weight: 500; }
.section-more:hover { color: var(--primary-dark); }

/* ─── 快速筛选 ─── */
.filter-form { margin-top: .5rem; }
.filter-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.filter-group { flex: 1; min-width: 150px; }
.filter-group label { display: block; font-size: .8rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.filter-group select {
    width: 100%; padding: 8px 12px; border: 2px solid var(--border); border-radius: var(--radius-sm);
    font-size: .9rem; background: #fafafa; cursor: pointer; transition: border-color .2s;
}
.filter-group select:focus { border-color: var(--primary); outline: none; }

/* ─── 资源网格卡片 ─── */
.resource-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.resource-card {
    background: #fff; border-radius: var(--radius-sm); overflow: hidden;
    border: 1px solid var(--border); transition: all .3s; display: block;
}
.resource-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.card-cover { position: relative; aspect-ratio: 3/4; background: #f3f4f6; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder {
    width: 100%; height: 100%; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(135deg, #e0e7ff, #f0e6ff);
}
.placeholder-icon { font-size: 2.5rem; }
.placeholder-text { font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.cover-placeholder.small .placeholder-icon { font-size: 1.8rem; }
.card-badge {
    position: absolute; top: 8px; right: 8px; padding: 3px 10px;
    border-radius: 12px; font-size: .78rem; font-weight: 700; color: #fff;
}
.card-badge.free { background: var(--success); }
.card-badge.paid { background: var(--accent); }
.card-body { padding: 10px 12px; }
.card-title { font-size: .9rem; font-weight: 600; color: var(--text); line-height: 1.4; margin-bottom: 6px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; gap: 8px; font-size: .78rem; color: var(--text-muted); flex-wrap: wrap; }

/* ─── 热门列表 ─── */
.hot-list { display: flex; flex-direction: column; gap: 8px; }
.hot-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    border-radius: var(--radius-sm); transition: background .2s; text-decoration: none;
}
.hot-item:hover { background: #f5f3ff; }
.hot-rank { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-weight: 800; font-size: .9rem; background: #f3f4f6; color: var(--text-muted);
    flex-shrink: 0; }
.hot-rank.top { background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; }
.hot-info { flex: 1; display: flex; flex-direction: column; }
.hot-title { font-weight: 600; color: var(--text); font-size: .95rem; }
.hot-meta { font-size: .8rem; color: var(--text-muted); }
.hot-price { font-weight: 700; font-size: .95rem; white-space: nowrap; }

/* ─── 学科网格 ─── */
.subject-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .8rem;
}
.subject-card {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: all .3s; background: #fafafa;
}
.subject-card:hover { border-color: var(--primary); background: #f5f3ff; transform: translateY(-2px); }
.subject-card-icon { font-size: 1.3rem; }
.subject-card-name { font-weight: 600; font-size: .9rem; }
.subject-card-arrow { margin-left: auto; color: var(--text-muted); font-size: .8rem; }

/* ─── 列表页 ─── */
.list-header { margin-bottom: 1.5rem; }
.list-title { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.list-count { font-size: .9rem; color: var(--text-muted); margin-top: 4px; }
.list-layout { display: grid; grid-template-columns: 240px 1fr; gap: 1.5rem; }
.list-sidebar { }
.sidebar-section { margin-bottom: 1.5rem; background: #fff; border-radius: var(--radius-sm); padding: 1rem; box-shadow: var(--shadow); }
.sidebar-section h3 { font-size: .9rem; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.sidebar-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    padding: 4px 12px; border-radius: 20px; font-size: .8rem;
    border: 1px solid var(--border); color: var(--text-muted); transition: all .2s;
    background: #fafafa;
}
.tag:hover { border-color: var(--primary); color: var(--primary); }
.tag.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.list-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 8px; }
.sort-tabs { display: flex; gap: 4px; }
.sort-tab {
    padding: 6px 14px; border: 1px solid var(--border); border-radius: 20px;
    font-size: .82rem; color: var(--text-muted); transition: all .2s;
}
.sort-tab:hover, .sort-tab.active { color: var(--primary); border-color: var(--primary); background: #f5f3ff; }

/* ─── 资源列表项 ─── */
.resource-list { display: flex; flex-direction: column; gap: 1rem; }
.resource-list-item {
    display: flex; gap: 1rem; padding: 1rem; background: #fff; border-radius: var(--radius-sm);
    border: 1px solid var(--border); transition: all .3s;
}
.resource-list-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: transparent; }
.list-item-cover { width: 100px; flex-shrink: 0; }
.list-item-cover img, .list-item-cover .cover-placeholder { width: 100px; height: 130px; border-radius: 6px; }
.list-item-body { flex: 1; display: flex; flex-direction: column; }
.list-item-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.list-item-title:hover { color: var(--primary); }
.list-item-meta { display: flex; gap: 12px; font-size: .8rem; color: var(--text-muted); margin-bottom: 6px; flex-wrap: wrap; }
.list-item-desc { font-size: .85rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; flex: 1; }
.list-item-footer { display: flex; justify-content: space-between; align-items: center; }
.list-item-price { font-weight: 700; }
.list-item-stats { display: flex; gap: 12px; font-size: .8rem; color: var(--text-muted); }

/* ─── 分页 ─── */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 2rem; }
.page-link { padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: .85rem; color: var(--text); transition: all .2s; }
.page-link:hover, .page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── 详情页 ─── */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--text-muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb .current { color: var(--text); font-weight: 500; }
.detail-layout { display: grid; grid-template-columns: 1fr 380px; gap: 1.5rem; margin-bottom: 2rem; }
.detail-preview { background: #fff; border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.preview-main { min-height: 400px; display: flex; align-items: center; justify-content: center; }
.preview-slider { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.preview-img { width: 100%; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.preview-placeholder { text-align: center; color: var(--text-muted); }
.placeholder-large { font-size: 4rem; margin-bottom: 1rem; }
.detail-info { background: #fff; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.detail-title { font-size: 1.3rem; font-weight: 800; color: var(--text); margin-bottom: 1rem; line-height: 1.4; }
.detail-meta-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 1rem; }
.meta-item { display: flex; flex-direction: column; }
.meta-label { font-size: .78rem; color: var(--text-muted); }
.meta-value { font-size: .9rem; font-weight: 600; color: var(--text); }
.detail-price { margin-bottom: 1rem; }
.price-tag { font-size: 1.3rem; font-weight: 800; }
.price-tag.free { color: var(--success); }
.price-tag.paid { color: var(--danger); }
.detail-actions { display: flex; gap: 8px; margin-bottom: 1rem; }
.btn-download { flex: 1; justify-content: center; }
.btn-buy { flex: 1; justify-content: center; background: linear-gradient(135deg, #f59e0b, #ef4444); }
.btn-buy:hover { background: linear-gradient(135deg, #d97706, #dc2626); }
.btn-favorite { min-width: 100px; justify-content: center; }
.btn-favorite.active { border-color: var(--danger); color: var(--danger); }
.detail-files { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.detail-files h3 { font-size: .9rem; margin-bottom: 8px; }
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-item { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--text); padding: 6px 10px; background: #fafafa; border-radius: 6px; }
.file-name { flex: 1; }
.file-size { color: var(--text-muted); font-size: .8rem; }
.detail-section { background: #fff; border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.detail-desc { line-height: 1.8; color: var(--text); font-size: .95rem; }

/* ─── 评论区 ─── */
.comment-form { margin-bottom: 1.5rem; padding: 1rem; background: #fafafa; border-radius: var(--radius-sm); }
.comment-rating { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.star-rating { direction: rtl; display: inline-flex; gap: 2px; }
.star-rating input { display: none; }
.star-rating .star { cursor: pointer; font-size: 1.2rem; opacity: .3; transition: opacity .2s; }
.star-rating input:checked ~ .star, .star-rating .star:hover, .star-rating .star:hover ~ .star { opacity: 1; }
.comment-input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .9rem; min-height: 80px; resize: vertical; margin-bottom: 8px; }
.login-hint { text-align: center; padding: 1rem; color: var(--text-muted); }
.comment-list { margin-top: 1rem; }
.comment-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.comment-body { flex: 1; }
.comment-header { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.comment-user { font-weight: 700; font-size: .85rem; }
.comment-rating-display { font-size: .8rem; }
.comment-date { font-size: .78rem; color: var(--text-muted); margin-left: auto; }
.comment-content { font-size: .9rem; color: var(--text); line-height: 1.6; }
.empty-comments { text-align: center; color: var(--text-muted); padding: 2rem; }

/* ─── 登录/注册 ─── */
.page-auth { display: flex; justify-content: center; align-items: center; min-height: calc(100vh - 250px); }
.auth-card { background: #fff; border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.auth-header { text-align: center; margin-bottom: 1.5rem; }
.auth-header h1 { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.auth-header p { color: var(--text-muted); font-size: .9rem; margin-top: 4px; }
.auth-form { display: flex; flex-direction: column; gap: .5rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: .9rem; color: var(--text-muted); }

/* ─── 个人中心 ─── */
.page-user { display: grid; grid-template-columns: 260px 1fr; gap: 1.5rem; }
.user-profile-card { background: #fff; border-radius: var(--radius); padding: 1.5rem; text-align: center; box-shadow: var(--shadow); }
.user-avatar-large { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.5rem; font-weight: 800;
    margin: 0 auto 1rem; }
.user-profile-card h3 { font-size: 1.1rem; font-weight: 700; }
.user-profile-card p { font-size: .85rem; color: var(--text-muted); }
.user-role { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: .78rem; background: #f3f4f6; color: var(--text-muted); margin-top: 6px; }
.user-role.admin { background: #fef3c7; color: #92400e; }
.user-nav { background: #fff; border-radius: var(--radius); padding: .5rem; box-shadow: var(--shadow); }
.user-nav-item { display: block; padding: 10px 16px; border-radius: var(--radius-sm); font-size: .9rem; color: var(--text); transition: all .2s; }
.user-nav-item:hover, .user-nav-item.active { background: #f5f3ff; color: var(--primary); font-weight: 600; }
.user-main { background: #fff; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.user-section h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; }
.profile-info { }
.info-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.info-row:last-child { border-bottom: none; }
.download-list { display: flex; flex-direction: column; gap: 8px; }
.download-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; background: #fafafa; border-radius: var(--radius-sm); }
.download-info h4 { font-size: .95rem; }
.download-info h4 a { color: var(--text); }
.download-info h4 a:hover { color: var(--primary); }
.download-date { font-size: .8rem; color: var(--text-muted); }
.order-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.order-table th, .order-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.order-table th { background: #f9fafb; font-weight: 600; }
.order-status { padding: 2px 8px; border-radius: 10px; font-size: .78rem; }
.order-status.paid { background: #d1fae5; color: #065f46; }
.order-status.pending { background: #fef3c7; color: #92400e; }
.empty-state { text-align: center; padding: 3rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { margin-bottom: 1rem; }

/* ─── 帮助中心 ─── */
.help-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 1rem; }
.help-search { margin-bottom: 1.5rem; }
.help-search input { width: 100%; max-width: 500px; padding: 12px 18px; border: 2px solid var(--border); border-radius: 30px; font-size: .95rem; }
.help-search input:focus { border-color: var(--primary); outline: none; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 1rem; }
.help-card { background: #fff; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.help-card h3 { font-size: 1.1rem; margin-bottom: 1rem; }
.help-card ul { display: flex; flex-direction: column; gap: 10px; }
.help-card li { font-size: .9rem; color: var(--text); line-height: 1.6; padding-left: 12px; border-left: 3px solid var(--primary-light); }

/* ─── 404 ─── */
.page-404 { text-align: center; padding: 4rem 1rem; }
.error-content { max-width: 400px; margin: 0 auto; }
.error-icon { font-size: 4rem; margin-bottom: 1rem; }
.error-content h1 { font-size: 4rem; font-weight: 900; color: var(--primary); line-height: 1; }
.error-content h2 { font-size: 1.5rem; margin-bottom: .5rem; }
.error-content p { color: var(--text-muted); margin-bottom: 1.5rem; }
.error-actions { display: flex; gap: 8px; justify-content: center; }

/* ─── 管理后台 ─── */
.page-admin { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; }
.admin-sidebar { background: #fff; border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.admin-sidebar h2 { font-size: 1rem; font-weight: 800; padding: 0 12px; margin-bottom: 1rem; }
.admin-nav { display: flex; flex-direction: column; gap: 2px; }
.admin-nav-item { padding: 10px 12px; border-radius: var(--radius-sm); font-size: .9rem; color: var(--text); transition: all .2s; }
.admin-nav-item:hover, .admin-nav-item.active { background: #f5f3ff; color: var(--primary); font-weight: 600; }
.admin-main { background: #fff; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.admin-main h1 { font-size: 1.3rem; font-weight: 800; margin-bottom: 1rem; }
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: linear-gradient(135deg, #f5f3ff, #e0e7ff); border-radius: var(--radius-sm); padding: 1.2rem; text-align: center; }
.stat-num { display: block; font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-lbl { font-size: .85rem; color: var(--text-muted); }
.admin-toolbar { margin-bottom: 1rem; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { background: #f9fafb; font-weight: 600; white-space: nowrap; }
.admin-table tr:hover { background: #fafafa; }
.status-badge { padding: 2px 10px; border-radius: 12px; font-size: .78rem; font-weight: 500; }
.status-badge.approved, .status-badge.active, .status-badge.paid { background: #d1fae5; color: #065f46; }
.status-badge.pending { background: #fef3c7; color: #92400e; }
.status-badge { background: #fee2e2; color: #991b1b; }
.admin-form { max-width: 600px; }
.text-muted { color: var(--text-muted); font-size: .85rem; }

/* ─── 底部 ─── */
.site-footer { background: #1f2937; color: #9ca3af; padding: 2rem 1.5rem 1.5rem; margin-top: 2rem; }
.footer-inner { max-width: 1200px; margin: 0 auto; }
.footer-links { display: flex; gap: 1.5rem; margin-bottom: 1rem; }
.footer-links a { color: #9ca3af; font-size: .9rem; }
.footer-links a:hover { color: #fff; }
.footer-info p { font-size: .8rem; line-height: 1.8; }
.footer-info a { color: var(--primary-light); }

/* ─── 移动端菜单 ─── */
.mobile-menu-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,.5); z-index: 2000;
}
.mobile-menu-overlay.active { display: block; }
.mobile-menu-panel { position: absolute; right: 0; top: 0; width: 300px; height: 100%;
    background: #fff; padding: 1rem; overflow-y: auto; }
.mobile-menu-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.mobile-menu-header h3 { font-size: 1.1rem; font-weight: 700; }
.mobile-menu-header button { background: none; border: none; font-size: 1.5rem; cursor: pointer; }
.mobile-menu-section { margin-bottom: 1.5rem; }
.mobile-menu-section h4 { font-size: .85rem; color: var(--text-muted); margin-bottom: 8px; }
.mobile-subject-item { display: block; padding: 8px 0; font-size: .9rem; color: var(--text); border-bottom: 1px solid var(--border); }
.mobile-grade-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mobile-grade-item { padding: 6px; border: 1px solid var(--border); border-radius: 6px; text-align: center; font-size: .8rem; color: var(--text); }
.mobile-menu-actions { display: flex; gap: 8px; }
.mobile-menu-actions .btn { flex: 1; justify-content: center; }

/* ─── 消息页 ─── */
.page-message { display: flex; justify-content: center; align-items: center; min-height: calc(100vh - 250px); }
.message-card { text-align: center; background: #fff; border-radius: var(--radius); padding: 3rem; box-shadow: var(--shadow-lg); }
.message-icon { font-size: 3rem; margin-bottom: 1rem; }

/* ─── 响应式 ─── */
@media (max-width: 768px) {
    .header-search { display: none; }
    .header-nav .nav-link:not(.user-link) { display: none; }
    .mobile-menu-btn { display: block; }
    .subject-nav { display: none; }
    .hero-content h1 { font-size: 1.5rem; }
    .hero-stats { gap: 1rem; }
    .stat-number { font-size: 1.3rem; }
    .resource-grid { grid-template-columns: repeat(2, 1fr); }
    .list-layout { grid-template-columns: 1fr; }
    .list-sidebar { display: none; }
    .detail-layout { grid-template-columns: 1fr; }
    .detail-meta-list { grid-template-columns: 1fr 1fr; }
    .page-user { grid-template-columns: 1fr; }
    .page-admin { grid-template-columns: 1fr; }
    .admin-stats { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .help-grid { grid-template-columns: 1fr; }
    .footer-links { flex-wrap: wrap; gap: 1rem; }
    .hero-search-box form { flex-direction: column; }
    .hero-search-input { border-radius: 30px; }
    .hero-search-btn { border-radius: 30px; margin-top: 8px; }
    .filter-row { flex-direction: column; }
    .resource-list-item { flex-direction: column; }
    .list-item-cover { width: 100%; }
    .list-item-cover img, .list-item-cover .cover-placeholder { width: 100%; height: 150px; }
}

@media (max-width: 480px) {
    .resource-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .main-content { padding: 1rem .8rem; }
    .hero-section { padding: 2rem 1rem; }
    .section-card { padding: 1rem; }
    .subject-grid { grid-template-columns: repeat(2, 1fr); }
}
