/* ===== 极简论坛 ===== */

:root {
  --bg: #fafafa;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-2: #666666;
  --text-3: #999999;
  --accent: #0066ff;
  --accent-hover: #0052cc;
  --border: #f0f0f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== 导航栏 ===== */
.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
}
.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
}
.logo {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.5px;
}
.nav-right { display: flex; align-items: center; gap: 12px; }
.search-input {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 180px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  background: var(--bg);
}
.search-input:focus { border-color: var(--accent); }

/* ===== 布局 ===== */
.container { max-width: 900px; margin: 0 auto; padding: 0 24px; }
.main-layout {
  display: flex;
  gap: 32px;
  padding: 32px 0;
  max-width: 900px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* ===== 侧边栏 ===== */
.sidebar { width: 160px; flex-shrink: 0; }
.sidebar h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  margin-bottom: 16px;
  font-weight: 500;
}
.category-list { list-style: none; margin-bottom: 24px; }
.category-list li { margin-bottom: 2px; }
.category-list a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-2);
  font-size: 14px;
  transition: all 0.15s;
}
.category-list a:hover { color: var(--text); background: var(--border); }
.category-list a.active { color: var(--accent); background: rgba(0,102,255,0.06); font-weight: 500; }

/* ===== 按钮 ===== */
.btn {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-primary { background: var(--text); color: white; }
.btn-primary:hover { background: #333; }
.btn-sm { padding: 5px 14px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }

/* ===== 输入框 ===== */
.input-full {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  background: var(--bg);
}
.input-full:focus { border-color: var(--accent); }

/* ===== 帖子列表 ===== */
.content { flex: 1; min-width: 0; }
.post-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; }
.post-card {
  background: var(--card);
  padding: 20px 24px;
  cursor: pointer;
  transition: background 0.15s;
}
.post-card:hover { background: #f8f8f8; }
.post-card.pinned { border-left: 3px solid var(--accent); }
.post-card h4 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.4;
  letter-spacing: -0.2px;
}
.post-card h4:hover { color: var(--accent); }
.post-meta {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  gap: 16px;
}
.post-meta span { white-space: nowrap; }

/* ===== 分页 ===== */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 24px; }
.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  transition: all 0.15s;
}
.pagination button:hover { border-color: var(--text); }
.pagination button.active { background: var(--text); color: white; border-color: var(--text); }

/* ===== 弹窗 ===== */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 48px;
  overflow-y: auto;
}
.modal-content {
  background: var(--card);
  border-radius: 16px;
  padding: 32px;
  width: 90%;
  max-width: 680px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-large { max-width: 760px; padding: 0; overflow: hidden; }
.modal-small { max-width: 380px; padding: 28px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
.close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-3);
  transition: all 0.15s;
  border: none;
  background: none;
}
.close:hover { background: var(--border); color: var(--text); }

/* ===== 帖子详情（重新设计） ===== */
.detail-header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border);
}
.detail-header h2 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.3px;
  margin-bottom: 12px;
}
.detail-body {
  padding: 24px 32px;
}
.detail-body .markdown-body {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
}
.detail-body .markdown-body p { margin-bottom: 16px; }
.detail-body .markdown-body h1,
.detail-body .markdown-body h2,
.detail-body .markdown-body h3 {
  margin-top: 24px;
  margin-bottom: 12px;
  letter-spacing: -0.3px;
}
.detail-body .markdown-body code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}
.detail-body .markdown-body pre {
  background: #1a1a1a;
  color: #e0e0e0;
  padding: 16px;
  border-radius: 10px;
  overflow-x: auto;
}
.detail-body .markdown-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}
.detail-body .markdown-body blockquote {
  border-left: 3px solid var(--border);
  padding-left: 16px;
  color: var(--text-2);
  margin: 16px 0;
}
.detail-media {
  padding: 0 32px 20px;
}
.detail-meta {
  padding: 12px 32px;
  font-size: 13px;
  color: var(--text-3);
  display: flex;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

/* ===== 图片（50%宽度 + 放大） ===== */
.image-container {
  position: relative;
  display: inline-block;
  margin: 12px 0;
  max-width: 50%;
  border-radius: 10px;
  overflow: hidden;
}
.post-image {
  width: 100%;
  display: block;
  cursor: pointer;
  transition: transform 0.2s;
}
.post-image:hover { transform: scale(1.02); }
.image-zoom-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
  backdrop-filter: blur(8px);
}
.image-container:hover .image-zoom-btn { opacity: 1; }

