
/* 全局样式设置 */
/* 使用box-sizing: border-box确保元素在设置宽高时包含padding和border */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 设置body的背景色为深蓝到黑色的渐变，增加科技感 */
body {
    background: linear-gradient(135deg, #000000, #000080);
    color: #ffffff;
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    font-size: 16px;
    overflow-x: hidden; /* 防止出现水平滚动条 */
}

/* 顶部导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* 导航栏品牌标识 */
.navbar .brand {
    font-size: 1.5em;
    font-weight: bold;
    color: #1E90FF;
    text-decoration: none;
}

/* 导航栏链接样式 */
.navbar .nav-links a {
    margin-left: 20px;
    color: #ffffff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.navbar .nav-links a:hover {
    color: #FF4500;
}

/* 侧边栏样式 */
.sidebar {
    position: fixed;
    top: 70px; /* 导航栏高度 */
    left: 0;
    width: 250px;
    height: calc(100% - 70px);
    background-color: rgba(0, 0, 0, 0.9);
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.5);
}

.sidebar a {
    display: block;
    color: #ffffff;
    text-decoration: none;
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.sidebar a:hover {
    background-color: #1E90FF;
}

/* 主内容区样式 */
.content {
    margin-left: 270px; /* 侧边栏宽度 + 一些间距 */
    padding: 20px;
}

/* 章节导航栏样式 */
.chapter-nav {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.chapter-nav a {
    background-color: #1E90FF;
    color: #ffffff;
    padding: 10px 15px;
    margin-right: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.chapter-nav a:hover {
    background-color: #FF4500;
}

/* 文章内容样式 */
article h2 {
    font-size: 2em;
    margin-bottom: 15px;
    color: #FFD700;
}

article section {
    margin-bottom: 30px;
}

article p {
    margin-bottom: 15px;
    font-size: 1em;
    color: #ffffff;
}

/* 代码示例样式 */
code {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
}

pre {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 20px;
    position: relative;
}

/* 为代码块添加滚动条样式 */
pre::-webkit-scrollbar {
    width: 8px;
}

pre::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

pre::-webkit-scrollbar-thumb {
    background-color: #1E90FF;
    border-radius: 4px;
}

/* 添加代码块标题 */
pre::before {
    content: "CSS代码示例";
    position: absolute;
    top: -20px;
    left: 15px;
    background-color: #1E90FF;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* 图片样式 */
img {
    width: 100%;
    max-width: 320px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 12px rgba(0,0,0,0.7);
}

/* 卡片式设计 */
.card {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0,0,0,0.5);
}

/* 提示信息样式 */
.notice {
    background-color: rgba(255, 215, 0, 0.2);
    padding: 15px;
    border-left: 5px solid #FFD700;
    margin-bottom: 30px;
    border-radius: 5px;
    font-size: 1.1em;
}

/* 粒子动画容器 */
.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* 粒子样式 */
.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    animation: float 15s linear infinite;
}

/* 粒子运动动画 */
@keyframes float {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-1000px) translateX(500px);
        opacity: 0;
    }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .sidebar {
        width: 200px;
    }

    .content {
        margin-left: 220px;
    }
}

@media (max-width: 992px) {
    .navbar {
        padding: 10px 20px;
    }

    .sidebar {
        display: none;
    }

    .content {
        margin-left: 20px;
    }

    .chapter-nav {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .navbar .nav-links a {
        margin-left: 10px;
        font-size: 0.9em;
    }

    .chapter-nav a {
        padding: 8px 12px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .navbar .brand {
        font-size: 1.2em;
    }

    .card {
        padding: 15px;
    }

    .notice {
        font-size: 1em;
    }
}

/* 动画过渡效果 */
.button {
    background-color: #1E90FF;
    border: none;
    padding: 10px 20px;
    color: #ffffff;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.button:hover {
    background-color: #FF4500;
    transform: scale(1.05);
}

/* 数据可视化图表样式 */
.chart {
    display: flex;
    align-items: flex-end;
    height: 300px;
    background: linear-gradient(to top, #000080, #1E90FF);
    padding: 20px;
    border-radius: 10px;
}

.bar {
    width: 40px;
    margin: 0 10px;
    background-color: #FF4500;
    transition: height 0.5s ease, background-color 0.3s ease;
}

.bar:hover {
    background-color: #FFD700;
}

