/* ═══════════════════════════════════════════════
   学科资料站 — Apple-Inspired Minimal CSS v2
   ═══════════════════════════════════════════════ */

:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --border: rgba(0, 0, 0, 0.06);
    --border-hover: rgba(0, 0, 0, 0.12);
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #aeaeb2;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-light: rgba(0, 113, 227, 0.08);
    --danger: #ff3b30;
    --green: #34c759;
    --pdf-color: #e74c3c;
    --word-color: #2b79c2;
    --zip-color: #f39c12;
    --rar-color: #8e44ad;
    --ppt-color: #e67e22;
    --xls-color: #27ae60;
    --txt-color: #95a5a6;
    --default-color: #7f8c8d;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text',
             'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text-primary); line-height: 1.6; min-height: 100vh; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ── Navbar ─────────────────────────────────── */
.navbar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(245, 245, 247, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
}
.nav-container {
    max-width: 1120px; margin: 0 auto; padding: 0 24px;
    height: 52px; display: flex; align-items: center; gap: 20px;
}
.nav-logo {
    display: flex; align-items: center; gap: 8px;
    font-weight: 600; font-size: 17px; color: var(--text-primary); flex-shrink: 0;
}
.nav-search {
    flex: 1; max-width: 480px; position: relative; display: flex; align-items: center;
}
.nav-search .search-icon { position: absolute; left: 12px; color: var(--text-tertiary); pointer-events: none; }
.nav-search input {
    width: 100%; height: 36px; padding: 0 60px 0 38px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); font-size: 14px; color: var(--text-primary);
    outline: none; transition: var(--transition);
}
.nav-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.nav-search input::placeholder { color: var(--text-tertiary); }
.search-kbd {
    position: absolute; right: 10px; font-size: 11px; padding: 2px 6px;
    border-radius: 4px; background: var(--bg); border: 1px solid var(--border);
    color: var(--text-tertiary); pointer-events: none;
}
.nav-links { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-link {
    font-size: 14px; font-weight: 500; color: var(--text-secondary);
    padding: 6px 14px; border-radius: var(--radius-sm); transition: var(--transition);
}
.nav-link:hover { color: var(--accent); background: var(--accent-light); }

/* ── Hero ───────────────────────────────────── */
.hero { padding: 64px 24px 40px; text-align: center; }
.hero-title {
    font-size: 44px; font-weight: 700; letter-spacing: -0.025em;
    background: linear-gradient(135deg, #1d1d1f 0%, #515154 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-subtitle { margin-top: 10px; font-size: 17px; color: var(--text-secondary); }

.notice-card {
    width: min(760px, 92vw);
    margin: 0 auto;
    padding: 14px 16px;
    background: linear-gradient(120deg, #f8fbff 0%, #eef5ff 100%);
    border: 1px solid rgba(0, 113, 227, 0.16);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: left;
}
.notice-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.notice-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}
.notice-date {
    font-size: 13px;
    color: var(--text-tertiary);
}
.notice-text {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── Stats ──────────────────────────────────── */
.stats-row {
    display: inline-flex; align-items: center; gap: 0;
    margin-top: 32px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 16px 8px; box-shadow: var(--shadow-sm);
}
.stat-item { padding: 0 28px; text-align: center; }
.stat-value { display: block; font-size: 24px; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 12px; color: var(--text-tertiary); font-weight: 500; }
.stat-divider { width: 1px; height: 32px; background: var(--border); }

/* ── Subject Cards ──────────────────────────── */
.subjects-section { padding: 0 0 64px; }
.subjects-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 20px;
}
.subject-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px;
    cursor: pointer; transition: var(--transition); position: relative; overflow: hidden;
}
.subject-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.subject-card-icon {
    width: 44px; height: 44px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px; font-size: 20px;
}
.subject-card-name { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.subject-card-meta { font-size: 13px; color: var(--text-tertiary); margin-top: 6px; }
.subject-card-tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 4px; }
.subject-card-tag {
    font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; color: #fff;
    text-transform: uppercase;
}

/* ── Breadcrumb ─────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; font-size: 14px; }
.breadcrumb-home { color: var(--accent); font-weight: 500; }
.breadcrumb-home:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--text-tertiary); }
.breadcrumb-current { color: var(--text-primary); font-weight: 500; }

/* ── Filters ────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-btn {
    padding: 6px 16px; font-size: 13px; font-weight: 500; color: var(--text-secondary);
    border-radius: 18px; background: var(--surface); border: 1px solid var(--border); transition: var(--transition);
}
.filter-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.filter-btn.active { background: var(--text-primary); color: #fff; border-color: var(--text-primary); }

/* ── Folders Row ────────────────────────────── */
.folders-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.folder-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
    color: var(--text-secondary); cursor: pointer; transition: var(--transition);
}
.folder-chip:hover { border-color: var(--accent); color: var(--accent); }
.folder-chip.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
.folder-chip svg { width: 14px; height: 14px; }
.folder-chip-count { font-size: 11px; color: var(--text-tertiary); margin-left: 2px; }

/* ── File Table ─────────────────────────────── */
.files-section { padding: 0 0 64px; }
.files-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.file-count { font-size: 13px; color: var(--text-tertiary); }

.file-table-wrap {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
}
.file-table { width: 100%; border-collapse: collapse; }
.file-table thead th {
    padding: 12px 16px; font-size: 12px; font-weight: 600;
    color: var(--text-tertiary); text-align: left; text-transform: uppercase;
    letter-spacing: 0.04em; border-bottom: 1px solid var(--border); background: var(--bg);
}
.file-table tbody tr { transition: var(--transition); }
.file-table tbody tr:hover { background: rgba(0,113,227,0.03); }
.file-table tbody td {
    padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
.file-table tbody tr:last-child td { border-bottom: none; }

.col-name { width: 45%; }
.col-subject { width: 15%; }
.col-size { width: 12%; }
.col-date { width: 14%; }
.col-dl { width: 10%; }
.col-action { width: 9%; text-align: right !important; }

.file-name-cell { display: flex; align-items: center; gap: 10px; }
.file-ext-badge {
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 10px; color: #fff; flex-shrink: 0; text-transform: uppercase;
}
.file-ext-badge.pdf { background: var(--pdf-color); }
.file-ext-badge.doc, .file-ext-badge.docx { background: var(--word-color); }
.file-ext-badge.zip { background: var(--zip-color); }
.file-ext-badge.rar, .file-ext-badge.r7z { background: var(--rar-color); }
.file-ext-badge.ppt, .file-ext-badge.pptx { background: var(--ppt-color); }
.file-ext-badge.xls, .file-ext-badge.xlsx { background: var(--xls-color); }
.file-ext-badge.txt, .file-ext-badge.md, .file-ext-badge.csv { background: var(--txt-color); }
.file-ext-badge.tar, .file-ext-badge.gz { background: var(--rar-color); }

.file-name-text {
    font-weight: 500; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 320px;
}
.file-sub-path { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }

.dl-btn-sm {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 14px; font-size: 12px; font-weight: 500; color: var(--accent);
    border: 1px solid var(--accent); border-radius: 16px; transition: var(--transition);
    white-space: nowrap;
}
.dl-btn-sm:hover { background: var(--accent); color: #fff; }
.dl-btn-sm svg { width: 12px; height: 12px; }

/* ── Empty State ────────────────────────────── */
.empty-state { text-align: center; padding: 64px 24px; color: var(--text-tertiary); }
.empty-state svg { margin-bottom: 12px; opacity: 0.35; }
.empty-state p { font-size: 15px; }

/* ── Pagination ─────────────────────────────── */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; margin-top: 32px;
}
.page-btn {
    min-width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 500; color: var(--text-secondary);
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface); transition: var(--transition);
}
.page-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.page-btn.active { background: var(--text-primary); color: #fff; border-color: var(--text-primary); }
.page-btn:disabled { opacity: 0.4; pointer-events: none; }

/* ── Admin ──────────────────────────────────── */
.admin-section { padding: 64px 0 80px; }
.admin-title { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; text-align: center; }
.admin-subtitle { text-align: center; color: var(--text-secondary); margin-top: 8px; font-size: 15px; margin-bottom: 36px; }
.admin-grid { display: flex; justify-content: center; max-width: 820px; margin: 0 auto; }
.upload-card { width: 520px; max-width: 100%; }

.upload-card {
    background: var(--surface); border-radius: var(--radius-xl); border: 1px solid var(--border);
    padding: 32px; box-shadow: var(--shadow-sm);
}
.upload-zone {
    border: 2px dashed var(--border-hover); border-radius: var(--radius-lg);
    padding: 40px 24px; text-align: center; color: var(--text-tertiary);
    transition: var(--transition); cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.upload-zone svg { margin-bottom: 10px; opacity: 0.6; }
.upload-text { font-size: 14px; color: var(--text-secondary); }
.upload-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 6px; }
.upload-browse { color: var(--accent); font-weight: 500; }
.upload-form { margin-top: 20px; }

.file-preview {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; background: var(--bg); border-radius: var(--radius-md); margin-bottom: 16px;
}
.file-preview-icon {
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 10px; color: #fff; background: var(--pdf-color); flex-shrink: 0;
}
.file-preview-icon.word { background: var(--word-color); }
.file-preview-icon.archive { background: var(--zip-color); }
.file-preview-icon.ppt { background: var(--ppt-color); }
.file-preview-icon.xls { background: var(--xls-color); }
.file-preview-info { flex: 1; min-width: 0; }
.file-preview-name { display: block; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-preview-size { font-size: 12px; color: var(--text-tertiary); }
.file-preview-remove { font-size: 20px; color: var(--text-tertiary); padding: 4px; transition: var(--transition); }
.file-preview-remove:hover { color: var(--danger); }

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 5px; }
.form-input {
    width: 100%; padding: 9px 12px; font-size: 14px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg); color: var(--text-primary); outline: none;
    transition: var(--transition); resize: vertical;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-input::placeholder { color: var(--text-tertiary); }

.btn-upload {
    width: 100%; padding: 11px; font-size: 15px; font-weight: 600;
    color: #fff; background: var(--accent); border-radius: var(--radius-md);
    transition: var(--transition); display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px;
}
.btn-upload:hover { background: var(--accent-hover); }
.btn-upload:disabled { opacity: 0.6; pointer-events: none; }
.btn-loader {
    width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Admin Panel ────────────────────────────── */
.admin-panel { display: flex; flex-direction: column; gap: 16px; }
.panel-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
}
.panel-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.panel-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 14px; }
.panel-desc code {
    background: var(--bg); padding: 2px 6px; border-radius: 4px;
    font-size: 12px; font-family: 'SF Mono', Consolas, monospace;
}
.btn-scan {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; font-size: 13px; font-weight: 500;
    color: var(--accent); border: 1px solid var(--accent);
    border-radius: var(--radius-sm); transition: var(--transition);
}
.btn-scan:hover { background: var(--accent); color: #fff; }
.panel-result { font-size: 13px; color: var(--green); margin-top: 10px; min-height: 18px; }

/* ── Manage List ────────────────────────────── */
.manage-section { max-width: 820px; margin: 40px auto 0; }
.manage-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--border);
}
.manage-item:last-child { border-bottom: none; }
.manage-icon {
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 10px; color: #fff; flex-shrink: 0;
}
.manage-icon.pdf { background: var(--pdf-color); }
.manage-icon.doc, .manage-icon.docx { background: var(--word-color); }
.manage-icon.zip { background: var(--zip-color); }
.manage-icon.rar, .manage-icon.r7z { background: var(--rar-color); }
.manage-icon.ppt, .manage-icon.pptx { background: var(--ppt-color); }
.manage-icon.xls, .manage-icon.xlsx { background: var(--xls-color); }
.manage-info { flex: 1; min-width: 0; }
.manage-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.manage-meta { font-size: 12px; color: var(--text-tertiary); }
.manage-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-icon {
    width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); transition: var(--transition); color: var(--text-tertiary);
}
.btn-icon:hover { background: var(--bg); color: var(--text-primary); }
.btn-icon.danger:hover { background: rgba(255,59,48,0.08); color: var(--danger); }

