/* 全局样式重置+基础配置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  list-style: none;
  text-decoration: none;
  font-family:
    "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; /* 增加系统字体 */
}

:root {
  /* 主题色变量 */
  --primary-color: #4cc9f0;
  --primary-light: rgba(76, 201, 240, 0.1);
  --primary-dark: #3dafe0; /* 新增深色变体 */
  --border-color: #e2e8f0;
  --text-color: #333;
  --text-light: #94a3b8;
  --text-lighter: #cbd5e1; /* 新增更浅文本色 */
  --bg-color: #f8fafc;
  --white: #fff;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  /* 尺寸变量 */
  --header-height: 80px;
  --container-max-width: 1200px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  min-width: 320px;
  line-height: 1.6;
}

a {
  color: var(--text-color);
  transition: all 0.3s ease;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  /* 防止布局偏移 */
  aspect-ratio: attr(width) / attr(height);
  object-fit: cover;
}

/* 容器统一样式 */
.header,
.main {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* 头部样式 */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  transition: height 0.3s ease;
}

/* logo样式 */
.logo a img {
  height: 40px;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.logo a:hover img {
  transform: scale(1.05);
}

/* 导航+搜索 父容器 */
.nav-search {
  display: flex;
  align-items: center;
  gap: 40px;
}

/* 导航样式 */
.nav ul {
  display: flex;
  gap: 25px;
  align-items: center;
}

.nav ul li {
  display: flex;
  align-items: center;
  height: auto;
}

/* 下拉菜单容器 */
.nav ul li.dropdown {
  position: relative;
  display: inline-block;
}

/* 下拉菜单切换按钮样式 */
.nav ul li a.dropdown-toggle {
  font-size: 16px;
  font-weight: 500;
  padding: 5px 0;
  border-bottom: 2px solid transparent;
  position: relative;
  display: flex;
  align-items: center;
}

.nav ul li a.dropdown-toggle::after {
  content: " ▼"; /* 添加下拉箭头 */
  font-size: 10px;
  margin-left: 5px;
  transition: transform 0.3s ease;
}

.nav ul li a.dropdown-toggle:hover::after {
  transform: rotate(180deg); /* 悬停时箭头翻转 */
}

/* 下拉菜单样式 */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--white);
  min-width: 160px;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  list-style-type: none;
  margin: 0;
  padding: 5px 0;
  border-radius: 4px;
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition:
    max-height 0.3s ease,
    opacity 0.3s ease,
    visibility 0.3s ease;
  white-space: nowrap;
}

/* 鼠标悬停时显示下拉菜单 */
.dropdown:hover .dropdown-menu {
  max-height: 300px;
  opacity: 1;
  visibility: visible;
}

.dropdown-menu li {
  margin: 0;
  display: block;
}

.dropdown-menu li a {
  display: block;
  padding: 10px 15px;
  text-decoration: none;
  color: var(--text-color);
  font-size: 14px;
  font-weight: normal;
  border-bottom: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.dropdown-menu li a:hover {
  background-color: var(--primary-light);
  color: var(--primary-color);
  padding-left: 20px;
}

.dropdown-menu li a::after {
  display: none; /* 隐藏下拉菜单项的下划线动画 */
}

/* 搜索框样式 */
.search form {
  position: relative;
  display: flex; /* 确保按钮和输入框对齐 */
}

.search input {
  width: 220px;
  height: 36px;
  padding: 0 15px 0 40px;
  border: 1px solid #cbd5e1;
  border-radius: 18px 0 0 18px; /* 左侧圆角 */
  outline: none;
  font-size: 14px;
  background-color: var(--white);
  transition: all 0.3s ease;
}

.search form::before {
  content: "🔍";
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 14px;
  z-index: 1;
}

.search-btn {
  height: 36px;
  padding: 0 15px;
  border: 1px solid var(--primary-color);
  border-left: none; /* 移除左侧边框 */
  border-radius: 0 18px 18px 0; /* 右侧圆角 */
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.search-btn:hover {
  background-color: var(--primary-dark);
}

.search input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-light);
  width: 260px;
}

