/* 智能体认知动力学 - 黑科技主题样式 */

:root {
    --neon-green: #00ffaa;
    --neon-blue: #0088ff;
    --neon-purple: #ff0088;
    --dark-bg: #000000;
    --darker-bg: #0a0a0a;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #888888;
}

/* 全局重置 */
html, body {
    background-color: var(--dark-bg) !important;
    color: var(--text-primary) !important;
    font-family: 'Inter', sans-serif !important;
    margin: 0;
    padding: 0;
}

/* 粒子背景 */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* 侧边栏与布局 */
#mdbook-body-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
    background: var(--dark-bg);
}

.sidebar {
    width: 300px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: rgba(10, 10, 10, 0.98) !important;
    border-right: 1px solid rgba(0, 255, 170, 0.15) !important;
    backdrop-filter: blur(15px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow-y: auto;
}

/* 侧边栏可见/隐藏状态控制 */
.sidebar-visible .sidebar {
    transform: translateX(0);
}

.sidebar-hidden .sidebar {
    transform: translateX(-300px);
}

.page-wrapper {
    flex: 1;
    min-width: 0;
    margin-left: 300px;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: transparent;
    min-height: 100vh;
}

.sidebar-hidden .page-wrapper {
    margin-left: 0;
}

/* 首页全宽处理 */
.index-page .page-wrapper, .full-width {
    margin-left: 0 !important;
}

.index-page .sidebar {
    display: none !important;
}

/* 侧边栏内容样式 */
.sidebar-scrollbox {
    padding: 20px 0;
}

.sidebar ol, .sidebar ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.sidebar li {
    margin: 0 !important;
    padding: 0 !important;
}

.sidebar a {
    display: block !important;
    color: #999 !important;
    padding: 10px 25px !important;
    text-decoration: none !important;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
}

.sidebar a:hover {
    color: var(--neon-green) !important;
    background: rgba(0, 255, 170, 0.05) !important;
    padding-left: 30px !important;
}

.sidebar .active > a, .sidebar a.active {
    color: var(--neon-green) !important;
    background: rgba(0, 255, 170, 0.1) !important;
    border-left-color: var(--neon-green);
    font-weight: 600;
}

/* 响应式布局优化 */
@media (max-width: 1024px) {
    .page-wrapper {
        margin-left: 0 !important;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar-visible .sidebar {
        transform: translateX(0);
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    }
    
    .sidebar-visible .page-wrapper::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.8);
        backdrop-filter: blur(4px);
        z-index: 900;
        animation: fadeIn 0.3s ease;
    }
}

/* 首页隐藏侧边栏 */
.index-page .sidebar {
    display: none !important;
}

.index-page .page-wrapper {
    margin-left: 0 !important;
}

/* 内容区微调 */
.content {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem !important; /* Mobile default padding */
}

.content article {
    line-height: 1.8;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.content h1 { font-size: 2.5rem; margin-top: 3rem; margin-bottom: 2rem; color: #fff; border-bottom: 2px solid var(--neon-green); display: inline-block; padding-bottom: 5px; max-width: 100%; }
.content h2 { font-size: 1.8rem; margin-top: 2.5rem; margin-bottom: 1.5rem; color: #fff; }
.content h3 { font-size: 1.4rem; margin-top: 2rem; margin-bottom: 1rem; color: var(--neon-green); }

.content p { margin-bottom: 1.5rem; }

.content a { color: var(--neon-green); text-decoration: none; border-bottom: 1px dashed var(--neon-green); transition: all 0.2s; }
.content a:hover { color: #fff; border-bottom-style: solid; }

/* 响应式排版 */
@media (max-width: 768px) {
    .content h1 { font-size: 1.8rem; margin-top: 1.5rem; }
    .content h2 { font-size: 1.4rem; margin-top: 1.5rem; }
    .content article { font-size: 1rem; }
    
    /* 确保图片和表格不溢出 */
    .content img, .content table, .content pre {
        max-width: 100%;
        overflow-x: auto;
        display: block;
    }
}

@media (min-width: 1024px) {
    .content {
        padding: 2rem 4rem !important;
    }
}

/* 辉光文本 */
.glow-text {
    text-shadow: 0 0 10px var(--neon-green), 0 0 20px var(--neon-green);
}

/* 首页Hero特定样式 */
.hero-section {
    background: transparent !important;
}

/* 隐藏mdbook默认的导航栏，除非在章节页 */
.index-page .sidebar, .index-page .nav-chapters {
    display: none !important;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fadeIn {
    animation: fadeIn 1s ease-out forwards;
}

/* 章节页工具栏 */
header {
    background: rgba(0, 0, 0, 0.8) !important;
    backdrop-filter: blur(5px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 代码块 */
pre {
    background: #0f0f0f !important;
    border: 1px solid rgba(0, 255, 170, 0.2) !important;
    border-radius: 12px !important;
}

code {
    font-family: 'Fira Code', monospace !important;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #000;
}
::-webkit-scrollbar-thumb {
    background: #222;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--neon-green);
}

/* 书籍内容中的列表和图片 */
.content main ul {
    list-style: none;
    padding-left: 0;
}

.content main li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.content main img {
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 255, 170, 0.2);
}
