.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

body {
  transition: all 0.3s ease; /* 平滑过渡效果 */
}

/* 日间模式默认样式 */
.tag-hero {
  background: linear-gradient(135deg, #f8f9fa 0%, #e2e8f0 100%);
  padding: 4rem 0 2rem; /* 增加顶部内边距以避免遮挡 */
  margin-bottom: 1.5rem;
  position: relative; /* 添加定位上下文 */
}
.tag-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}
.tag-title {
  font-size: 1.75rem;
  text-align: center;
  margin-bottom: 1rem;
  font-weight: 700;
  color: #1e293b;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  letter-spacing: 0.5px;
  position: relative; /* 确保标题不被其他固定元素遮挡 */
  z-index: 10; /* 提升层级 */
}
.tag-description {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #64748b;
  line-height: 1.6;
  font-size: 0.9rem;
}
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.breadcrumb a {
  color: #3b82f6;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  transition: background-color 0.3s;
}
.breadcrumb a:hover {
  background-color: rgba(59, 130, 246, 0.1);
}
.breadcrumb span {
  color: #64748b;
}

.tag-filter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-direction: column;
  gap: 1rem;
}
.tag-count {
  font-size: 0.875rem;
  color: #64748b;
}

.tag-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}
.tag-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
  background-color: white;
}
.tag-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.tag-card-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
}
.tag-card-content {
  padding: 1rem;
}
.tag-card-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: #3b82f6;
}
.tag-card-title a {
  text-decoration: none;
  color: inherit;
}
.tag-card-title a:hover {
  text-decoration: underline;
}
.tag-card-meta {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: #64748b;
}
.tag-card-description {
  margin-bottom: 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #334155;
}
.tag-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.card-tag {
  padding: 0.25rem 0.5rem;
  background-color: #e2e8f0;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  color: #64748b;
  transition: background-color 0.3s;
}
.card-tag:hover {
  background-color: #cbd5e1;
  cursor: pointer;
}

.tag-cloud {
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}
.tag-cloud-title {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: #1e293b;
}
.tag-cloud-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.cloud-tag {
  padding: 0.5rem 1rem;
  background-color: #e2e8f0;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  color: #334155;
  transition: background-color 0.3s, color 0.3s;
  text-decoration: none;
}
.cloud-tag:hover {
  background-color: #3b82f6;
  color: white;
}
.cloud-tag.active {
  background-color: #3b82f6;
  color: white;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.pagination-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  background-color: #f1f5f9;
  color: #64748b;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  font-size: 0.9rem;
}
.pagination-item:hover:not(.active) {
  background-color: #e2e8f0;
  transform: translateY(-2px);
}
.pagination-item.active {
  background-color: #3b82f6;
  color: white;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  cursor: default;
}

/* 夜间模式样式 */
body.night-mode {
  background-color: #1a1a1a; /* 深色背景 */
  color: #e5e7eb; /* 浅灰文字 */
}

body.night-mode .tag-hero {
  background: linear-gradient(135deg, #252525 0%, #374151 100%); /* 夜间深灰渐变 */
}

body.night-mode .tag-title,
body.night-mode .tag-cloud-title {
  color: #e5e7eb; /* 浅灰标题 */
}

body.night-mode .tag-description,
body.night-mode .breadcrumb span,
body.night-mode .tag-count,
body.night-mode .tag-card-meta,
body.night-mode .tag-card-description {
  color: #d1d5db; /* 浅灰文字 */
}

body.night-mode .breadcrumb a {
  color: #60a5fa; /* 夜间蓝色链接 */
}

body.night-mode .breadcrumb a:hover {
  background-color: rgba(96, 165, 250, 0.1);
}

body.night-mode .tag-card {
  background-color: #333333; /* 深灰卡片 */
  border-color: #4b5563;
}

body.night-mode .tag-card-title {
  color: #60a5fa; /* 夜间蓝色标题 */
}

body.night-mode .card-tag {
  background-color: #374151; /* 深灰标签 */
  color: #e5e7eb;
}

body.night-mode .card-tag:hover {
  background-color: #4b5563;
}

body.night-mode .tag-cloud {
  background-color: #2d2d2d; /* 深灰背景 */
}

body.night-mode .cloud-tag {
  background-color: #374151; /* 深灰标签 */
  color: #e5e7eb;
}

body.night-mode .cloud-tag:hover,
body.night-mode .cloud-tag.active {
  background-color: #60a5fa; /* 夜间蓝色 */
  color: #1f2937; /* 深色文字以确保对比度 */
}

body.night-mode .pagination-item {
  background-color: #2d2d2d; /* 深灰背景 */
  color: #d1d5db; /* 浅灰文字 */
}

body.night-mode .pagination-item:hover:not(.active) {
  background-color: #3f3f3f;
}

body.night-mode .pagination-item.active {
  background-color: #60a5fa; /* 夜间蓝色 */
  color: #1f2937; /* 深色文字以确保对比度 */
}

/* Tablet (min-width: 768px) */
@media (min-width: 768px) {
  .tag-hero {
    padding: 5rem 0 3rem; /* 增加顶部内边距 */
    margin-bottom: 2rem;
  }
  .tag-title {
    font-size: 2rem;
  }
  .tag-description {
    font-size: 1rem;
  }
  .breadcrumb {
    font-size: 0.9rem;
  }
  .tag-filter {
    flex-direction: row;
  }
  .tag-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .tag-card-image {
    height: 180px;
  }
  .pagination-item {
    min-width: 2.75rem;
    height: 2.75rem;
  }
}

/* Desktop (min-width: 1024px) */
@media (min-width: 1024px) {
  .tag-title {
    font-size: 2.5rem;
  }
  .tag-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .tag-cloud {
    padding: 1.5rem;
  }
  .tag-card-image {
    height: 200px;
  }
}