/* ============================================================
   RAT 红警社区 - 静态归档站样式
   ============================================================ */

:root {
  --bg: #f5f5f5;
  --bg-card: #ffffff;
  --text: #333333;
  --text-muted: #888888;
  --text-link: #2563eb;
  --border: #e0e0e0;
  --accent: #dc2626;
  --accent-light: #fef2f2;
  --tag-bg: #e5e7eb;
  --tag-text: #374151;
  --top-bg: #fffbeb;
  --top-border: #f59e0b;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ============================================================
   导航栏
   ============================================================ */
.navbar {
  background: var(--accent);
  color: white;
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar .container {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-brand {
  color: white;
  text-decoration: none;
  font-size: 1.2em;
  font-weight: bold;
  white-space: nowrap;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-links a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: 0.9em;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.nav-links a:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}

/* ============================================================
   主体
   ============================================================ */
main {
  padding: 24px 0;
  min-height: calc(100vh - 140px);
}

/* ============================================================
   页脚
   ============================================================ */
.footer {
  background: #1f2937;
  color: #9ca3af;
  text-align: center;
  padding: 24px 0;
  font-size: 0.85em;
}

/* ============================================================
   Hero 区域（首页）
   ============================================================ */
.hero {
  text-align: center;
  padding: 40px 0;
}

.hero h1 {
  font-size: 2em;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1em;
}

.stats {
  color: var(--text-muted);
  font-size: 0.9em;
  margin-top: 8px;
}

/* ============================================================
   版块卡片
   ============================================================ */
.forum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.forum-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.2s, transform 0.2s;
}

.forum-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.forum-card h3 {
  color: var(--text-link);
  margin-bottom: 8px;
}

.forum-brief {
  color: var(--text-muted);
  font-size: 0.9em;
  margin-bottom: 8px;
}

.forum-count {
  color: var(--text-muted);
  font-size: 0.85em;
}

section h2 {
  font-size: 1.3em;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}

/* ============================================================
   面包屑导航
   ============================================================ */
.breadcrumb {
  font-size: 0.9em;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding: 8px 0;
}

.breadcrumb a {
  color: var(--text-link);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ============================================================
   主题列表
   ============================================================ */
.thread-list {
  margin: 12px 0;
}

.thread-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 8px;
  transition: box-shadow 0.2s;
}

.thread-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.thread-top {
  background: var(--top-bg);
  border-color: var(--top-border);
}

.thread-subject {
  color: var(--text-link);
  text-decoration: none;
  font-size: 1.05em;
  font-weight: 500;
  display: inline-block;
  margin: 4px 0;
}

.thread-subject:hover {
  text-decoration: underline;
}

.thread-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.85em;
  color: var(--text-muted);
  margin-top: 4px;
}

.thread-author {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mini-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.author-unknown {
  color: var(--text-muted);
}

/* ============================================================
   标签
   ============================================================ */
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.78em;
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--tag-text);
}

.tag-primary {
  background: #dbeafe;
  color: #1d4ed8;
}

.tag-success {
  background: #dcfce7;
  color: #15803d;
}

.tag-danger {
  background: #fce7f3;
  color: #be185d;
}

.tag-warning {
  background: #fef3c7;
  color: #b45309;
}

.tag-sticky, .tag-closed {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 0.78em;
  font-weight: 600;
}

.tag-sticky {
  background: #f59e0b;
  color: white;
}

.tag-closed {
  background: #6b7280;
  color: white;
}

/* ============================================================
   帖子详情
   ============================================================ */
.thread-header {
  margin-bottom: 16px;
}

.thread-title {
  font-size: 1.5em;
  margin-bottom: 8px;
}

.thread-meta-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.post {
  display: flex;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.post-sidebar {
  flex: 0 0 100px;
  text-align: center;
}

.post-author .avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 4px;
}

.author-name {
  font-size: 0.85em;
  font-weight: 500;
  word-break: break-all;
}

.post-main {
  flex: 1;
  min-width: 0;
}

.post-header {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 0.85em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.post-link {
  color: var(--text-muted);
  text-decoration: none;
}

.post-link:hover {
  color: var(--text-link);
}

.post-content {
  line-height: 1.7;
  overflow-wrap: break-word;
}

.post-content p {
  margin-bottom: 8px;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 8px 0;
}

.post-content a {
  color: var(--text-link);
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin: 8px 0;
  color: var(--text-muted);
  background: #f9f9f9;
  padding: 8px 12px;
  border-radius: 4px;
}

.post-content pre {
  background: #1f2937;
  color: #e5e7eb;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.9em;
  margin: 8px 0;
}

.post-content code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}

