
/* 全局样式定义 */
:root {
  /* 颜色变量 */
  --primary-color: #30cfd0;
  --secondary-color: #fcb69f;
  --background-color: #0f2027;
  --text-color: #ffffff;
  --font-family: 'Roboto', sans-serif;
  --main-bg-gradient: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
  --button-hover-gradient: linear-gradient(45deg, #ffecd2, #fcb69f);
  --module-bg: #203a43;
  --card-bg: #203a43;
  --navbar-bg: rgba(0, 0, 0, 0.8);
  --submenu-bg: #203a43;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--main-bg-gradient);
  color: var(--text-color);
  font-family: var(--font-family);
  line-height: 1.6;
  overflow-x: hidden;
}

/* 导航栏样式 */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: var(--navbar-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 50px;
  z-index: 1000;
  transition: background 0.3s ease;
}

.navbar:hover {
  background: rgba(0, 0, 0, 1);
}

.navbar .logo {
  font-size: 24px;
  font-weight: bold;
  color: var(--primary-color);
}

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

.navbar .menu-item {
  position: relative;
  cursor: pointer;
}

.navbar .menu-item a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 16px;
  transition: color 0.3s ease;
}

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

.navbar .submenu {
  position: absolute;
  top: 40px;
  left: 0;
  background: var(--submenu-bg);
  display: none;
  flex-direction: column;
  min-width: 150px;
  border-radius: 5px;
  overflow: hidden;
}

.navbar .menu-item:hover .submenu {
  display: flex;
}

.navbar .submenu a {
  padding: 10px 20px;
  color: var(--text-color);
  text-decoration: none;
  transition: background 0.3s ease;
}

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

/* 主要内容区样式 */
.main {
  padding: 120px 50px 50px 50px;
  max-width: 1200px;
  margin: 0 auto;
}

/* 章节导航 */
.chapter-nav {
  position: fixed;
  top: 100px;
  right: 50px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chapter-nav a {
  background: var(--primary-color);
  color: var(--text-color);
  padding: 10px 15px;
  border-radius: 5px;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.3s ease;
}

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

/* 文章内容样式 */
article {
  background: rgba(44, 83, 100, 0.8);
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

article h2, article h3, article h4 {
  color: var(--primary-color);
  margin-bottom: 15px;
}

article p {
  color: #d1e8e2;
  margin-bottom: 20px;
}

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

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

/* 图片样式 */
img.decorative {
  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.decorative:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.7);
}

/* 加载动画样式 */
.loader {
  width: 100px;
  height: 100px;
  margin: 100px auto;
  border: 10px solid #f3f3f3;
  border-top: 10px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1.5s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 按钮样式 */
.btn {
  background: linear-gradient(45deg, var(--primary-color), #330867);
  border: none;
  color: var(--text-color);
  padding: 15px 30px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 10px 2px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.3s ease;
  border-radius: 5px;
}

.btn:hover {
  transform: scale(1.05);
  background: var(--button-hover-gradient);
}

/* 内容模块化布局 */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  padding: 50px 0;
}

.module {
  background: var(--module-bg);
  padding: 20px;
  border-radius: 10px;
  transition: transform 0.3s ease;
}

.module:hover {
  transform: translateY(-10px);
}

.module h4 {
  color: var(--secondary-color);
  margin-bottom: 15px;
}

.module p {
  color: #d1e8e2;
}

/* 测试imonial样式 */
.testimonial {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 50px 0;
  background: #0f2027;
}

.card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  width: calc(33.333% - 40px);
}

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

.card p {
  color: #d1e8e2;
  font-style: italic;
}

.card span {
  display: block;
  margin-top: 10px;
  color: var(--text-color);
  font-weight: bold;
}

/* 联系我们样式 */
.contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 50px 0;
  background: var(--module-bg);
}

.contact form {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
}

.contact input, .contact textarea {
  padding: 15px;
  margin-bottom: 20px;
  border: 2px solid var(--primary-color);
  border-radius: 5px;
  background: #203a43;
  color: var(--text-color);
  transition: border 0.3s ease;
}

.contact input:focus, .contact textarea:focus {
  border: 2px solid var(--secondary-color);
  outline: none;
}

.contact .submit-btn {
  background: linear-gradient(45deg, var(--primary-color), #330867);
  border: none;
  color: var(--text-color);
  padding: 15px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  border-radius: 5px;
}

.contact .submit-btn:hover {
  background: var(--button-hover-gradient);
  transform: scale(1.05);
}

/* CSS代码示例样式 */
.css-example {
  background: #1e2a38;
  padding: 20px;
  border-radius: 5px;
  margin-bottom: 20px;
}

.css-example code {
  display: block;
  color: #30cfd0;
  font-family: 'Courier New', Courier, monospace;
  white-space: pre-wrap;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .navbar {
    padding: 20px;
    flex-direction: column;
    align-items: flex-start;
  }

  .navbar .menu {
    flex-direction: column;
    width: 100%;
  }

  .navbar .menu-item {
    width: 100%;
  }

  .navbar .submenu {
    position: static;
    width: 100%;
  }

  .chapter-nav {
    display: none;
  }

  .card {
    width: 100%;
  }
  
  .content-grid {
    grid-template-columns: 1fr;
    padding: 20px;
  }
}

