/* 现代化新闻门户样式 */
:root {
  --primary-color: #68a9ff;
  --secondary-color: #34a853;
  --accent-color: #ea4335;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-muted: #9aa0a6;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f4;
  --border-color: #dadce0;
  --shadow-light: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-medium: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-heavy: 0 10px 25px rgba(0,0,0,0.15);
  --border-radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  font-size: 16px;
}

/* 页头整体布局 */
/* 内容统一宽度 */
.container {
  max-width: 1000px;  /* 和搜狐类似，可调整 */
  margin: 0 auto;     /* 居中 */
  padding: 0 15px;    /* 两边留点空隙 */
}



/* header 内部布局紧凑 */
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* header 背景色和分隔线 */
.site-header {
  position: fixed;      /* 固定在页面上方 */
  top: 0;
  left: 0;
  width: 100%;          /* 占满宽度 */
  background: #f8f8f8;
  border-bottom: 1px solid #ddd;
  z-index: 1000;        /* 确保浮在内容之上 */
  padding: 10px 0;
}


/* 左侧标题 */
.header-left h1 {
  margin: 0;
  font-size: 1.5em;
}
.header-left a {
  text-decoration: none;
  color: #333;
}

/* 中间导航 */
.header-nav {
  flex: 1;
  text-align: center;
}
.header-nav .nav-link {
  margin: 0 15px;
  font-weight: bold;
  color: #333;
  text-decoration: none;
}
.header-nav .nav-link:hover {
  color: #e60023;
  border-bottom: 2px solid #e60023;
  padding-bottom: 2px;
}

/* 右侧管理员链接 */
.header-right .admin-link {
  color: #666;
  text-decoration: none;
}
.header-right .admin-link:hover {
  color: #e60023;
}


/* 主要内容容器 */
.news-container {
  max-width: 1200px;
  margin: 0 auto;
  margin-top:75px;
}

/* 头条新闻容器：左图右文布局 */
.headline-container {
  display: flex;
  align-items: center;        /* 图片和文字垂直居中 */
  gap: 20px;                  /* 图片和文字间距 */
  padding: 15px 0;
}

/* 头条新闻图片 */
.headline-image img {
  width: 400px;               /* 控制图片宽度 */
  height: 300px;              /* 控制高度，保持统一 */
  object-fit: cover;          /* 保持图片裁剪美观 */
  border-radius: 4px;
}

/* 头条新闻文字部分 */
.headline-content {
  flex: 1;                    /* 占据剩余空间 */
  text-align: left;           /* 左对齐 */
}

/* 标题 */
.headline-title {
  font-size: 1.5em;
  font-weight: bold;
  margin-bottom: 8px;
  line-height: 1.3em;
}

/* 摘要 */
.headline-summary {
  font-size: 1em;
  color: #555;
  margin-bottom: 10px;
  line-height: 1.4em;
}

/* 元信息 */
.headline-meta {
  font-size: 0.9em;
  color: #999;
}

.headline-meta span + span {
  margin-left: 15px;
}


/* 热点推荐卡片：左文字右图片 */
.trending-section{
  margin-bottom:15px;
}
.trending-grid {
  display: flex;
  gap: 20px;
  justify-content: flex-start;
  margin-top: 10px;     /* 卡片距离 header */
}

.trending-card {
  display: flex;
  flex-direction: row;       /* 左文字右图片 */
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  width: 32%;                /* 三张卡片并排，每张约 1/3 */
  background: #fff;
  transition: transform 0.2s;
}
.trending-card:hover {
  transform: translateY(-5px);
}

.card-link {
  display: flex;
  width: 100%;
  text-decoration: none;
  color: inherit;
}