.post-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
}

.post-content th, .post-content td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}

.post-content th {
  background: #f9fafb;
  font-weight: 600;
}

/* ============================================================
   附件列表
   ============================================================ */
.attachments {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.attachments h2 {
  font-size: 1.1em;
  margin: 0 0 12px;
  border: none;
}

.attach-list {
  list-style: none;
}

.attach-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9em;
}

.attach-item:last-child {
  border-bottom: none;
}

.attach-icon {
  font-size: 1.1em;
}

.attach-name {
  flex: 1;
}

.attach-name a {
  color: var(--text-link);
  text-decoration: none;
}

.attach-name a:hover {
  text-decoration: underline;
}

.attach-size {
  color: var(--text-muted);
  font-size: 0.85em;
  white-space: nowrap;
}

/* ============================================================
   回放卡片
   ============================================================ */
.replay-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.replay-card {
  display: flex;
  gap: 16px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 14px;
  color: #e0e0e0;
  font-size: 0.9em;
  transition: box-shadow 0.2s;
}

.replay-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.rp-thumb-wrap {
  flex: 0 0 120px;
  width: 120px;
  height: 90px;
  border-radius: 6px;
  overflow: hidden;
  background: #1e1e3a;
}

.rp-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rp-thumb-placeholder {
  opacity: 0.5;
  object-fit: contain;
  padding: 8px;
}

.rp-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rp-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rp-mapname {
  font-size: 1.05em;
  color: #ffffff;
}

.rp-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.78em;
  background: #e94560;
  color: white;
  font-weight: 600;
}

.rp-meta {
  display: flex;
  gap: 12px;
  font-size: 0.82em;
  color: #aaa;
  flex-wrap: wrap;
}

.rp-players {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 2px;
}

.rp-player {
  font-size: 0.88em;
  white-space: nowrap;
}

.rp-player em {
  font-style: normal;
  color: #888;
  margin-left: 2px;
}

.rp-ai {
  display: inline-block;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 0.75em;
  background: #e94560;
  color: white;
}

.rp-download {
  margin-top: auto;
  text-align: right;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.rp-dl-link {
  display: inline-block;
  padding: 4px 14px;
  background: #e94560;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  font-size: 0.85em;
  font-weight: 600;
  transition: background 0.2s;
}

.rp-dl-link:hover {
  background: #c73650;
}

.rp-filesize {
  font-size: 0.82em;
  color: #888;
}

/* 旧卡片替换标记 */
.replay-card-replaced {
  padding: 8px 12px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  font-size: 0.85em;
  color: #856404;
  margin: 8px 0;
}

/* ============================================================
   回复区
   ============================================================ */
.replies h2 {
  font-size: 1.1em;
}

/* ============================================================
   空状态 / 错误页
   ============================================================ */
.empty-notice {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.error-page {
  text-align: center;
  padding: 80px 20px;
}

.error-page h1 {
  font-size: 2.5em;
  margin-bottom: 16px;
}

.error-page a {
  color: var(--text-link);
}

/* ============================================================
   分页
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.page-info {
  font-size: 0.85em;
  color: var(--text-muted);
  margin-right: 8px;
}

.page-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-link {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--text-link);
  font-size: 0.85em;
  transition: background 0.2s;
}

.page-link:hover {
  background: #eff6ff;
}

.page-link.current {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 600;
}

.page-ellipsis {
  color: var(--text-muted);
  padding: 0 4px;
}

/* ============================================================
   搜索框
   ============================================================ */
.search-bar {
  margin: 16px 0;
  text-align: center;
}

.pagefind-search {
  display: inline-block;
  width: 100%;
  max-width: 480px;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 640px) {
  .navbar .container {
    flex-direction: column;
    gap: 8px;
  }
  
  .nav-links {
    justify-content: center;
  }
  
  .forum-grid {
    grid-template-columns: 1fr;
  }
  
  .post {
    flex-direction: column;
  }
  
  .post-sidebar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .post-author .avatar {
    width: 32px;
    height: 32px;
  }
}
