
/* 全局样式设置 */
body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif; /* 使用现代无衬线字体 */
    background: linear-gradient(135deg, #2a5298 70%, #ff7e5f 25%, #feb47b 5%); /* 黄金比配色 */
    color: #333;
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(30, 60, 114, 0.9); /* 半透明背景 */
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.navbar a {
    color: #fff;
    text-decoration: none;
    margin: 0 15px;
    position: relative;
}

.navbar a:hover::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: #feb47b;
    bottom: -5px;
    left: 0;
}

/* 导航菜单下拉样式 */
.nav-menu {
    list-style: none;
    display: flex;
    gap: 20px;
}

.nav-menu li {
    position: relative;
}

.nav-menu li ul {
    display: none;
    position: absolute;
    top: 35px;
    left: 0;
    background: #2a5298;
    list-style: none;
    padding: 10px 0;
    border-radius: 4px;
}

.nav-menu li:hover ul {
    display: block;
}

.nav-menu li ul li {
    padding: 10px 20px;
}

.nav-menu li ul li a:hover {
    background: #1e3c72;
}

/* 页面主体样式 */
.main {
    padding: 100px 20px 50px 20px; /* 顶部留出导航栏空间 */
    max-width: 1200px;
    margin: 0 auto;
}

/* 章节导航样式 */
.chapter-nav {
    position: fixed;
    top: 100px;
    right: 20px;
    background: rgba(30, 60, 114, 0.8);
    padding: 10px;
    border-radius: 8px;
}

.chapter-nav a {
    display: block;
    color: #fff;
    margin: 5px 0;
    text-decoration: none;
}

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

/* 文章内容样式 */
article {
    background: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

article h2, article h3, article h4 {
    color: #1e3c72;
}

article p {
    line-height: 1.8;
    margin-bottom: 15px;
}

article pre {
    background: #282c34;
    color: #61dafb;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 15px;
}

article code {
    font-family: 'Courier New', Courier, monospace;
}

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

img.decorative:hover {
    transform: scale(1.05);
}

/* 按钮样式 */
.button-primary {
    background: linear-gradient(45deg, #ff7e5f, #feb47b);
    border: none;
    color: white;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 25px;
    transition: background 0.3s ease, transform 0.3s ease;
}

.button-primary:hover {
    background: linear-gradient(45deg, #feb47b, #ff7e5f);
    transform: scale(1.05);
}

.button-primary:active {
    transform: scale(0.95);
}

/* 背景动效 */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f0f4f8;
    overflow: hidden;
    z-index: -1;
}

.background::before {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(30, 60, 114, 0.2);
    border-radius: 50%;
    top: 10%;
    left: 25%;
    animation: moveBackground 10s linear infinite;
}

@keyframes moveBackground {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(100px, 50px) rotate(180deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

/* 模块样式 */
.container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.module {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.module:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 12px rgba(0,0,0,0.2);
}

/* 折叠区域样式 */
.collapsible {
    background-color: #f9f9f9;
    border: none;
    cursor: pointer;
    padding: 10px;
    width: 100%;
    text-align: left;
    outline: none;
    font-size: 16px;
    border-radius: 5px;
    transition: background 0.3s ease;
}

.collapsible:hover {
    background-color: #e2e2e2;
}

.content {
    padding: 0 15px;
    display: none;
    overflow: hidden;
    background-color: #f1f1f1;
    border-radius: 5px;
    margin-bottom: 10px;
}

/* CSS3代码示例样式 */
.css-example {
    background: #282c34;
    color: #61dafb;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    overflow-x: auto;
    margin: 20px 0;
}

/* 脚本引入 */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .chapter-nav {
        position: static;
        margin-top: 20px;
    }
}

