﻿/* ========== 全局 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Arial, sans-serif;
}

html, body {
  height: 100%;          /* 让html和body高度撑满整个浏览器窗口 */
  margin: 0;
}

body {
  background-color: #f5f6fa;
  color: #333;
  line-height: 1.6;
  display: flex;         /* 启用弹性布局 */
  flex-direction: column;/* 让内容从上到下竖向排列 */
}

/* ========== 顶部 Banner ========== */
header {
  background: url("banner.jpg") center/cover no-repeat;
  height: 260px;
  flex-shrink: 0;          /* 禁止压缩，保持固定高度 */
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

header::after {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.45);
}

.header-content {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 90%;
  max-width: 1200px;
}

.title-box {
  text-align: left;
}

header h1 {
  font-size: 2.6rem;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

header p {
  font-size: 1.1rem;
}

.forum-link {
  background: #ff6b00;
  color: white;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 25px;
  font-weight: bold;
  transition: 0.3s;
}

.forum-link:hover {
  background: #ffa040;
}

/* ========== 导航栏 ========== */
nav {
  background: #1e2a38;
  display: flex;
  justify-content: space-between; /* ✅ 左右布局 */
  align-items: center;
  padding: 0 40px;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* ✅ 居中区域容器 */
.nav-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

/* ✅ 菜单样式 */
.nav-links {
  list-style: none;
  display: flex;
  gap: 25px;
  margin: 0;
}

.nav-links li {
  position: relative;
}

.nav-links > li > a {
  display: block;
  color: white;
  text-decoration: none;
  padding: 14px 22px;
  font-size: 1rem;
  transition: 0.3s;
}

.nav-links a:hover {
  background: #ff6b00;
}

/* ========== 搜索栏样式 ========== */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 搜索输入框初始隐藏（不占布局空间） */
.search-input {
  position: absolute;          /* ✅ 不参与导航栏布局 */
  right: 30px;                 /* ✅ 相对于搜索图标的位置 */
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  opacity: 0;
  padding: 5px 10px;
  border: 1px solid #ccc;
  border-radius: 20px;
  background-color: white;
  transition: all 0.3s ease;
  pointer-events: none;        /* ✅ 初始不响应点击 */
}

/* 激活后展开输入框 */
.search-container.active .search-input {
  width: 180px;
  opacity: 1;
  pointer-events: auto;        /* ✅ 激活后可输入 */
}

/* 搜索图标 */
.search-icon {
  font-size: 20px;
  cursor: pointer;
  color: #fff; /* ✅ 改成白色 */
  transition: color 0.3s ease;
  z-index: 2;
}

.search-icon:hover {
  color:  #00bfff; /* ✅ 悬浮时淡蓝色高亮 */
}

/* ========== 下拉菜单优化（进阶版） ========== */
.nav-links ul {
  position: absolute;
  top: 48px;
  left: 0;
  background: rgba(30, 42, 56, 0.97);
  min-width: 180px;
  display: none;
  flex-direction: column;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  padding: 4px 0;
}

.nav-links li:hover > ul {
  display: flex;
}

.nav-links ul li {
  border-bottom: 1px solid rgba(180, 180, 180, 0.25);
}

.nav-links ul li:last-child {
  border-bottom: none;
}

.nav-links ul a {
  display: block;
  width: 100%;
  padding: 14px 20px;
  font-size: 0.95rem;
  color: #f0f0f0;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.25s ease, color 0.25s ease;
}

.nav-links ul a:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-radius: 0;
}

/* ========== 主内容区 ========== */
main {
  flex: 1;               /* 关键代码！自动占据剩余的所有空间，把Footer挤到最下面 */
  width: 100%;           /* 必须设置宽度 */
  box-sizing: border-box;/* 防止内边距撑破宽度 */
  max-width: 1200px;
  margin: 30px auto;
  display: flex;
  gap: 20px;
  padding: 0 15px;
}

/* 左侧内容 */
.content {
  flex: 3;
}

/* 右侧广告栏 */
.sidebar {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 80px;
}

.ad-box {
  background: white;
  border: 1px solid #ddd;
  padding: 10px;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  text-align: center;
}

.ad-box img {
  max-width: 100%;
  height: auto;
}

/* ========== 板块内容优化 ========== */
.section {
  background: white;
  margin-bottom: 25px;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.section h2 {
  border-left: 5px solid #ff6b00;
  padding-left: 10px;
  margin-bottom: 15px;
  font-size: 1.5rem;
  color: #1e2a38;
}

/* 文章列表样式 - 统一所有板块 */
.article-list, .home-articles {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* ✅ 固定两列 */
  gap: 20px;
  margin-top: 20px;
}

/* 限制最大显示行数为6行（12个卡片） */
.home-articles {
  max-height: none; /* 不限制高度，通过JS控制数量 */
}

.article-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.article-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.article-card img {
  width: 100%;
  height: 200px; /* ✅ 统一图片比例 */
  object-fit: cover; /* ✅ 图片不被拉伸 */
}

.article-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #222;
  padding: 12px 16px 4px;
  line-height: 1.4;
  text-align: left;
}

.article-card .date {
  font-size: 0.85rem;
  color: #888;
  padding: 0 16px 14px;
  text-align: left;
}

/* 无内容提示样式 */
.no-articles {
  text-align: center;
  color: #888;
  font-style: italic;
  padding: 40px 20px;
  grid-column: 1 / -1;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .article-list, .home-articles {
    grid-template-columns: 1fr;
  }
  
  .section {
    padding: 20px;
  }
}

/* ========== 底部 ========== */
footer {
  background: #1e2a38;
  color: white;
  text-align: center;
  padding: 20px 0;
  font-size: 0.9rem;
  margin-top: 10px;   /* 从原来的30px改小一点，或者改成 0 */
}

/* ========= 详情页扁平化设计 ========= */
.article-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  padding: 30px;
  margin-bottom: 25px;
  border: 1px solid #f0f0f0;
}

