/* ==========================================
   教学资源管理系统 - 前台样式
   ========================================== */

/* ---------- 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: #1d1d1f; background: #f5f5f7; line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: #4a6cf7; text-decoration: none; transition: color .2s; }
a:hover { color: #3a5bd9; }
img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }

/* ---------- 布局 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.main-content { flex: 1; padding: 30px 0; }

/* ---------- 苹果风格全局 ---------- */
::selection { background: rgba(74,108,247,.2); }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 顶部导航 ---------- */
.header {
    background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 .5px 0 rgba(0,0,0,.08); position: sticky; top: 0; z-index: 1000;
}
.header-inner { display: flex; align-items: center; height: 52px; gap: 30px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; font-weight: 700; color: #1d1d1f; white-space: nowrap; letter-spacing: -.02em; }
.logo i { font-size: 1.4rem; color: #4a6cf7; }
.nav { display: flex; gap: 4px; }
.nav-link { padding: 6px 14px; border-radius: 20px; color: #555; font-weight: 500; font-size: .9rem; transition: all .25s; }
.nav-link:hover { background: rgba(0,0,0,.05); color: #1d1d1f; }
.nav-link.active { background: #4a6cf7; color: #fff; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.mobile-toggle { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #555; }

/* 用户菜单 */
.user-menu { position: relative; }
.user-info { display: flex; align-items: center; gap: 8px; color: #555; padding: 5px 10px; border-radius: 20px; transition: background .2s; font-size: .9rem; }
.user-info:hover { background: rgba(0,0,0,.05); }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.points-badge { background: linear-gradient(135deg,#f59e0b,#f97316); color: #fff; font-size: .75rem; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.dropdown-menu {
    display: none; position: absolute; top: calc(100% + 8px); right: 0; background: rgba(255,255,255,.92);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    min-width: 180px; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.12); padding: 6px 0; z-index: 100;
    border: .5px solid rgba(0,0,0,.08);
}
.user-menu:hover .dropdown-menu { display: block; }
.dropdown-menu a { display: flex; align-items: center; gap: 10px; padding: 9px 16px; color: #1d1d1f; font-size: .88rem; border-radius: 8px; margin: 0 4px; transition: background .15s; }
.dropdown-menu a:hover { background: rgba(0,0,0,.05); color: #4a6cf7; }
.dropdown-menu a i { width: 18px; text-align: center; color: #86868b; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 20px; border-radius: 20px; font-size: .88rem; font-weight: 500;
    cursor: pointer; border: none; transition: all .2s; text-align: center; white-space: nowrap;
    letter-spacing: -.01em;
}
.btn-primary { background: #4a6cf7; color: #fff; }
.btn-primary:hover { background: #3a5bd9; color: #fff; box-shadow: 0 4px 14px rgba(74,108,247,.35); }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; color: #fff; box-shadow: 0 4px 14px rgba(16,185,129,.35); }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; box-shadow: 0 4px 14px rgba(239,68,68,.35); }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; box-shadow: 0 4px 14px rgba(245,158,11,.35); }
.btn-outline { background: transparent; color: #4a6cf7; border: 1.5px solid #4a6cf7; }
.btn-outline:hover { background: #4a6cf7; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: .82rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 600; color: #1d1d1f; font-size: .88rem; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 9px 14px; border: 1.5px solid rgba(0,0,0,.1); border-radius: 10px;
    font-size: .92rem; transition: border-color .2s, box-shadow .2s; background: rgba(255,255,255,.82);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: #4a6cf7; outline: none; box-shadow: 0 0 0 3px rgba(74,108,247,.12); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-error { color: #ef4444; font-size: .82rem; margin-top: 4px; }
.form-hint { color: #86868b; font-size: .82rem; margin-top: 4px; }

/* ---------- 卡片 ---------- */
.card {
    background: #fff; border-radius: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
    overflow: hidden; transition: transform .25s, box-shadow .25s; border: .5px solid rgba(0,0,0,.04);
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(0,0,0,.1); }
.card-body { padding: 18px; }
.card-header { padding: 14px 18px; border-bottom: .5px solid rgba(0,0,0,.06); font-weight: 600; font-size: 1rem; display: flex; align-items: center; justify-content: space-between; }

/* ---------- Banner轮播 ---------- */
.banner-section { margin-bottom: 30px; }
.banner-slider { position: relative; border-radius: 16px; overflow: hidden; height: 300px; box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04); }
.banner-slide { width: 100%; height: 100%; object-fit: cover; display: none; }
.banner-slide.active { display: block; }
.banner-dots { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.banner-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.5); cursor: pointer; transition: all .2s; }
.banner-dot.active { background: #fff; transform: scale(1.2); }

/* ---------- 首页筛选 ---------- */
.filter-bar {
    background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-radius: 16px; padding: 20px; margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
    border: .5px solid rgba(0,0,0,.06);
}
.filter-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.filter-row:last-child { margin-bottom: 0; }
.filter-label { font-weight: 600; color: #1d1d1f; min-width: 60px; font-size: .88rem; }
.filter-tag {
    padding: 5px 14px; border-radius: 18px; font-size: .84rem; cursor: pointer;
    background: rgba(0,0,0,.04); color: #1d1d1f; transition: all .2s; border: none; font-weight: 500;
}
.filter-tag:hover { background: rgba(0,0,0,.08); }
.filter-tag.active { background: #4a6cf7; color: #fff; }

/* ---------- 资源卡片网格 ---------- */
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.resource-card { display: flex; flex-direction: column; }
.resource-card .card-body { flex: 1; display: flex; flex-direction: column; }
.resource-title { font-size: .95rem; font-weight: 600; color: #1d1d1f; margin-bottom: 8px; line-height: 1.45; letter-spacing: -.01em; }
.resource-title a { color: #1d1d1f; }
.resource-title a:hover { color: #4a6cf7; }
.resource-meta { display: flex; gap: 14px; font-size: .8rem; color: #86868b; margin-bottom: 10px; flex-wrap: wrap; }
.resource-meta i { margin-right: 3px; }
.resource-tags { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.resource-tag { padding: 2px 8px; background: rgba(0,0,0,.04); border-radius: 6px; font-size: .76rem; color: #86868b; }
.resource-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: .5px solid rgba(0,0,0,.06); }
.resource-actions { display: flex; gap: 12px; }
.resource-actions a, .resource-actions button { color: #86868b; font-size: .82rem; background: none; border: none; cursor: pointer; display: flex; align-items: center; gap: 4px; transition: color .2s; padding: 0; }
.resource-actions a:hover, .resource-actions button:hover { color: #4a6cf7; }
.resource-actions .liked { color: #ef4444; }
.resource-actions .collected { color: #f59e0b; }

/* ---------- 资源封面区域标签 ---------- */
.cover-type-badge, .cover-points-badge, .cover-free-badge { border-radius: 8px; font-weight: 600; }

/* ---------- 页面标题 ---------- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; flex-wrap: nowrap; gap: 16px; }
.page-header-info { flex: 1; min-width: 0; }
.page-header-info h2 { margin: 0; font-size: 1.5rem; font-weight: 700; color: #1d1d1f; letter-spacing: -.02em; }
.page-header-info p { margin: 4px 0 0; color: #86868b; font-size: .88rem; }
.page-header .btn { flex-shrink: 0; }

/* ---------- 首页区块 ---------- */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-size: 1.3rem; font-weight: 700; color: #1d1d1f; display: flex; align-items: center; gap: 10px; letter-spacing: -.02em; }
.section-title i { color: #4a6cf7; }
.section-more { font-size: .88rem; color: #86868b; transition: color .2s; }
.section-more:hover { color: #4a6cf7; }

/* 排行榜 */
.rank-list { }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: .5px solid rgba(0,0,0,.06); }
.rank-item:last-child { border-bottom: none; }
.rank-num {
    width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: .78rem; font-weight: 700; background: rgba(0,0,0,.04); color: #86868b;
}
.rank-item:nth-child(1) .rank-num { background: rgba(245,158,11,.12); color: #f59e0b; }
.rank-item:nth-child(2) .rank-num { background: rgba(0,0,0,.06); color: #607d8b; }
.rank-item:nth-child(3) .rank-num { background: rgba(239,68,68,.1); color: #ef4444; }
.rank-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.rank-info { flex: 1; }
.rank-name { font-weight: 600; font-size: .88rem; color: #1d1d1f; }
.rank-points { font-size: .8rem; color: #f59e0b; }

/* 公告 */
.announcement-item { padding: 14px 0; border-bottom: .5px solid rgba(0,0,0,.06); }
.announcement-item:last-child { border-bottom: none; }
.announcement-title { font-weight: 600; color: #1d1d1f; margin-bottom: 4px; font-size: .92rem; }
.announcement-time { font-size: .8rem; color: #86868b; }
.announcement-top { color: #ef4444; font-size: .75rem; margin-left: 6px; }

/* ---------- 资源详情页 ---------- */
.resource-detail { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
.detail-main { }
.detail-sidebar { }
.detail-info { background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-radius: 16px; padding: 28px; box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04); border: .5px solid rgba(0,0,0,.04); }
.detail-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 16px; color: #1d1d1f; letter-spacing: -.02em; }
.detail-meta { display: flex; gap: 20px; color: #86868b; font-size: .88rem; margin-bottom: 16px; flex-wrap: wrap; }
.detail-desc { line-height: 1.8; color: #555; margin-bottom: 20px; padding: 16px; background: rgba(0,0,0,.03); border-radius: 12px; font-size: .92rem; }
.detail-stats { display: flex; gap: 24px; padding: 16px 0; border-top: .5px solid rgba(0,0,0,.06); border-bottom: .5px solid rgba(0,0,0,.06); }
.detail-stat { text-align: center; }
.detail-stat-num { font-size: 1.25rem; font-weight: 700; color: #4a6cf7; }
.detail-stat-label { font-size: .78rem; color: #86868b; }
.detail-actions { display: flex; gap: 10px; margin-top: 20px; }
.detail-actions .liked { background: #ef4444 !important; border-color: #ef4444 !important; color: #fff !important; animation: pulse-like .35s ease; }
.detail-actions .collected { background: #f59e0b !important; border-color: #f59e0b !important; color: #fff !important; animation: pulse-collect .35s ease; }
@keyframes pulse-like { 0%{transform:scale(1)} 50%{transform:scale(1.12)} 100%{transform:scale(1)} }
@keyframes pulse-collect { 0%{transform:scale(1)} 50%{transform:scale(1.12)} 100%{transform:scale(1)} }
.detail-file-info { background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-radius: 16px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04); border: .5px solid rgba(0,0,0,.04); }
.file-info-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: .5px solid rgba(0,0,0,.06); font-size: .88rem; }
.file-info-row:last-child { border-bottom: none; }
.file-info-label { color: #86868b; }
.file-info-value { font-weight: 600; color: #1d1d1f; }

/* ---------- 登录/注册 ---------- */
.auth-wrapper {
    min-height: calc(100vh - 52px - 80px); display: flex; align-items: center; justify-content: center; padding: 40px 0;
}
.auth-card { width: 100%; max-width: 420px; background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-radius: 20px; padding: 40px; box-shadow: 0 2px 12px rgba(0,0,0,.08); border: .5px solid rgba(0,0,0,.06); }
.auth-title { text-align: center; font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; color: #1d1d1f; letter-spacing: -.02em; }
.auth-subtitle { text-align: center; color: #86868b; margin-bottom: 30px; font-size: .88rem; }
.auth-footer { text-align: center; margin-top: 20px; font-size: .88rem; color: #86868b; }

/* ---------- 个人资料 ---------- */
.profile-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; }
.profile-sidebar { }
.profile-avatar-section { background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-radius: 16px; padding: 24px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04); border: .5px solid rgba(0,0,0,.04); }
.profile-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin-bottom: 12px; border: 3px solid rgba(0,0,0,.06); }
.profile-username { font-size: 1.1rem; font-weight: 700; color: #1d1d1f; }
.profile-points { color: #f59e0b; font-size: .88rem; margin-top: 4px; }
.profile-nav { background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-radius: 16px; margin-top: 16px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04); border: .5px solid rgba(0,0,0,.04); }
.profile-nav a { display: flex; align-items: center; gap: 10px; padding: 12px 18px; color: #1d1d1f; font-size: .88rem; transition: all .2s; border-left: 3px solid transparent; }
.profile-nav a:hover, .profile-nav a.active { background: rgba(74,108,247,.06); color: #4a6cf7; border-left-color: #4a6cf7; }
.profile-content { background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-radius: 16px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04); border: .5px solid rgba(0,0,0,.04); }

/* ---------- 提示消息 ---------- */
.flash-message {
    padding: 14px 20px; font-size: .88rem; display: flex; align-items: center; gap: 10px;
    animation: slideDown .3s ease; border-radius: 12px; margin-bottom: 16px;
}
.flash-success { background: rgba(16,185,129,.1); color: #065f46; }
.flash-error { background: rgba(239,68,68,.1); color: #991b1b; }
.flash-warning { background: rgba(245,158,11,.1); color: #92400e; }
.flash-info { background: rgba(74,108,247,.1); color: #1e40af; }
.flash-close { margin-left: auto; background: none; border: none; font-size: 1.1rem; cursor: pointer; opacity: .5; transition: opacity .2s; }
.flash-close:hover { opacity: 1; }

@keyframes slideDown { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------- 文档预览 ---------- */
#docxPreview { font-family: "Microsoft YaHei", "SimSun", serif; line-height: 1.8; color: #1f2937; }
#docxPreview h1 { font-size: 1.6rem; margin: 1em 0 .5em; border-bottom: 2px solid #e5e7eb; padding-bottom: .3em; }
#docxPreview h2 { font-size: 1.35rem; margin: 1em 0 .5em; border-bottom: 1px solid #e5e7eb; padding-bottom: .3em; }
#docxPreview h3 { font-size: 1.15rem; margin: .8em 0 .4em; }
#docxPreview p { margin: .6em 0; }
#docxPreview table { border-collapse: collapse; width: 100%; margin: 1em 0; }
#docxPreview table td, #docxPreview table th { border: 1px solid #d1d5db; padding: 8px 12px; text-align: left; }
#docxPreview table th { background: #f3f4f6; font-weight: 600; }
#docxPreview img { max-width: 100%; height: auto; }
#docxPreview ul, #docxPreview ol { padding-left: 2em; margin: .5em 0; }
#docxPreview li { margin: .3em 0; }

/* ---------- 分页 ---------- */
.pagination-nav { margin-top: 24px; text-align: center; }
.pagination { display: inline-flex; gap: 4px; }
.pagination li a, .pagination li span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px;
    font-size: .86rem; color: #1d1d1f; transition: all .2s;
}
.pagination li a:hover { background: rgba(0,0,0,.05); }
.pagination li.active span { background: #4a6cf7; color: #fff; border-radius: 10px; }
.pagination li.disabled span { color: #aeaeb2; cursor: not-allowed; }

/* ---------- 底部 ---------- */
.footer { background: #1d1d1f; color: #86868b; padding: 28px 0; margin-top: auto; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: #86868b; font-size: .88rem; transition: color .2s; }
.footer-links a:hover { color: #fff; }
.copyright { font-size: .82rem; }

/* ---------- 上传页面 ---------- */
.upload-area {
    border: 2px dashed rgba(0,0,0,.12); border-radius: 16px; padding: 40px; text-align: center;
    cursor: pointer; transition: all .2s; background: rgba(0,0,0,.02);
}
.upload-area:hover, .upload-area.dragover { border-color: #4a6cf7; background: rgba(74,108,247,.04); }
.upload-area i { font-size: 2.5rem; color: #86868b; margin-bottom: 12px; }
.upload-area p { color: #86868b; }
.upload-area .hint { font-size: .82rem; color: #aeaeb2; margin-top: 8px; }

/* ---------- 空状态 ---------- */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state i { font-size: 3rem; color: #d1d5db; margin-bottom: 16px; }
.empty-state p { color: #86868b; font-size: .95rem; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .header-inner { gap: 16px; }
    .nav { display: none; }
    .mobile-toggle { display: block; margin-left: auto; }
    .nav.open { display: flex; position: absolute; top: 52px; left: 0; right: 0; background: rgba(255,255,255,.95); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); flex-direction: column; padding: 16px; box-shadow: 0 4px 12px rgba(0,0,0,.1); border-radius: 0 0 16px 16px; }
    .resource-detail { grid-template-columns: 1fr; }
    .resource-grid { grid-template-columns: 1fr; }
    .profile-layout { grid-template-columns: 1fr; }
    .banner-slider { height: 180px; }
    .footer-inner { flex-direction: column; text-align: center; }
    .detail-stats { flex-wrap: wrap; gap: 16px; }
    .page-header { flex-wrap: wrap; }
}

/* ---------- 工具类 ---------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: #4a6cf7; }
.text-success { color: #10b981; }
.text-danger { color: #ef4444; }
.text-warning { color: #f59e0b; }
.text-muted { color: #86868b; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none !important; }
