
/* 
  页面整体样式设置
  采用深色系为主色调，辅以高对比的亮色作为点缀，营造出高科技与专业感。
  使用CSS变量便于主题切换和色彩管理
*/
:root {
  --primary-color: #1E90FF; /* 主色调-电蓝 */
  --secondary-color: #00FFFF; /* 辅色调-青蓝 */
  --accent-color: #32CD32; /* 点缀色-柠檬绿 */
  --background-color: #0f2027; /* 背景主色-深蓝 */
  --secondary-background: #203a43; /* 辅助背景色-炭灰 */
  --text-color: #FFFFFF; /* 文字颜色-白色 */
  --card-background: #2c5364; /* 卡片背景色 */
  --shadow-color: rgba(0, 0, 0, 0.5); /* 阴影颜色 */
  --transition-speed: 0.3s; /* 过渡速度 */
  --font-family: 'Roboto', sans-serif; /* 字体设置 */
}

/* 暗黑模式下的主题样式 */
body.dark-theme {
  --background-color: #0f2027;
  --secondary-background: #203a43;
  --text-color: #FFFFFF;
}

/* 亮色模式下的主题样式 */
body.light-theme {
  --background-color: #FFFFFF;
  --secondary-background: #f0f0f0;
  --text-color: #000000;
}

/* 全局样式 */
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, var(--background-color), var(--secondary-background));
  color: var(--text-color);
  font-family: var(--font-family);
  transition: background var(--transition-speed) ease, color var(--transition-speed) ease;
}

/* 容器布局使用Flexbox和Grid */
.container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 固定导航栏样式 */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: var(--secondary-background);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px var(--shadow-color);
  z-index: 1000;
}

/* 导航链接样式 */
.navbar a {
  color: var(--text-color);
  text-decoration: none;
  margin: 0 15px;
  font-size: 16px;
  transition: color var(--transition-speed) ease;
}

.navbar a:hover {
  color: var(--secondary-color);
}

/* 侧边栏导航样式 */
.sidebar {
  position: fixed;
  left: 0;
  top: 60px;
  width: 250px;
  height: calc(100% - 60px);
  background: var(--secondary-background);
  transform: translateX(-100%);
  transition: transform var(--transition-speed) ease;
  overflow-y: auto;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li {
  padding: 15px 20px;
  border-bottom: 1px solid #34495e;
}

.sidebar li a {
  color: var(--text-color);
  text-decoration: none;
  display: block;
  font-size: 16px;
}

.sidebar li a:hover {
  background: #34495e;
}

/* 主内容区域样式 */
.main-content {
  margin-top: 60px;
  padding: 20px 30px;
  margin-left: 0;
  transition: margin-left var(--transition-speed) ease;
}

.sidebar.open + .main-content {
  margin-left: 250px;
}

/* 文章样式 */
article {
  max-width: 800px;
  margin: 0 auto;
}

article h2, article h3, article h4 {
  color: var(--secondary-color);
  margin-top: 20px;
  margin-bottom: 10px;
}

article p {
  line-height: 1.6;
  font-size: 16px;
  margin-bottom: 15px;
}

/* 图片样式 */
img.decorative {
  width: 100%;
  max-width: 320px;
  border-radius: 10px;
  box-shadow: 0 4px 6px var(--shadow-color);
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

img.decorative:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 12px var(--shadow-color);
}

/* 代码块样式 */
pre {
  background: var(--secondary-background);
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  margin-bottom: 20px;
}

code {
  color: var(--secondary-color);
  font-family: 'Courier New', Courier, monospace;
  font-size: 15px;
}

/* 按钮样式 */
button.theme-toggle {
  background: var(--primary-color);
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text-color);
  transition: background var(--transition-speed) ease;
}

button.theme-toggle:hover {
  background: var(--secondary-color);
}

/* 悬停效果 */
a:hover, .button:hover {
  transform: scale(1.02);
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .sidebar {
    width: 200px;
  }
  
  .sidebar.open + .main-content {
    margin-left: 200px;
  }
}

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    transform: translateY(-100%);
  }
  
  .sidebar.open {
    transform: translateY(0);
  }
  
  .sidebar.open + .main-content {
    margin-left: 0;
    margin-top: 250px;
  }
}

@media (max-width: 480px) {
  .navbar a {
    margin: 5px 0;
    font-size: 14px;
  }
  
  article h2 {
    font-size: 20px;
  }
  
  article h3, article h4 {
    font-size: 18px;
  }
  
  article p {
    font-size: 14px;
  }
  
  button.theme-toggle {
    padding: 8px 16px;
    font-size: 14px;
  }
}

/* 微交互与动画 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 2s ease-in forwards;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.slide-up {
  animation: slideUp 0.5s ease-out forwards;
}

/* 点缀线条与科技感装饰 */
.decorative-line {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  margin: 20px 0;
  border: none;
}

/* 默认隐藏的折叠区域 */
.collapsible {
  background-color: var(--secondary-background);
  color: var(--text-color);
  cursor: pointer;
  padding: 10px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  font-size: 16px;
  margin-top: 10px;
  border-radius: 5px;
  transition: background var(--transition-speed) ease;
}

.collapsible:hover {
  background: #34495e;
}

.content {
  padding: 0 15px;
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-speed) ease;
  background-color: var(--secondary-background);
  border-radius: 5px;
  margin-bottom: 10px;
}

.content.show {
  max-height: 500px; /* 根据内容长度调整 */
}

/* 高级CSS3效果示例 */
.box-shadow-example {
  box-shadow: 0 4px 8px var(--shadow-color);
  transition: box-shadow var(--transition-speed) ease;
}

.box-shadow-example:hover {
  box-shadow: 0 8px 16px var(--shadow-color);
}

.text-shadow-example {
  text-shadow: 2px 2px 4px var(--shadow-color);
}

/* 章节导航样式 */
.chapter-nav {
  position: fixed;
  top: 100px;
  right: 20px;
  background: var(--secondary-background);
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 2px 4px var(--shadow-color);
}

.chapter-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chapter-nav li {
  margin: 10px 0;
}

.chapter-nav a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 14px;
  transition: color var(--transition-speed) ease;
}

.chapter-nav a:hover {
  color: var(--secondary-color);
}

/* CSS3代码示例样式 */
.code-example {
  background: #1a1a1a;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  margin-bottom: 20px;
}

.code-example code {
  color: #00FFFF;
  font-family: 'Courier New', Courier, monospace;
  font-size: 15px;
}