/* ── Toast ──────────────────────────────────── */
.toast-container { position: fixed; top: 64px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 20px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    font-size: 14px; color: var(--text-primary); animation: slideIn 0.3s ease; max-width: 320px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }

/* ── Footer ─────────────────────────────────── */
.footer { padding: 28px 0; text-align: center; font-size: 13px; color: var(--text-tertiary); border-top: 1px solid var(--border); }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
    .hero-title { font-size: 30px; }
    .hero { padding: 40px 24px 28px; }
    .notice-card { width: 100%; }
    .stats-row { flex-wrap: wrap; padding: 12px; gap: 0; }
    .stat-item { padding: 8px 16px; }
    .stat-divider { display: none; }
    .subjects-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
    .admin-grid { width: 100%; }
    .upload-card { width: 100%; }
    .file-table thead { display: none; }
    .file-table, .file-table tbody, .file-table tr, .file-table td { display: block; width: 100%; }
    .file-table tbody tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
    .file-table tbody td { padding: 4px 0; border: none; }
    .col-action { text-align: left !important; }
}
@media (max-width: 480px) {
    .nav-container { flex-wrap: wrap; height: auto; padding: 10px 16px; }
    .nav-search { order: 3; width: 100%; max-width: 100%; }
    .search-kbd { display: none; }
    .notice-card { padding: 12px 14px; }
    .notice-text { font-size: 15px; }
}
