/* ============================================
   黑料网社区论坛与投票互动站 - 全局样式
   设计风格：Reddit风格社区论坛
   主色调：#FF4500（橙红）
   辅助色：#0079D3（链接蓝）
   背景色：#DAE0E6（浅灰蓝）
   卡片色：#FFFFFF（纯白）
   强调色：#FF8717（高亮橙）
   ============================================ */

:root {
  --primary: #FF4500;
  --secondary: #0079D3;
  --bg: #DAE0E6;
  --card: #FFFFFF;
  --accent: #FF8717;
  --text: #1A1A1B;
  --text-secondary: #7C7C7C;
  --text-light: #878A8C;
  --border: #EDEFF1;
  --radius: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-hover: 0 2px 8px rgba(0,0,0,0.12);
  --upvote: #FF4500;
  --downvote: #7193FF;
  --hot: #FF4500;
  --new-tag: #46D160;
  --rising: #FF8717;
  --pinned: #0079D3;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Fira Code", monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

/* 重置与基础 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--secondary);
  text-decoration: none;
  transition: color 0.15s var(--ease-out);
}

a:hover {
  color: var(--primary);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* 布局容器 */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.layout-main {
  display: grid;
  grid-template-columns: 1fr 312px;
  gap: 24px;
  padding: 20px 0;
}

.layout-full {
  max-width: 100%;
}

/* 顶部导航栏 */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.header-inner {
  display: flex;
  align-items: center;
  height: 48px;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  white-space: nowrap;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.nav-main {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-main a {
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s var(--ease-out);
}

.nav-main a:hover {
  background: var(--bg);
  text-decoration: none;
}

.nav-main a.active {
  background: var(--bg);
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.16s var(--ease-out);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: #E03D00;
  color: #fff;
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--secondary);
  border: 1px solid var(--secondary);
}

.btn-secondary:hover {
  background: rgba(0,121,211,0.05);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

/* 搜索框 */
.search-box {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-box input {
  width: 100%;
  height: 36px;
  padding: 0 36px 0 40px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: all 0.2s var(--ease-out);
}

.search-box input:focus {
  border-color: var(--secondary);
  background: var(--card);
  box-shadow: 0 0 0 2px rgba(0,121,211,0.1);
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

/* 帖子卡片 */
.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  display: flex;
  transition: border-color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
  animation: fadeInUp 0.3s var(--ease-out) both;
}

.post-card:hover {
  border-color: #898989;
  box-shadow: var(--shadow-hover);
}

/* 投票区域 */
.vote-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  width: 40px;
  min-width: 40px;
  background: #F8F9FA;
  border-radius: var(--radius) 0 0 var(--radius);
}

.vote-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  color: var(--text-light);
  transition: color 0.15s var(--ease-out), background 0.15s var(--ease-out);
}

.vote-btn:hover {
  background: rgba(0,0,0,0.05);
}

.vote-btn.upvote.active {
  color: var(--upvote);
}

.vote-btn.downvote.active {
  color: var(--downvote);
}

.vote-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  padding: 4px 0;
  min-width: 20px;
  text-align: center;
}

/* 帖子内容区域 */
.post-content {
  flex: 1;
  padding: 8px;
  min-width: 0;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.post-board {
  font-weight: 700;
  color: var(--text);
}

.post-board:hover {
  text-decoration: underline;
}

.post-author {
  color: var(--text-secondary);
}

.post-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.4;
}

.post-title a {
  color: inherit;
}

.post-title a:hover {
  color: var(--secondary);
  text-decoration: none;
}

.post-excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.post-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out);
}

.post-action-btn:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text);
}

/* 标签徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-hot {
  background: rgba(255,69,0,0.1);
  color: var(--hot);
}

.badge-new {
  background: rgba(70,209,96,0.1);
  color: var(--new-tag);
}

.badge-rising {
  background: rgba(255,135,23,0.1);
  color: var(--rising);
}

.badge-pinned {
  background: rgba(0,121,211,0.1);
  color: var(--pinned);
}

/* 侧边栏 */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.sidebar-card-header {
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.sidebar-card-header.blue {
  background: var(--secondary);
}

.sidebar-card-header.accent {
  background: var(--accent);
}

.sidebar-card-body {
  padding: 12px 16px;
}

/* 版块列表 */
.board-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.board-item:last-child {
  border-bottom: none;
}

.board-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--primary);
  flex-shrink: 0;
}