.search input::placeholder {
  color: var(--text-light);
}

/* 主体区域 */
.main {
  min-height: calc(100vh - var(--header-height) - 110px);
  padding: var(--spacing-lg) var(--spacing-md);
  display: flex;
  gap: var(--spacing-lg);
}

/* 文章列表样式 */
.content {
  flex: 1;
}

.article {
  background: var(--white);
  border-radius: 8px;
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.article:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.article-title a {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 12px;
  display: block;
}

.article-title a:hover {
  color: var(--primary-color);
}

.article-intro {
  /* 修正类名大小写 */
  margin: 10px 0;
  color: var(--text-light);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.article-info {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  font-size: 14px;
  color: var(--text-light);
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}

.article-tags a {
  color: var(--text-light);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 5px;
  font-size: 12px;
}

.article-tags a:hover {
  background: var(--primary-color);
  color: var(--white);
}

/* 侧边栏样式 */
.sidebar {
  width: 300px;
  flex-shrink: 0;
}

.sidebar-widget {
  background: var(--white);
  border-radius: 8px;
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

.sidebar-widget h3 {
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--border-color);
  font-size: 18px;
}

.latest-articles li {
  margin-bottom: var(--spacing-sm);
  padding-left: 10px;
  position: relative;
}

.latest-articles li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary-color);
}

.latest-articles li a:hover {
  color: var(--primary-color);
  padding-left: 3px;
}

.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags-cloud a {
  transition: all 0.2s ease;
}

.tags-cloud a:hover {
  color: var(--primary-color);
  transform: scale(1.05);
}

/* 分页样式 */
.page {
  margin-top: 30px;
  text-align: center;
}

.page a {
  display: inline-block;
  padding: 6px 12px;
  margin: 0 4px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: all 0.3s ease;
}

.page a:hover,
.page a.active {
  background: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color);
}

/* 清除浮动类 */
.clear::after {
  content: "";
  display: table;
  clear: both;
}

/* 页脚样式增强 */
.footer-content {
  padding: var(--spacing-lg) 0;
  text-align: center;
}

.footer-links {
  margin-top: var(--spacing-sm);
}

.footer-links a {
  color: var(--text-light);
  margin: 0 5px;
}

.footer-links a:hover {
  color: var(--primary-color);
}

/* 回到顶部按钮 */
#backToTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  z-index: 100;
}

#backToTop:hover {
  background-color: var(--primary-dark);
  transform: translateY(-3px);
}

/* 响应式适配 */
@media (max-width: 768px) {
  :root {
    --header-height: 70px;
    --spacing-lg: 16px;
  }

  .nav-search {
    gap: 20px;
  }

  .nav ul {
    gap: 15px;
  }

  .nav ul li a {
    font-size: 15px;
  }

  .search input {
    width: 180px;
  }

  .main {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }
}

@media (max-width: 576px) {
  .header {
    flex-wrap: wrap;
    height: auto;
    padding: 15px;
    gap: 10px;
    justify-content: center;
  }

  .nav-search {
    width: 100%;
    justify-content: center;
    gap: 15px;
  }

  .search input {
    width: 150px;
  }

  .article-title a {
    font-size: 18px;
  }

  /* 移动端隐藏部分元素 */
  .article-author {
    display: none;
  }
}

.article-title {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.about-content {
  line-height: 1.8;
  font-size: 16px;
  color: var(--text-color);
}

.about-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--primary-color);
  display: inline-block;
}

.about-box {
  background: var(--white);
  border-radius: 8px;
  padding: var(--spacing-lg) 25px;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--spacing-lg);
}

.about-box p {
  margin-bottom: var(--spacing-md);
  text-indent: 2em;
}

.about-info {
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-md);
  border-top: 1px dashed var(--border-color);
}

.about-info ul {
  margin-left: 1em;
}

.about-info li {
  list-style: disc;
  margin-bottom: 8px;
  color: var(--text-light);
}