/* 文章头部 - 扁平化 */
.article-header {
  text-align: center;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eaeaea;
}

.article-header h2 {
  font-size: 2rem;
  color: #2c3e50;
  margin-bottom: 12px;
  line-height: 1.3;
  font-weight: 700;
}

.article-header .date {
  font-size: 1rem;
  color: #7f8c8d;
  font-style: normal;
}

/* 详情页封面图 - 扁平化 */
.detail-cover {
  width: 100%;
  max-height: 400px;
  object-fit: contain;       /* 改为 contain，确保图片完整可见 */
  background-color: #f5f6fa; /* 填充空白区域，与页面背景色一致（可选） */
  border-radius: 4px;
  margin: 20px 0 30px 0;
  border: 1px solid #f0f0f0;
  box-shadow: none;
}

/* 文章内容区域 - 扁平化 */
.article-content {
  line-height: 1.8;
  margin: 30px 0;
  font-size: 1.05rem;
  color: #2c3e50;
}

.article-content p {
  margin-bottom: 20px;
  text-align: justify;
}

.article-content ul,
.article-content ol {
  margin: 20px 0;
  padding-left: 25px;
  background: transparent;
}

.article-content li {
  margin-bottom: 8px;
  line-height: 1.6;
  padding: 2px 0;
}

.article-content h3,
.article-content h4 {
  margin: 30px 0 15px 0;
  color: #2c3e50;
  border-bottom: 1px solid #eaeaea;
  padding-bottom: 8px;
  font-weight: 600;
}

/* ========== 图片穿插扁平化样式 ========== */
.article-content .article-image-gallery {
  margin: 25px 0;
  text-align: center;
  clear: both;
  background: transparent;
  border: none;
  padding: 0;
}

.article-content .article-image {
  max-width: 60%;
  height: auto;
  border-radius: 4px;
  box-shadow: none;
  transition: all 0.3s ease;
  display: block;
  margin: 0 auto;
  border: 1px solid #f0f0f0;
}