.board-info {
  flex: 1;
  min-width: 0;
}

.board-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.board-members {
  font-size: 11px;
  color: var(--text-light);
}

.btn-subscribe {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--secondary);
  color: #fff;
  transition: background 0.15s var(--ease-out);
}

.btn-subscribe:hover {
  background: #006CBB;
}

.btn-subscribe.subscribed {
  background: transparent;
  color: var(--secondary);
  border: 1px solid var(--secondary);
}

/* 用户排行 */
.user-rank-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.user-rank-item:last-child {
  border-bottom: none;
}

.rank-number {
  width: 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
}

.user-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.user-karma {
  font-size: 11px;
  color: var(--text-light);
}

/* 评论嵌套 */
.comment-list {
  padding: 12px 16px;
}

.comment-item {
  padding-left: 16px;
  border-left: 2px solid var(--border);
  margin-bottom: 12px;
  transition: border-color 0.15s var(--ease-out);
}

.comment-item:hover {
  border-left-color: var(--secondary);
}

.comment-item .comment-item {
  margin-top: 12px;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.comment-author {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.comment-time {
  font-size: 11px;
  color: var(--text-light);
}

.comment-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.comment-action {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: color 0.15s var(--ease-out);
}

.comment-action:hover {
  color: var(--text);
}

/* 排序标签 */
.sort-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.sort-tab {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s var(--ease-out);
}

.sort-tab:hover {
  background: var(--bg);
}

.sort-tab.active {
  background: var(--bg);
  color: var(--secondary);
}

/* Hero区域 */
.hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.hero-banner {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.hero-content {
  padding: 20px 24px;
}

.hero-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 每日话题 */
.daily-topic {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius);
  padding: 16px 20px;
  color: #fff;
  margin-bottom: 16px;
}

.daily-topic-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 4px;
}

.daily-topic-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.daily-topic-meta {
  font-size: 12px;
  opacity: 0.8;
}

/* 社区规则 */
.rules-list {
  counter-reset: rule;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}

.rule-item:last-child {
  border-bottom: none;
}

.rule-number {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

/* 面包屑 */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 0;
  font-size: 12px;
  color: var(--text-light);
}

.breadcrumb a {
  color: var(--text-light);
}

.breadcrumb a:hover {
  color: var(--secondary);
}

.breadcrumb-sep {
  color: var(--text-light);
}

/* 页脚 */
.footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin-bottom: 32px;
}

.footer-col-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-col a {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 3px 0;
  transition: color 0.15s var(--ease-out);
}

.footer-col a:hover {
  color: var(--primary);
  text-decoration: none;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-light);
}

/* 页面标题区 */
.page-header {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.page-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 表单元素 */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.form-input:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(0,121,211,0.1);
}

.form-textarea {
  min-height: 160px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237C7C7C' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* FAQ */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-question {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.faq-answer {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding-left: 0;
}

/* 内容区块 */
.content-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 版块网格 */
.boards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.board-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
}

.board-card:hover {
  border-color: var(--secondary);
  box-shadow: var(--shadow-hover);
}

/* 用户Karma */
.karma-display {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
}

.karma-item {
  text-align: center;
}

.karma-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.karma-label {
  font-size: 11px;
  color: var(--text-light);
}

/* 动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.3s var(--ease-out) both;
}

/* 移动端响应式 */
@media (max-width: 768px) {
  .layout-main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: -1;
  }

  .header-inner {
    padding: 0 8px;
  }

  .nav-main {
    display: none;
  }

  .search-box {
    max-width: none;
  }

  .hero-title {
    font-size: 22px;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .post-card {
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  .boards-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .page-header {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }

  .hero-content {
    padding: 16px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .karma-display {
    flex-direction: column;
    gap: 8px;
  }
}

/* 无障碍 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 打印样式 */
@media print {
  .header, .footer, .sidebar {
    display: none;
  }

  .layout-main {
    grid-template-columns: 1fr;
  }

  body {
    background: #fff;
  }
}
