:root {
    --bg-main: #0b0f19;
    --bg-sidebar: rgba(17, 24, 39, 0.7);
    --card-glass: rgba(30, 41, 59, 0.45);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-muted: #9ca3af;
    --accent-color: #3b82f6;
    --accent-hover: #60a5fa;
    --highlight-bg: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.2s, border-color 0.2s;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 移动端顶栏隐藏 */
.mobile-header {
    display: none;
}

/* 优雅的侧边栏 */
.sidebar {
    width: 300px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--card-border);
    padding: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.sidebar-brand h1 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 四宫格仪表盘统计 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-card {
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid var(--card-border);
    padding: 12px;
    border-radius: 12px;
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-hover);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* 分类树样式 */
.nav-section h2 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.category-tree {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tree-node {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    text-align: left;
}

.tree-node:hover, .tree-node.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-hover);
}

.tree-count {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
    color: var(--text-muted);
}

/* 标签云 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cloud-tag {
    color: var(--text-muted);
    text-decoration: none;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    cursor: pointer;
}

.cloud-tag:hover {
    background: var(--accent-color);
    color: white;
}

/* 主容器 */
main {
    flex: 1;
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* 搜索框吸顶效果 */
.search-sticky-wrapper {
    position: sticky;
    top: 20px;
    z-index: 90;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 0 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.search-icon {
    width: 20px;
    height: 20px;
    fill: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 16px 12px;
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    outline: none;
}

/* 页面内容区块格式 */
.content-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.badge {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-hover);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* 书签卡片网格布局 */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* 奢华毛玻璃卡片 */
.card {
    background: var(--card-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.card:hover {
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.card a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.card a:hover {
    color: var(--accent-hover);
}

.card .desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

.tag {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    padding: 3px 8px;
    border-radius: 6px;
}

/* 检索即时高亮特型 */
.highlight {
    background-color: var(--highlight-bg);
    color: #000;
    border-radius: 2px;
    padding: 0 2px;
    font-weight: bold;
}

/* 响应式抽屉与小屏幕兼容 */
@media (max-width: 850px) {
    body {
        flex-direction: column;
    }

    .mobile-header {
        display: flex;
        align-items: center;
        background: #111827;
        padding: 0 20px;
        height: 60px;
        position: sticky;
        top: 0;
        z-index: 110;
        border-bottom: 1px solid var(--card-border);
    }

    .mobile-menu-btn {
        font-size: 24px;
        cursor: pointer;
        color: white;
        margin-right: 15px;
    }

    .mobile-title {
        font-weight: bold;
        font-size: 16px;
    }

    /* 抽屉化侧栏 */
    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        bottom: 0;
        z-index: 120;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 5px 0 25px rgba(0,0,0,0.5);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.6);
        backdrop-filter: blur(4px);
        z-index: 115;
    }

    .sidebar-overlay.show {
        display: block;
    }

    main {
        padding: 20px;
    }
}