/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 导航栏样式 */
nav {
  background: #2c3e50;
  color: white;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
}

nav .logo {
  font-size: 1.5em;
  font-weight: bold;
  padding: 15px 0;
  white-space: nowrap;
  color: white;
  text-decoration: none;
}

nav ul {
  display: flex;
  list-style: none;
  flex-wrap: nowrap;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
}

nav ul li {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
}

nav ul li a {
  color: white;
  text-decoration: none;
  padding: 15px 10px;
  display: block;
  transition: background 0.3s, color 0.3s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.95em;
}

nav ul li a:hover,
nav ul li a.active {
  background: #34495e;
}

/* 移动端导航优化 */
@media (max-width: 768px) {
  nav ul li {
    flex: 1 1 0;
    min-width: 0;
  }

  nav ul li a {
    padding: 15px 5px;
    font-size: 0.85em;
  }

  nav .logo {
    font-size: 1.2em;
  }
}

/* 主内容区域 */
main {
  min-height: 60vh;
}

/* 卡片样式 */
.card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* 按钮样式 */
.btn {
  display: inline-block;
  padding: 10px 25px;
  background: #3498db;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  transition: background 0.3s;
  border: none;
  cursor: pointer;
  font-size: 1em;
}

.btn:hover {
  background: #2980b9;
}

/* 标签样式 */
.tag {
  display: inline-block;
  background: #ecf0f1;
  padding: 5px 12px;
  border-radius: 15px;
  margin: 5px 5px 0 0;
  font-size: 0.9em;
  color: #555;
}

/* 页脚样式 */
footer {
  background: #2c3e50;
  color: white;
  text-align: center;
  padding: 30px 20px;
  margin-top: 60px;
}

footer p {
  margin: 5px 0;
}

/* 响应式布局 */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .container {
    padding: 0 15px;
  }

  h1 {
    font-size: 1.8em !important;
  }

  h2 {
    font-size: 1.4em !important;
  }

  .card {
    padding: 15px;
  }
}

/* UI 风格变体 */
.ui-style-3 {
  --primary-color: #3498db;
  --secondary-color: #2c3e50;
  --accent-color: #e74c3c;
}

/* 返回顶部按钮 */
#backToTop {
  position: fixed;
  bottom: 40px;
  right: 40px;
  background: #3498db;
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: all 0.3s;
  z-index: 999;
  border: none;
  font-size: 20px;
}

#backToTop:hover {
  background: #2980b9;
  transform: translateY(-5px);
}

#backToTop.show {
  display: flex;
}

@media (max-width: 768px) {
  #backToTop {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }
}

/* 加载动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* 打印样式 */
@media print {
  nav, footer, #backToTop {
    display: none;
  }

  body {
    background: white;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