.article-content .article-image:hover {
  transform: scale(1.01);
  border-color: #ddd;
}

/* 图片描述文字样式 */
.image-caption {
  font-size: 0.9rem;
  color: #666;
  text-align: center;
  margin-top: 8px;
  font-style: italic;
}

/* 确保段落和图片之间的间距合理 */
.article-content p + .article-image-gallery,
.article-content .article-image-gallery + p {
  margin-top: 25px;
}

/* 列表和图片之间的间距 */
.article-content ul + .article-image-gallery,
.article-content ol + .article-image-gallery,
.article-content .article-image-gallery + ul,
.article-content .article-image-gallery + ol {
  margin-top: 20px;
}

/* 标题和图片之间的间距 */
.article-content h3 + .article-image-gallery,
.article-content h4 + .article-image-gallery,
.article-content .article-image-gallery + h3,
.article-content .article-image-gallery + h4 {
  margin-top: 20px;
}

/* 文章链接样式 - 扁平化 */
.article-link {
  margin: 30px 0;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 3px solid #007bff;
  box-shadow: none;
}

.article-link strong {
  color: #2c3e50;
  margin-right: 10px;
  font-size: 1.05rem;
}

.website-link {
  color: #007bff;
  text-decoration: none;
  word-break: break-all;
  font-family: monospace;
  font-size: 0.95rem;
}

.website-link:hover {
  text-decoration: underline;
  color: #0056b3;
}

/* 返回按钮 - 扁平化 */
.back-btn {
  margin-top: 30px;
  padding: 12px 25px;
  background-color: #ff6b00;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: background-color 0.3s ease;
  display: block;
  margin-left: auto;
  margin-right: auto;
  box-shadow: none;
  border: 1px solid #e55b00;
}

.back-btn:hover {
  background-color: #ff8c40;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(255, 107, 0, 0.2);
}



/* ========== 响应式调整 ========== */
@media (max-width: 768px) {
  /* 导航栏调整 - 移动端汉堡菜单布局 */
  nav.navbar {
    padding: 12px 15px;
    min-height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  /* 隐藏桌面端导航 */
  .nav-center {
    display: none !important;
  }
  
  /* 显示汉堡菜单按钮 */
  .mobile-menu-toggle {
    display: flex;
  }
  
  /* 搜索容器调整 */
  .search-container {
    margin-left: auto;
  }
  
  .search-container.active .search-input {
    width: 150px;
  }
  
  /* 主内容区调整 */
  .article-list, .home-articles {
    grid-template-columns: 1fr;
  }
  
  .header-content {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
  }
  
  main {
    flex-direction: column;
    margin: 15px;
    gap: 15px;
  }
  
  .sidebar {
    position: static;
  }
}

/* 小屏幕手机进一步优化 */
@media (max-width: 480px) {
  .search-container.active .search-input {
    width: 140px; /* 移动端搜索框稍小 */
  }
  
  header h1 {
    font-size: 2rem;
  }
  
  header p {
    font-size: 1rem;
  }
}





/* 小屏幕手机进一步优化 */
@media (max-width: 480px) {
  .nav-links {
    gap: 5px;
  }
  
  .nav-links > li > a {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
  
  .search-container.active .search-input {
    width: 150px; /* ✅ 移动端搜索框稍小 */
  }
  
  header h1 {
    font-size: 2rem;
  }
  
  header p {
    font-size: 1rem;
  }
}


/* ===== 极简广告样式 ===== */
.ad-item {
    margin-bottom: 20px;
}

.ad-link {
    display: block;
    text-decoration: none;
}

.ad-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
}

/* 完全无悬停效果 */
.ad-item:hover .ad-image {
    transform: none;
    opacity: 1;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .ad-item {
        margin-bottom: 15px;
    }
}


/* 错误提示样式 */
.error-message {
  text-align: center;
  color: #e74c3c;
  padding: 40px 20px;
  background: #ffeaea;
  border-radius: 8px;
  margin: 20px 0;
}

/* 移动端更多提示 */
.more-hint {
  text-align: center;
  color: #666;
  font-size: 0.9rem;
  margin-top: 15px;
  grid-column: 1 / -1;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 6px;
}


/* 调试信息样式 */
.debug-info {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 10px;
  margin: 10px 0;
  font-family: monospace;
  font-size: 0.8rem;
  color: #6c757d;
}

.debug-success {
  color: #28a745;
  font-weight: bold;
}

.debug-error {
  color: #dc3545;
  font-weight: bold;
}

.debug-warning {
  color: #ffc107;
  font-weight: bold;
}




/* ========== 移动端汉堡菜单样式优化 ========== */

/* 汉堡菜单按钮 */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1002;
  margin-right: 15px;
}

