/* CSS 变量与设计系统 */
:root {
    /* 默认亮色模式 (Light Theme) - 精致明亮毛玻璃 */
    --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 50%, #dbeafe 100%);
    --panel-bg: rgba(255, 255, 255, 0.45);
    --panel-border: rgba(255, 255, 255, 0.6);
    --panel-border-subtle: rgba(241, 245, 249, 0.8);
    --sidebar-bg: rgba(248, 250, 252, 0.65);
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-hover-bg: rgba(255, 255, 255, 0.9);
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --accent: #2563eb;
    --accent-light: #eff6ff;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.08);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --border-radius-sm: 10px;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --scroll-bar-color: rgba(15, 23, 42, 0.15);
    --sidebar-width: 380px;
}

[data-theme="dark"] {
    /* 暗色模式 (Dark Theme) - 靛蓝夜空霓虹 */
    --bg-gradient: linear-gradient(135deg, #090d16 0%, #0f172a 50%, #1e1b4b 100%);
    --panel-bg: rgba(15, 23, 42, 0.55);
    --panel-border: rgba(255, 255, 255, 0.05);
    --panel-border-subtle: rgba(255, 255, 255, 0.02);
    --sidebar-bg: rgba(10, 15, 30, 0.45);
    --card-bg: rgba(30, 41, 59, 0.45);
    --card-hover-bg: rgba(30, 41, 59, 0.65);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --accent: #38bdf8;
    --accent-light: rgba(56, 189, 248, 0.1);
    --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #a855f7 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.25);
    --scroll-bar-color: rgba(255, 255, 255, 0.1);
}

/* 全局与排版重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 核心网格布局 */
#app-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--scroll-bar-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* 1. 左侧栏 (Sidebar) */
#sidebar {
    width: var(--sidebar-width);
    height: 100%;
    background: var(--sidebar-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-right: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: var(--shadow-glow);
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 明暗切换按钮 */
.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--panel-border);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}
.theme-toggle:hover {
    transform: scale(1.05);
    background: var(--card-hover-bg);
    box-shadow: var(--shadow-sm);
}
.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}
.theme-toggle .sun-icon { display: none; }
[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

/* 搜索与过滤区域 */
.sidebar-search-filter {
    padding: 20px 24px;
    border-bottom: 1px solid var(--panel-border-subtle);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border-radius: 14px;
    border: 1px solid var(--panel-border);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.search-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

/* 标签云 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 110px;
    overflow-y: auto;
    padding-right: 4px;
}

.tag-btn {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--card-bg);
    border: 1px solid var(--panel-border);
    color: var(--text-secondary);
    cursor: pointer;
}

.tag-btn:hover {
    background: var(--card-hover-bg);
    color: var(--text-primary);
}

.tag-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

/* 归档列表 */
.archive-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.archive-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
    padding-left: 4px;
}

.archive-item {
    background: var(--card-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-md);
    padding: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.archive-item:hover {
    transform: translateY(-2px);
    background: var(--card-hover-bg);
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.archive-item.active {
    border-left: 4px solid var(--accent);
    background: var(--card-hover-bg);
    box-shadow: var(--shadow-md);
}

.archive-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.archive-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.archive-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-family: var(--font-mono);
}

.archive-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mini-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--panel-border-subtle);
    color: var(--text-muted);
    border: 1px solid var(--panel-border);
}

/* 2. 主展示页 (Main Area) */
#main-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    padding: 40px;
    position: relative;
    background: transparent;
    z-index: 5;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* 骨架屏 / Loading / 空状态 */
.status-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--panel-border);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.status-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* 文章头部 */
.article-header {
    margin-bottom: 32px;
}

.topic-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.query-badge {
    background: var(--accent-light);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.query-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.topic-title {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.25;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
}

/* AI 综述卡片 */
.synthesis-card {
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-lg);
    padding: 28px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.synthesis-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-gradient);
}

.synthesis-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 14px;
}

.synthesis-content {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* 平台板块布局 */
.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feed-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

/* 各平台卡片样式 */
.feed-card {
    background: var(--card-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.feed-card:hover {
    transform: translateY(-2px);
    background: var(--card-hover-bg);
    box-shadow: var(--shadow-md);
}

.feed-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.platform-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
}

.platform-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
}

/* 平台色彩定制 */
.platform-reddit { color: #ff4500; }
.platform-hn { color: #ff6600; }
.platform-github { color: var(--text-primary); }
.platform-polymarket { color: #0066cc; }
.platform-x { color: var(--text-primary); }
.platform-youtube { color: #ff0000; }

.feed-metric {
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-mono);
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--panel-border-subtle);
    border: 1px solid var(--panel-border);
}

.feed-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
}

.feed-card-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.feed-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--panel-border-subtle);
}

.feed-author {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.feed-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.feed-link:hover {
    text-decoration: underline;
}

.feed-link svg {
    width: 14px;
    height: 14px;
}

/* 页面底部与归档说明 */
.export-section {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.export-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-gradient);
    color: white;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.export-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.export-btn svg {
    width: 16px;
    height: 16px;
}

/* 移动端菜单开关 (响应式) */
.menu-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    border: none;
    box-shadow: var(--shadow-glow);
    z-index: 100;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* 3. 响应式布局优化 (Responsive Breakpoints) */
@media (max-width: 900px) {
    #sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        width: 320px;
        transition: left 0.3s ease;
    }
    
    #sidebar.open {
        left: 0;
        box-shadow: 0 0 40px rgba(0,0,0,0.5);
    }
    
    #main-content {
        padding: 24px;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .topic-title {
        font-size: 1.75rem;
    }
}