/* 左侧文字 */
.card-content-left {
  flex: 1;
  padding: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* 标题 */
.card-content-left .card-title {
  font-size: 1em;
  font-weight: bold;
  margin-bottom: 8px;
  line-height: 1.3em;
}

/* 元信息 */
.card-content-left .card-meta {
  font-size: 0.85em;
  color: #999;
}

/* 右侧图片 */
.card-image-right {
  width: 120px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-image-right img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* 最新新闻区域 */
.latest-news-section {
  margin-bottom: 3rem;
}

.category-tabs {
  display: flex;
  gap: 0.5rem;
  margin-top:10px;
}

.tab {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.tab:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.tab.active {
  background: var(--primary-color);
  color: white;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.news-card {
  display: flex;                  /* 左右排列 */
  flex-direction: row;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-light);
  transition: var(--transition);
  min-height: 150px;             /* 统一卡片最小高度 */
}

.news-card .card-image {
  flex: 0 0 150px;           /* 左侧固定宽度 */
  width:150px;             /* 高度统一 */
  overflow: hidden;
}

.news-card .card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;          /* 图片裁剪并填充，不拉伸 */
  display: block;
}

/* 让 card-link 覆盖整个卡片，内部保持横向排列 */
.news-card .card-link {
  display: flex;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

/* 修复 card-body 撑开或空隙问题 */
.news-card .card-body {
  flex: 1 1 auto;
  min-width: 0;   /* 避免文字把容器撑出空白 */
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.75rem 1rem;
  overflow: hidden;
}


/* 无图文章样式 */
.news-card.no-image {
  flex-direction: column;   /* 上下排列 */
}

.news-card.no-image .card-image {
  display: none;            /* 隐藏图片区域 */
}

.news-card.no-image .card-body {
  padding: 1rem 1.5rem;
}

.card-body .card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  line-height: 1.4;
    /* 限制显示两行 */
  display: -webkit-box;
  -webkit-line-clamp: 2;   /* 最多两行 */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-summary {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 卡片标签 & 时间样式调整 */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  gap: 12px;
}

/* 左侧 meta 保持原样，但稍微压缩间距 */
.meta-left {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* 只显示日期，微调图标与文字对齐 */
.publish-time i {
  margin-right: 6px;
  opacity: 0.8;
}

.meta-left span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* 右侧标签容器（使用 flex，允许换行） */
.meta-right .card-tags {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap; /* pill 只在容器外显示 +n，不换行 */
}

/* 当没有标签时，保持占位高度避免布局跳动（可小） */
.meta-right .card-tags.empty {
  min-height: 1.25rem;
}
/* 标签 pill 基本样式 */
.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(14, 111, 255, 0.08); /* 淡蓝背景 */
  color: #0e6fff; /* 深色文字 */
  font-size: 0.72rem;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 0 0 1px rgba(14,111,255,0.06) inset;
}

/* +n pill 风格稍微不同 */
.tag-pill.more {
  background: rgba(0,0,0,0.06);
  color: #333;
  font-weight: 600;
}

/* 当屏幕很窄时，避免卡片被撑坏，允许折行并隐藏过多内容 */
@media (max-width: 640px) {
  .card-footer { gap: 8px; }
  .card-summary { -webkit-line-clamp: 3; } /* 允许更多行 summary */
  .meta-right .card-tags { gap: 4px; }
}
/* 加载更多按钮 */
.load-more-container {
  text-align: center;
  margin-top: 3rem;
}

.load-more-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.load-more-btn:hover {
  background: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

/* 返回顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--primary-color);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-medium);
  transition: var(--transition);
  z-index: 1000;
}

.back-to-top:hover {
  background: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-heavy);
}

/* 图标样式 */
.icon-news::before { content: "📰"; }
.icon-fire::before { content: "🔥"; }
.icon-clock::before { content: "⏰"; }
.icon-arrow::before { content: "→"; }
.icon-image::before { content: "🖼️"; }
.icon-user::before { content: "👤"; }
.icon-time::before { content: "🕒"; }
.icon-user-small::before { content: "👤"; }
.icon-time-small::before { content: "🕒"; }
.icon-eye::before { content: "👁️"; }
.icon-refresh::before { content: "🔄"; }
.icon-arrow-up::before { content: "↑"; }

/* 页脚样式 */
footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  margin-top: 4rem;
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .news-container {
    padding: 1rem;
  }
  
  .headline-container {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  
  .headline-image {
    height: 300px;
  }
  
  .trending-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
  
  .news-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (max-width: 768px) {
  header {
    padding: 1rem;
  }
  
  header h1 a {
    font-size: 1.5rem;
  }
  
  nav a {
    margin-right: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
  }
  
  .news-container {
    padding: 0.5rem;
  }
  
  .headline-content {
    padding: 1.5rem;
  }
  
  .headline-title {
    font-size: 1.5rem;
  }
  
  .trending-grid {
    grid-template-columns: 1fr;
  }
  
  .news-grid {
    grid-template-columns: 1fr;
  }
  
  .section-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom:10px;
  }
  
  .category-tabs {
    flex-wrap: wrap;
  }
  
  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
  }
}

@media (max-width: 480px) {
  .headline-content {
    padding: 1rem;
  }
  
  .headline-title {
    font-size: 1.25rem;
  }
  
  .headline-summary {
    font-size: 1rem;
  }
  
  .headline-meta {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .card-content,
  .card-body {
    padding: 1rem;
  }
}

/* 文章详情页整体居中 */
.article-container {
  max-width: 1000px;   /* 内容宽度不超过 800px */
  margin: 0 auto;     /* 居中 */
  margin-top:65px;
  padding: 20px;
  text-align: left; /* 整体文字居中 */
}

/* 标题样式 */
.article-title {
  font-size: 2em;
  font-weight: bold;
  margin-bottom: 15px;
}

/* 摘要样式 */
.article-summary {
  font-size: 1.1em;
  color: #666;
  font-style: italic;
  margin-bottom: 25px;
}

/* 正文段落 */
.article-text {
  font-size: 1.1em;
  line-height: 1.8;
  margin: 15px 0;
}

/* 图片容器 */
.article-image {
  margin: 20px 0;
  text-align: center;
}

.article-image img {
  max-width: 70%;   /* 图片统一宽度 */
  height: auto;
  border-radius: 6px;  /* 稍微圆角，新闻感更柔和 */
}

.login-container {
  max-width: 1000px;   /* 内容宽度不超过 800px */
  margin: 0 auto;     /* 居中 */
  margin-top:65px;
  padding: 20px;
  text-align: left; /* 整体文字居中 */
}

.tag-options { display:flex; gap:12px; flex-wrap:wrap; }
.tag-options label { background:#f6f6f6; padding:6px 10px; border-radius:6px; cursor:pointer; }
.tag-options input[type="checkbox"] { margin-right:6px; }
