/* ===== 电力市场知识库 v3.1 — Obsidian + learnbuffett.com 风格 ===== */

:root {
    --bg: #f5f6f7;
    --sidebar-bg: #1e2632;
    --sidebar-w: 260px;
    --sidebar-text: #8ea3b8;
    --sidebar-hover: rgba(255,255,255,.06);
    --accent: #2563eb;
    --accent-light: #eff6ff;
    --accent-mid: #3b82f6;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --card-bg: #fff;
    --shadow: 0 1px 3px rgba(0,0,0,.05);
    --shadow-md: 0 4px 16px rgba(0,0,0,.07);
    --radius: 8px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:var(--font); font-size:15px; line-height:1.68; color:var(--text); background:var(--bg); }
a { text-decoration:none; color:var(--accent); }
a:hover { opacity:.85; }
#app { display:flex; min-height:100vh; }

/* ===== Sidebar (Obsidian-style) ===== */
.sidebar {
    position:fixed; left:0; top:0; width:var(--sidebar-w); height:100vh;
    background:var(--sidebar-bg); overflow-y:auto; overflow-x:hidden; z-index:100;
    padding-bottom:24px;
}
.sidebar::-webkit-scrollbar { width:3px; }
.sidebar::-webkit-scrollbar-thumb { background:rgba(255,255,255,.08); border-radius:2px; }
.sidebar-header { padding:18px 16px 14px; border-bottom:1px solid rgba(255,255,255,.05); }
.logo { display:flex; align-items:center; gap:8px; color:#fff; font-weight:700; font-size:14px; }
.logo-icon { font-size:18px; }
.logo:hover { opacity:.9; }

/* Search box */
.search-box { position:relative; margin-top:10px; }
#searchInput {
    width:100%; padding:7px 10px; border-radius:5px; border:1px solid rgba(255,255,255,.1);
    background:rgba(255,255,255,.08); color:#e0e0e0; font-size:12px; outline:none;
    transition:all .2s;
}
#searchInput::placeholder { color:#5a7d9a; }
#searchInput:focus { background:rgba(255,255,255,.12); border-color:var(--accent); }
.search-dropdown {
    position:absolute; top:100%; left:0; right:0; z-index:300;
    background:#243042; border:1px solid rgba(255,255,255,.1);
    border-radius:0 0 6px 6px; max-height:320px; overflow-y:auto;
    box-shadow:0 8px 24px rgba(0,0,0,.4);
}
.search-result-item {
    padding:8px 10px; cursor:pointer; border-bottom:1px solid rgba(255,255,255,.05);
    display:flex; flex-direction:column; gap:2px;
}
.search-result-item:hover { background:rgba(37,99,235,.2); }
.search-result-item:last-child { border-bottom:none; }
.search-result-name { font-size:12px; color:#c0d0e0; font-weight:500; }
.search-result-cat { font-size:10px; color:#6a8ea8; }
.search-no-result { padding:12px 10px; font-size:12px; color:#7a94a8; text-align:center; }

.nav-section { padding:8px 0; }
.nav-title {
    padding:10px 16px 6px; font-size:10px; text-transform:uppercase; letter-spacing:1px;
    color:#4f6478; font-weight:700;
}
.nav-list { list-style:none; }

.nav-item { margin:1px 8px; border-radius:5px; }
.nav-item a {
    display:flex; align-items:center; gap:7px; padding:6px 10px;
    color:var(--sidebar-text); font-size:12.5px; border-radius:5px; transition:all .12s; cursor:pointer;
}
.nav-item a:hover { background:var(--sidebar-hover); color:#e0e0e0; }
.nav-item.active a { background:var(--accent); color:#fff; font-weight:500; }
.nav-icon { font-size:13px; width:16px; text-align:center; flex-shrink:0; }
.nav-arrow { font-size:9px; flex-shrink:0; width:12px; text-align:center; transition:transform .15s; }
.nav-arrow.expanded { transform:rotate(90deg); }
.nav-arrow.collapsed { transform:rotate(0); }

/* Folder items */
.nav-folder > a { font-weight:500; }
.nav-sublist { margin:2px 0 2px 16px; border-left:1px solid rgba(255,255,255,.06); }
.nav-file-item { margin:1px 4px; }
.nav-file-item a { padding:4px 10px; font-size:12px; color:#7a94a8; }
.nav-file-item a:hover { color:#c0d0e0; background:var(--sidebar-hover); }

.cat-count-badge {
    font-size:10px; background:rgba(255,255,255,.08); color:#93a3b8;
    padding:1px 6px; border-radius:8px; margin-left:auto; font-weight:400;
}
.file-link-count {
    font-size:10px; color:#5a7d9a; margin-left:auto;
}
.prov-badge {
    font-size:9px; padding:1px 5px; border-radius:6px;
    background:rgba(37,99,235,.2); color:#60a5fa;
}

/* ===== Main Content ===== */
.main-content { margin-left:var(--sidebar-w); flex:1; min-height:100vh; }
.content-wrapper { max-width:960px; margin:0 auto; padding:32px 24px; }

/* ===== Mobile ===== */
.mobile-menu-btn { display:none; position:fixed; top:12px; left:12px; z-index:200;
    background:var(--sidebar-bg); border:none; padding:10px; border-radius:6px; cursor:pointer; }
.mobile-menu-btn span { display:block; width:20px; height:2px; background:#fff; margin:4px 0; border-radius:1px; }
.overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:99; }
.overlay.show { display:block; }

/* Dark background fix for concept content */
.concept-body div[style*="background:#1a2332"],
.concept-body div[style*="background: #1a2332"],
.concept-body pre,
.concept-body div[class*="dark"],
.concept-body div[class*="night"] {
    background: #fff !important;
    color: #1e293b !important;
    border: 1px solid var(--border) !important;
}

/* ===== Home Page ===== */
.hero-section {
    text-align:center; padding:56px 20px 44px; margin-bottom:40px;
    background:linear-gradient(135deg, #f0f5ff 0%, #e8f2fe 50%, #f3f6ff 100%);
    border-radius:12px;
}
.hero-content h1 { font-size:28px; font-weight:700; margin-bottom:10px; color:#0f172a; }
.hero-subtitle { font-size:15px; color:#475569; margin-bottom:28px; line-height:1.5; }
.hero-stats { display:flex; justify-content:center; gap:28px; margin-bottom:28px; }
.hero-stat { text-align:center; }
.hero-stat-num { font-size:36px; font-weight:700; color:var(--accent); display:block; }
.hero-stat-label { font-size:12px; color:#64748b; margin-top:2px; }
.hero-stat-divider { width:1px; background:#cbd5e1; }
.hero-actions { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; }
.btn-primary, .btn-secondary {
    display:inline-block; padding:9px 22px; border-radius:6px; font-size:14px; font-weight:500; cursor:pointer;
}
.btn-primary { background:var(--accent); color:#fff; }
.btn-primary:hover { background:#1d4ed8; opacity:1; }
.btn-secondary { background:#fff; color:var(--accent); border:1px solid var(--border); }
.btn-secondary:hover { background:#f8fafc; opacity:1; }

.featured-section { margin-bottom:44px; }
.section-title { font-size:17px; font-weight:700; margin-bottom:16px; padding-bottom:8px; border-bottom:2px solid var(--accent); display:inline-block; }

/* TOP 15 Concepts Pills */
.top-concepts-cloud { display:flex; flex-wrap:wrap; gap:8px 6px; padding:8px 0; align-items:baseline; }
.top-concept-pill {
    display:inline-flex; align-items:center; gap:5px;
    padding:3px 12px; border-radius:16px; background:#fff; border:1px solid var(--border);
    color:var(--text); cursor:pointer; transition:all .2s; white-space:nowrap;
}
.top-concept-pill:hover { background:var(--accent-light); border-color:var(--accent); color:var(--accent); transform:translateY(-1px); box-shadow:var(--shadow); }
.pill-freq { font-size:10px; background:var(--accent-light); color:var(--accent); padding:1px 6px; border-radius:8px; font-weight:500; }

/* Province Summary */
.province-summary-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:10px; }
.province-summary-card { background:#fff; border-radius:var(--radius); padding:16px; text-align:center; border:1px solid var(--border); cursor:pointer; transition:all .15s; }
.province-summary-card:hover { border-color:var(--accent); box-shadow:var(--shadow); }
.province-summary-name { font-size:14px; font-weight:600; margin-bottom:4px; }
.province-summary-count { font-size:12px; color:var(--text-muted); }

/* Key Milestones */
.key-milestones { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:12px; }
.milestone-card { background:#fff; border-radius:var(--radius); padding:16px; border:1px solid var(--border); }
.milestone-year { font-size:11px; padding:2px 8px; background:var(--accent-light); color:var(--accent); border-radius:10px; margin-bottom:8px; display:inline-block; }
.milestone-card h4 { font-size:14px; font-weight:600; margin-bottom:4px; }
.milestone-card p { font-size:12px; color:var(--text-muted); }

/* Related Concepts Grid */
.related-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:12px; }
.related-card { background:#fff; border-radius:var(--radius); padding:16px; border:1px solid var(--border); cursor:pointer; transition:all .15s; }
.related-card:hover { border-color:var(--accent); box-shadow:var(--shadow); transform:translateY(-1px); }
.related-card h4 { font-size:15px; font-weight:600; margin-bottom:4px; }
.related-meta { font-size:12px; color:var(--text-muted); }

/* ===== Standard Page ===== */
.page-standard { padding:8px 0; }
.page-standard h1 { font-size:24px; font-weight:700; margin-bottom:14px; }
.page-standard h2 { font-size:18px; font-weight:600; margin:22px 0 10px; padding-bottom:5px; border-bottom:1px solid var(--border); }
.page-standard h3 { font-size:15px; font-weight:600; margin:14px 0 6px; }
.page-standard p { margin-bottom:8px; color:#334155; }
.page-desc { color:var(--text-muted); font-size:14px; margin-bottom:20px; }

/* Card (about page) */
.card {
    background:var(--card-bg); border-radius:var(--radius); padding:16px;
    border:1px solid var(--border); transition:all .2s; cursor:pointer;
}
.card:hover { transform:translateY(-2px); box-shadow:var(--shadow-md); border-color:var(--accent); }

/* Stats & Category */
.stats-row { display:flex; gap:16px; margin:16px 0; flex-wrap:wrap; }
.stat-item { text-align:center; padding:14px 28px; background:var(--card-bg); border-radius:var(--radius); border:1px solid var(--border); }
.stat-item strong { display:block; font-size:26px; color:var(--accent); }
.stat-item span { font-size:12px; color:var(--text-muted); }
.category-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:12px; margin-bottom:28px; }
.category-card { background:var(--card-bg); border-radius:var(--radius); padding:16px; border:1px solid var(--border); }
.category-card h3 { font-size:14px; font-weight:600; margin-bottom:4px; }
.cat-count { font-size:11px; color:var(--text-muted); margin-bottom:8px; }
.cat-items { display:flex; flex-wrap:wrap; gap:4px; }
.cat-items a { font-size:11px; color:var(--accent); padding:2px 8px; background:var(--accent-light); border-radius:10px; }
.cat-items a:hover { background:var(--accent); color:#fff; opacity:1; }

/* Graph */
.graph-info { text-align:center; font-size:13px; color:var(--text-muted); margin-bottom:10px; }
.graph-controls-bar { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; flex-wrap:wrap; gap:8px; }
.graph-search-box input {
    padding:6px 12px; border:1px solid var(--border); border-radius:16px;
    font-size:13px; outline:none; width:200px; background:#fff; transition:all .2s;
}
.graph-search-box input:focus { border-color:var(--accent); box-shadow:0 0 0 2px rgba(37,99,235,.1); }
.graph-filter-tags { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:8px; }
.graph-filter-tag {
    padding:3px 10px; border-radius:14px; font-size:11px; cursor:pointer;
    border:1px solid var(--border); background:#fff; color:var(--text-muted);
    transition:all .15s; user-select:none;
}
.graph-filter-tag:hover { border-color:var(--accent); color:var(--accent); }
.graph-filter-tag.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.graph-zoom-btns { display:flex; gap:6px; }
.zoom-btn {
    padding:6px 14px; border:1px solid var(--border); border-radius:6px;
    background:#fff; cursor:pointer; font-size:14px; transition:all .15s;
}
.zoom-btn:hover { background:var(--accent-light); border-color:var(--accent); color:var(--accent); }
.graph-wrapper { background:#fff; border-radius:var(--radius); border:1px solid var(--border); padding:12px; }
.graph-wrapper svg { width:100%; height:480px; display:block; }
.graph-legend-box { display:flex; flex-wrap:wrap; gap:10px; padding:8px 0; font-size:11px; }
.legend-item { display:flex; align-items:center; gap:5px; }
.legend-dot { width:8px; height:8px; border-radius:50%; }

/* Concept/Policy Page */
.breadcrumb { font-size:12px; color:var(--text-muted); margin-bottom:14px; }
.breadcrumb a { color:var(--text-muted); }
.breadcrumb a:hover { color:var(--accent); }
.concept-meta-line, .policy-meta-line { display:flex; gap:14px; margin:6px 0 20px; flex-wrap:wrap; }
.meta-item { font-size:12px; color:var(--text-muted); }
.province-badge { background:#fef3c7; color:#b45309; padding:2px 10px; border-radius:10px; }

.concept-body { font-size:14px; }
.concept-body h1 { font-size:20px; margin:20px 0 10px; }
.concept-body h2 { font-size:17px; margin:18px 0 8px; padding-bottom:4px; border-bottom:1px solid var(--border); }
.concept-body h3 { font-size:15px; margin:14px 0 6px; color:#1e40af; }
.concept-body h4 { font-size:13px; margin:10px 0 4px; font-weight:600; }
.concept-body p { margin-bottom:6px; }
.concept-body blockquote { margin:10px 0; padding:8px 14px; background:#f8fafc; border-left:3px solid var(--accent); border-radius:0 5px 5px 0; color:#475569; font-size:13px; }
.concept-body table { width:100%; max-width:100%; overflow-x:auto; display:block; border-collapse:collapse; margin:10px 0; font-size:12px; }
.concept-body table th { background:var(--accent-light); padding:7px 10px; text-align:left; font-weight:600; border-bottom:2px solid var(--border); }
.concept-body table td { padding:7px 10px; border-bottom:1px solid var(--border); }
.concept-body table tbody tr:nth-child(even) { background:#f8fafc; }
.concept-body table tbody tr:hover { background:#e8f0fe; }
.concept-body pre { background:#1e293b; color:#e2e8f0; padding:14px; border-radius:6px; overflow-x:auto; margin:10px 0; font-size:12px; line-height:1.45; }
.concept-body code { background:var(--accent-light); padding:2px 5px; border-radius:4px; font-size:12px; color:var(--accent); }
.concept-body pre code { background:none; padding:0; color:inherit; font-size:12px; }
.concept-body ul, .concept-body ol { margin:6px 0; padding-left:20px; }
.concept-body li { margin:3px 0; }
.concept-body hr { border:none; border-top:1px solid var(--border); margin:18px 0; }
.concept-body .wikilink { color:var(--accent); border-bottom:1px solid var(--accent); cursor:pointer; font-weight:500; }
.concept-body .wikilink:hover { border-bottom-style:solid; opacity:1; }
.concept-body .wikilink-broken { color:var(--text-muted); text-decoration:line-through; }

.related-concepts { margin-top:28px; padding:16px 20px; background:#f8fafc; border-radius:var(--radius); border:1px solid var(--border); }
.related-concepts h3 { font-size:14px; margin-bottom:10px; }
.tag-cloud { display:flex; flex-wrap:wrap; gap:6px; }
.tag-link { display:inline-block; padding:3px 10px; background:var(--accent-light); color:var(--accent); border-radius:14px; font-size:12px; cursor:pointer; }
.tag-link:hover { background:var(--accent); color:#fff; opacity:1; }

/* Timeline */
.timeline { padding:16px 0; }
.timeline-item { display:flex; margin-bottom:20px; align-items:flex-start; }
.timeline-year { font-size:16px; font-weight:700; color:var(--accent); min-width:66px; text-align:right; padding-right:18px; padding-top:2px; }
.timeline-card { flex:1; padding:12px 16px; background:var(--card-bg); border:1px solid var(--border); border-left:3px solid var(--accent); border-radius:0 var(--radius) var(--radius) 0; }
.timeline-card h3 { font-size:15px; font-weight:600; margin-bottom:4px; }
.timeline-card p { font-size:12px; color:var(--text-muted); }

/* About */
.about-body { max-width:640px; margin:0 auto; text-align:center; }
.about-body p { font-size:14px; color:#475569; margin-bottom:10px; }
.about-stats { display:flex; justify-content:center; gap:24px; margin:20px 0; flex-wrap:wrap; }
.about-stat { text-align:center; }
.about-stat strong { display:block; font-size:22px; color:var(--accent); }
.about-stat span { font-size:11px; color:var(--text-muted); }

/* ===== Footer ===== */
.footer-section {
    margin-top: 20px; padding: 36px 28px 20px;
    background: #1e293b; color: #cbd5e1; border-radius: 12px;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; margin-bottom: 24px; }
.footer-col h3 { font-size: 15px; font-weight: 600; margin-bottom: 10px; color: #f1f5f9; }
.footer-col p { font-size: 13px; line-height: 1.8; color: #94a3b8; }
.footer-email { color: var(--accent-mid); font-size: 13px; margin-top: 6px; }
.donate-qr { width: 200px; height: auto; border-radius: 8px; margin-top: 8px; border: 2px solid rgba(255,255,255,.1); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.06); padding-top: 16px; text-align: center; }
.footer-bottom p { font-size: 12px; color: #64748b; }

/* Skeleton loading */
@keyframes skeleton-pulse {
    0% { opacity:0.6; }
    50% { opacity:0.9; }
    100% { opacity:0.6; }
}
.skeleton-screen { padding:20px 0; }
.skeleton-line {
    height:14px; background:#e2e8f0; border-radius:4px; margin-bottom:12px;
    animation:skeleton-pulse 1.5s ease-in-out infinite;
}
.skeleton-line:nth-child(1) { width:70%; }
.skeleton-line:nth-child(2) { width:90%; }
.skeleton-line:nth-child(3) { width:55%; }

/* Hero SVG graphic */
.hero-graphic { margin-bottom:16px; }
.hero-graphic svg { width:120px; height:80px; }

/* Responsive */
@media (max-width:768px) {
    .sidebar { transform:translateX(-100%); transition:transform .3s; }
    .sidebar.open { transform:translateX(0); }
    .main-content { margin-left:0; }
    .mobile-menu-btn { display:block; }
    .content-wrapper { padding:18px 14px; }
    .hero-section { padding:36px 14px 28px; }
    .hero-stats { gap:18px; }
    .hero-stat-num { font-size:28px; }
    .top-concept-pill { font-size:13px!important; }
    .graph-wrapper svg { height:320px; }
}
