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

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
  background: linear-gradient(to bottom, #f5f7fa 0%, #e9ecef 100%);
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
}

/* 导航栏增强 */
nav {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 15px rgba(102, 126, 234, 0.3);
}

nav .nav-container {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

nav a {
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  white-space: nowrap;
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.logo {
  font-size: 1.6rem;
  font-weight: bold;
  color: white;
  margin-right: 1.5rem;
  white-space: nowrap;
  flex-shrink: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* 响应式优化 */
@media (max-width: 768px) {
  nav .nav-container {
    padding: 0 0.5rem;
  }

  nav a {
    padding: 0.4rem 0.3rem;
    font-size: 0.85rem;
  }

  .logo {
    font-size: 1.2rem;
    margin-right: 0.5rem;
  }
}

/* 卡片样式增强 */
.video-card,
.video-item,
.topic-card,
.related-card {
  transition: all 0.3s ease;
}

.video-card:hover,
.video-item:hover,
.topic-card:hover,
.related-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 按钮样式 */
button,
.btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

button:hover,
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 返回顶部按钮 */
#backToTop {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  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 ease;
  z-index: 999;
}

#backToTop:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#backToTop.show {
  display: flex;
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

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

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

/* 加载动画 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(102, 126, 234, 0.3);
  border-radius: 50%;
  border-top-color: #667eea;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 移动端优化 */
@media (max-width: 768px) {
  .container {
    padding: 0 0.8rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  .video-grid,
  .related-grid,
  .topic-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
  }

  #backToTop {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
  }
}

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

  body {
    background: white;
  }
}
