
/* 
  全局样式设置
  设置页面的整体字体、背景及基本颜色
*/
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #81C784 0%, #D7CCC8 70%, #03A9F4 95%);
  color: #607D8B;
  font-family: 'Roboto', sans-serif;
  line-height: 1.6;
}

/* 
  布局容器
  使用Flexbox和Grid实现响应式布局
*/
.container {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  padding: 40px;
  max-width: 1920px;
  margin: 0 auto;
}

/* 
  头部样式
  设置导航栏及其子元素的样式
*/
.header {
  grid-column: span 12;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(215, 204, 200, 0.8);
  padding: 20px 40px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header .logo {
  font-size: 24px;
  font-weight: bold;
  color: #81C784;
}

.navbar {
  display: flex;
  gap: 20px;
}

.navbar a {
  text-decoration: none;
  color: #607D8B;
  font-size: 16px;
  transition: color 0.3s;
}

.navbar a:hover {
  color: #03A9F4;
}

/* 
  主内容区样式
  定义主要内容区的样式，包括文章和侧边栏
*/
.main-content {
  grid-column: span 9;
  background: rgba(255, 255, 255, 0.8);
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.sidebar {
  grid-column: span 3;
  background: rgba(215, 204, 200, 0.8);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.sidebar h3 {
  font-size: 18px;
  margin-bottom: 15px;
  color: #03A9F4;
}

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

.sidebar ul li {
  margin-bottom: 10px;
}

.sidebar ul li a {
  text-decoration: none;
  color: #607D8B;
  transition: color 0.3s;
}

.sidebar ul li a:hover {
  color: #81C784;
}

/* 
  图片样式
  设置装饰性图片的样式，如圆角、阴影和悬停效果
*/
.image-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 20px;
}

.image-gallery img {
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

.image-gallery img:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

/* 
  文章样式
  设置文章内部元素的样式，如标题、段落和表格
*/
article h2 {
  font-size: 28px;
  color: #81C784;
  margin-bottom: 20px;
  position: relative;
}

article h2::after {
  content: '';
  display: block;
  width: 50px;
  height: 4px;
  background: #03A9F4;
  margin-top: 10px;
  border-radius: 2px;
}

article h3 {
  font-size: 22px;
  color: #03A9F4;
  margin-top: 30px;
  margin-bottom: 15px;
}

article p {
  font-size: 16px;
  margin-bottom: 15px;
  text-align: justify;
}

article pre {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 20px;
}

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

article table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

article table, article th, article td {
  border: 1px solid #ddd;
}

article th, article td {
  padding: 12px;
  text-align: left;
}

article th {
  background-color: #81C784;
  color: white;
}

article tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* 
  按钮样式
  定义按钮的基本样式及交互效果
*/
.button {
  background: #81C784;
  color: #ffffff;
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s, transform 0.3s;
  position: relative;
  overflow: hidden;
}

.button:hover {
  background: #66BB6A;
  transform: scale(1.05);
}

.button::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: rgba(255, 255, 255, 0.3);
  opacity: 0;
  transition: opacity 0.3s;
}

.button:active::after {
  opacity: 1;
}

/* 
  轮播区样式
  定义轮播区域的布局与动画效果
*/
.carousel {
  position: relative;
  overflow: hidden;
  height: 400px;
  margin-top: 30px;
  border-radius: 8px;
}

.carousel-item {
  display: none;
  animation: fadeIn 1s ease-in-out;
}

.carousel-item.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* 
  数据可视化样式
  设置图表容器的样式
*/
.chart-container {
  background: #ffffff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.chart-container canvas {
  width: 100% !important;
  height: auto !important;
}

/* 
  侧边栏快速定位样式
  定义侧边栏的滑动效果及链接样式
*/
.sidebar {
  position: fixed;
  top: 0;
  left: -250px;
  width: 250px;
  height: 100%;
  background-color: rgba(215, 204, 200, 0.9);
  transition: left 0.3s;
  z-index: 1000;
}

.sidebar.active {
  left: 0;
}

.sidebar a {
  display: block;
  padding: 15px 20px;
  color: #607D8B;
  text-decoration: none;
  transition: background 0.3s;
}

.sidebar a:hover {
  background: #A5D6A7;
}

/* 
  响应式设计
  使用媒体查询确保页面在不同设备上的良好显示
*/
@media (max-width: 1200px) {
  .container {
    grid-template-columns: repeat(8, 1fr);
  }
}

@media (max-width: 992px) {
  .container {
    grid-template-columns: repeat(6, 1fr);
  }
  .sidebar {
    display: none;
  }
  .main-content {
    grid-column: span 6;
  }
}

@media (max-width: 768px) {
  .container {
    grid-template-columns: repeat(4, 1fr);
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }
  .navbar {
    flex-direction: column;
    width: 100%;
  }
  .navbar a {
    margin: 10px 0;
  }
  .image-gallery {
    flex-direction: column;
    align-items: center;
  }
}

/* 
  高级CSS3特性应用
  包括阴影效果、渐变线条、关键帧动画等
*/
.box-shadow-effect {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.text-shadow-effect {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.gradient-line {
  height: 4px;
  background: linear-gradient(90deg, #81C784, #03A9F4);
  border-radius: 2px;
  margin: 20px 0;
}

.animated-element {
  animation: move 5s infinite alternate;
}

@keyframes move {
  from { transform: translateX(0); }
  to { transform: translateX(20px); }
}

/* 
  提示信息样式
  显著位置显示设计参考提示
*/
.design-reference {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(255, 235, 59, 0.9);
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  color: #000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}