.menu-icon-bar {
  width: 100%;
  height: 3px;
  background-color: white;
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* 移动端侧滑菜单 - 紧凑版 */
.mobile-sidebar {
  position: fixed;
  top: 0;
  left: -280px; /* 初始位置与宽度匹配 */
  width: 260px; /* 缩小宽度，减少空白 */
  height: 100%;
  background: white;
  box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
  z-index: 1001;
  transition: left 0.3s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.mobile-sidebar.active {
  left: 0;
}

/* 移除左侧标题栏 */
.sidebar-header {
  display: none; /* 隐藏标题栏 */
}

/* 菜单容器 - 减少左右内边距 */
.sidebar-menu {
  padding: 15px 0; /* 减少上下内边距 */
  flex: 1;
  overflow-y: auto;
}

/* 菜单项样式优化 - 减少左右内边距 */
.sidebar-item {
  border-bottom: 1px solid #f0f0f0;
}

/* 主菜单链接 - 减少左右内边距，增加密度 */
.sidebar-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px; /* 减少左右内边距 */
  color: #333;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  transition: background-color 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 48px; /* 稍矮一些，更紧凑 */
}

.sidebar-link:hover,
.sidebar-link.active {
  background-color: #f8f9fa;
  color: #ff6b00;
}

/* 有子菜单的项 - 箭头更紧凑 */
.sidebar-link.has-children::after {
  content: "›";
  font-size: 1.3rem;
  transition: transform 0.3s;
  margin-left: 8px; /* 减少箭头左边距 */
  color: #666;
  flex-shrink: 0;
}

.sidebar-link.has-children.expanded::after {
  transform: rotate(90deg);
  color: #ff6b00;
}

/* 子菜单样式优化 - 减少缩进 */
.sidebar-submenu {
  display: none;
  background: #f8f9fa;
  padding: 0;
}

.sidebar-submenu.active {
  display: block;
}

/* 子菜单项 - 减少缩进和内边距 */
.sidebar-submenu .sidebar-link {
  padding-left: 32px; /* 减少子菜单缩进 */
  padding-right: 16px; /* 保持右侧一致 */
  font-size: 0.95rem;
  color: #555;
  font-weight: normal;
  min-height: 42px; /* 子菜单项更矮 */
  padding-top: 11px;
  padding-bottom: 11px;
}

.sidebar-submenu .sidebar-link:hover {
  background-color: #f0f0f0;
  color: #ff6b00;
}

.sidebar-submenu .sidebar-link::after {
  content: "" !important;
}

/* 遮罩层 */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* 响应式设计 - 移动端显示汉堡菜单 */
@media (max-width: 992px) {
  .mobile-menu-toggle {
    display: flex;
  }
  
  .nav-center {
    display: none;
  }
  
  .nav-right {
    margin-left: auto;
  }
  
  .navbar {
    padding: 0 15px;
  }
  
  .search-container.active .search-input {
    width: 150px;
  }
}

/* 小屏幕进一步优化 - 更紧凑 */
@media (max-width: 576px) {
  .mobile-sidebar {
    width: 240px; /* 小屏幕更窄 */
    left: -240px;
  }
  
  .sidebar-link {
    padding: 12px 14px; /* 更紧凑 */
    font-size: 0.95rem;
    min-height: 44px;
  }
  
  .sidebar-submenu .sidebar-link {
    padding-left: 28px; /* 更少缩进 */
    padding-right: 14px;
    font-size: 0.9rem;
    min-height: 40px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  
  .sidebar-link.has-children::after {
    font-size: 1.2rem;
    margin-left: 6px;
  }
}

/* 超小屏幕手机优化 */
@media (max-width: 400px) {
  .mobile-sidebar {
    width: 220px; /* 超小屏幕更窄 */
    left: -220px;
  }
  
  .sidebar-link {
    padding: 11px 12px; /* 更紧凑 */
    font-size: 0.92rem;
    min-height: 42px;
  }
  
  .sidebar-submenu .sidebar-link {
    padding-left: 24px; /* 更少缩进 */
    padding-right: 12px;
    font-size: 0.88rem;
    min-height: 38px;
  }
}

/* 动画效果 */
@keyframes slideInRight {
  from {
    transform: translateX(-8px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.sidebar-item {
  animation: slideInRight 0.3s ease forwards;
  opacity: 0;
}

.sidebar-item:nth-child(1) { animation-delay: 0.05s; }
.sidebar-item:nth-child(2) { animation-delay: 0.1s; }
.sidebar-item:nth-child(3) { animation-delay: 0.15s; }
.sidebar-item:nth-child(4) { animation-delay: 0.2s; }
.sidebar-item:nth-child(5) { animation-delay: 0.25s; }
.sidebar-item:nth-child(6) { animation-delay: 0.3s; }

/* 防止滚动 */
body.menu-open {
  overflow: hidden;
}

/* 确保菜单内容区域可滚动 */
.mobile-sidebar {
  display: flex;
  flex-direction: column;
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 移除菜单项之间的多余边框 */
.sidebar-item:last-child {
  border-bottom: none;
}

/* 增加菜单密度 - 可选进一步减少间距 */
.sidebar-item {
  margin: 0;
}




/*======    页面底部添加联系信息   ======== */
/*======    页面底部添加联系信息   ======== */
/* 页尾容器 - 垂直排列 */
.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;  /* 整体居中，但内部 .footer-contact 自己右对齐 */
}

/* 第一行：联系信息 - 右对齐，并增加右侧内边距（左移效果） */
.footer-contact {
  text-align: right;
  width: 100%;
  margin-bottom: 20px;
  padding-right: 0;   /* 数值越小，文字越靠右 */
  box-sizing: border-box;
}

/* 每个联系项垂直排列 */
.contact-item {
  margin-bottom: 8px;
  font-size: 14px;
  color: #ddd;
}

.contact-item i {
  margin-right: 8px;
  color: #00bfff;
}

.contact-item a {
  color: #00bfff;
  text-decoration: none;
}

.contact-item a:hover {
  text-decoration: underline;
}

/* 第二行：版权文字 */
.copyright {
  margin-bottom: 8px;
  font-size: 14px;
  color: #ccc;
  text-align: center;
}

/* 备案信息行 - 沿用原有的有效样式 */
.beian {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

/* 备案图标 - 使用已验证的尺寸 */
.beian-icon {
  height: 0.9rem;
  width: auto;
  vertical-align: middle;
}

/* ✅ 备案链接颜色改为蓝色（不再使用灰色） */
.beian a {
   text-decoration: none;   /* 仅移除下划线，不改变颜色 */
}

.beian a:hover {
  text-decoration: underline;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .footer-content {
    padding: 15px;
  }
  .footer-contact {
    padding-right: 20px;   /* ✅ 同步改为 20px，让移动端也右移 */
    margin-bottom: 15px;
  }
  .contact-item {
    font-size: 12px;
  }
  .copyright {
    font-size: 12px;
  }
  .beian {
    font-size: 11px;
  }
  .beian-icon {
    height: 0.8rem;
  }
}

