* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #0f0f14;
    --bg-secondary: #1a1a24;
    --bg-card: rgba(30, 30, 45, 0.7);
    --bg-card-hover: rgba(40, 40, 60, 0.8);
    --text-primary: #e8e8f0;
    --text-secondary: #9090a8;
    --accent: #ff6b35;
    --accent-glow: rgba(255, 107, 53, 0.3);
    --accent-2: #ff9f1c;
    --border: rgba(255, 255, 255, 0.06);
    --sidebar-width: 240px;
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 20%, rgba(255, 107, 53, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(255, 159, 28, 0.03) 0%, transparent 50%);
    z-index: -1;
    animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-5%, -5%); }
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    backdrop-filter: blur(20px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin-bottom: 32px;
}
.logo i { font-size: 24px; color: var(--accent); }
.logo span { font-size: 18px; font-weight: 600; }

.nav-links { list-style: none; flex: 1; }
.nav-links li {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 8px; cursor: pointer;
    color: var(--text-secondary); transition: all 0.2s ease; margin-bottom: 4px;
}
.nav-links li:hover { background: rgba(255,107,53,0.08); color: var(--text-primary); }
.nav-links li.active {
    background: rgba(255,107,53,0.12); color: var(--accent);
    box-shadow: inset 3px 0 0 var(--accent);
}
.nav-links li i { font-size: 20px; }

.sidebar-footer { padding: 12px; }
.theme-toggle {
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: 8px; cursor: pointer; background: var(--bg-card); transition: all 0.2s;
}
.theme-toggle:hover { background: var(--bg-card-hover); }

.content {
    margin-left: var(--sidebar-width); padding: 32px 40px; flex: 1; min-height: 100vh;
}

.page-title {
    font-size: 28px; font-weight: 700; margin-bottom: 24px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* Stats Grid */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    backdrop-filter: blur(10px); transition: all 0.3s ease;
    position: relative; overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    opacity: 0; transition: opacity 0.3s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card:hover::before { opacity: 1; }
.stat-card .stat-icon { font-size: 28px; color: var(--accent); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 32px; font-weight: 700; }
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* Dashboard Grid */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px; backdrop-filter: blur(10px);
}
.card h3 { font-size: 16px; margin-bottom: 16px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.card h3 i { color: var(--accent); }

/* Categories Grid */
.categories-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.category-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; cursor: pointer;
    transition: all 0.3s ease; position: relative; overflow: hidden;
}
.category-card:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(255,107,53,0.1); border-color: var(--accent); }
.category-card .cat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.category-card .cat-icon { font-size: 28px; }
.category-card .cat-count { font-size: 24px; font-weight: 700; color: var(--accent); }
.category-card .cat-name { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.category-card .cat-domain { font-size: 12px; color: var(--text-secondary); padding: 2px 8px; border-radius: 8px; background: rgba(255,107,53,0.1); display: inline-block; }
.category-card .cat-bar { height: 4px; border-radius: 2px; background: var(--bg-primary); margin-top: 12px; overflow: hidden; }
.category-card .cat-bar-fill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* Recent List */
.recent-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer;
    transition: all 0.2s;
}
.recent-item:hover { padding-left: 8px; }
.recent-item:last-child { border-bottom: none; }
.recent-item .ri-icon { color: var(--accent); font-size: 16px; }
.recent-item .title { flex: 1; font-size: 14px; }
.recent-item .folder { font-size: 12px; color: var(--text-secondary); }

/* Folder Chart */
.folder-bar { margin-bottom: 12px; }
.folder-bar .label { font-size: 13px; margin-bottom: 4px; display: flex; justify-content: space-between; }
.folder-bar .bar { height: 6px; border-radius: 3px; background: var(--bg-primary); overflow: hidden; }
.folder-bar .bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.6s ease; }

/* Graph */
.graph-container { position: relative; }
#knowledgeGraph {
    width: 100%; height: 70vh; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
}
.graph-legend {
    display: flex; gap: 16px; margin-top: 12px; justify-content: center;
}
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.concept { background: #ff6b35; }
.dot.entity { background: #4ecdc4; }
.dot.topic { background: #ffe66d; }
.dot.daily { background: #95e1d3; }
.dot.other { background: #9090a8; }

/* Search */
.search-bar {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 20px; margin-bottom: 16px;
    transition: border-color 0.2s;
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-bar i { color: var(--text-secondary); font-size: 18px; }
.search-bar input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text-primary); font-size: 15px;
}
.search-bar input::placeholder { color: var(--text-secondary); }

.filters { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.filters select {
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-primary); padding: 8px 12px; border-radius: 8px;
    font-size: 13px; cursor: pointer;
}
.tag-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-chip {
    padding: 4px 10px; border-radius: 12px; font-size: 12px;
    background: rgba(255,107,53,0.1); color: var(--accent); cursor: pointer;
    border: 1px solid transparent; transition: all 0.2s;
}
.tag-chip:hover, .tag-chip.active { border-color: var(--accent); background: rgba(255,107,53,0.2); }

/* Search Results */
.search-results .result-item {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 20px; margin-bottom: 12px;
    cursor: pointer; transition: all 0.2s;
}
.search-results .result-item:hover { border-color: var(--accent); transform: translateX(4px); }
.result-item .result-title { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.result-item .result-summary { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.result-item .result-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.result-item .result-tag {
    font-size: 11px; padding: 2px 8px; border-radius: 8px;
    background: rgba(255,107,53,0.1); color: var(--accent);
}

/* Notes List */
.notes-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.note-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; cursor: pointer;
    transition: all 0.3s ease; position: relative; overflow: hidden;
}
.note-card:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(255,107,53,0.1); border-color: var(--accent); }
.note-card .note-title { font-size: 15px; font-weight: 500; margin-bottom: 8px; }
.note-card .note-summary { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; line-height: 1.5; }
.note-card .note-footer { display: flex; justify-content: space-between; align-items: center; }
.note-card .note-type {
    font-size: 11px; padding: 3px 8px; border-radius: 6px;
    background: rgba(78,205,196,0.1); color: #4ecdc4;
}
.note-card .note-date { font-size: 12px; color: var(--text-secondary); }

/* Note Detail */
.back-btn {
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-primary); padding: 8px 16px; border-radius: 8px;
    cursor: pointer; font-size: 14px; margin-bottom: 20px;
    display: flex; align-items: center; gap: 6px; transition: all 0.2s;
}
.back-btn:hover { border-color: var(--accent); }
.note-meta { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.note-meta h1 { font-size: 24px; margin-bottom: 12px; }
.note-meta .meta-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.note-meta .meta-info { font-size: 13px; color: var(--text-secondary); }
.note-content { line-height: 1.8; font-size: 15px; }
.note-content h1,.note-content h2,.note-content h3 { margin: 20px 0 10px; color: var(--text-primary); }
.note-content code { background: var(--bg-secondary); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.note-content pre { background: var(--bg-secondary); padding: 16px; border-radius: 8px; overflow-x: auto; margin: 12px 0; }
.note-content a { color: var(--accent); text-decoration: none; }
.note-content ul,.note-content ol { padding-left: 20px; margin: 8px 0; }
.note-backlinks { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }
.note-backlinks h3 { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }
.backlink-item { padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 14px; margin-bottom: 4px; transition: all 0.2s; }
.backlink-item:hover { background: rgba(255,107,53,0.08); }