/* 灯箱 */
.lightbox {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.92);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(20px);
}
.lightbox img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: 4px; }
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,0.1);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* ===== 回复区域（重新设计） ===== */
.replies-section {
  padding: 0 32px 32px;
}
.replies-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.replies-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.reply-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.reply-item:last-child { border-bottom: none; }
.reply-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.reply-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.reply-author { font-size: 14px; font-weight: 500; }
.reply-time { font-size: 12px; color: var(--text-3); }
.reply-content {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  padding-left: 40px;
}
.reply-content .image-container { max-width: 40%; }

/* 引用回复 */
.reply-quote {
  background: var(--bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  margin-bottom: 10px;
  margin-left: 40px;
  cursor: pointer;
  transition: background 0.15s;
}
.reply-quote:hover { background: #f0f0f0; }
.quote-author { font-size: 12px; font-weight: 600; color: var(--accent); display: block; margin-bottom: 4px; }
.quote-text { font-size: 13px; color: var(--text-3); line-height: 1.5; }

/* 引用激活状态（回复框上方） */
.reply-quote-active {
  position: relative;
  margin-left: 0;
  margin-bottom: 8px;
}
.quote-cancel {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
}
.quote-cancel:hover { background: var(--border); color: var(--text); }

/* 楼层号 */
.floor-number {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  cursor: pointer;
  padding: 1px 6px;
  border-radius: 4px;
  transition: all 0.15s;
  user-select: none;
}
.floor-number:hover { color: var(--accent); background: rgba(0,102,255,0.06); }

/* 回复按钮 */
.reply-btn {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}
.reply-btn:hover { color: var(--accent); background: rgba(0,102,255,0.06); }

/* 回复表单 */
.reply-form-section {
  padding: 24px 32px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.reply-form-header {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 12px;
}

/* ===== 工具栏 ===== */
.toolbar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
}
.toolbar button {
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  transition: all 0.15s;
}
.toolbar button:hover { background: var(--border); color: var(--text); }
.toolbar .toolbar-upload {
  background: var(--accent);
  color: white;
  font-weight: 500;
  margin-left: auto;
}
.toolbar .toolbar-upload:hover { background: var(--accent-hover); }
.toolbar-small { padding: 4px 8px; border-radius: 8px 8px 0 0; }
.toolbar-small button { padding: 2px 8px; font-size: 12px; }

/* ===== 编辑器 ===== */
.editor {
  width: 100%;
  min-height: 180px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  border-top: none;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.2s;
}
.editor:focus { border-color: var(--accent); }
.editor-small {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  border-top: none;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  margin-bottom: 8px;
  outline: none;
}
.editor-tabs {
  display: flex;
  gap: 0;
  margin-bottom: -1px;
}
.tab {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-bottom: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  border-radius: 8px 8px 0 0;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--card); color: var(--text); border-bottom: 1px solid var(--card); }
.preview {
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  padding: 20px;
  min-height: 180px;
  margin-bottom: 16px;
}

/* ===== 上传预览 ===== */
.upload-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.upload-preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
}

/* ===== 登录注册 ===== */
.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-3);
}
.auth-switch a { color: var(--accent); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* Turnstile */
.turnstile-container {
  margin-bottom: 16px;
  min-height: 65px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .main-layout { flex-direction: column; gap: 16px; padding-left: 16px; padding-right: 16px; }
  .sidebar { width: 100%; }
  .category-list { display: flex; overflow-x: auto; gap: 4px; padding-bottom: 8px; }
  .category-list li { flex-shrink: 0; }
  .search-input { width: 120px; }
  .image-container { max-width: 80%; }
  .modal-content { padding: 20px; }
  .detail-header, .detail-body, .detail-media, .detail-meta, .replies-section, .reply-form-section {
    padding-left: 20px;
    padding-right: 20px;
  }
  .reply-content { padding-left: 0; margin-top: 8px; }
  .reply-item .image-container { max-width: 60%; }
}
