/* ===== 卫浴知识速查站 - 问答风格样式 ===== */
/* 主色调: #ff9800 (橙色) */

/* ===== CSS 变量 ===== */
:root {
  --accent-color: #ff9800;
  --accent-light: #ffb74d;
  --accent-dark: #f57c00;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f5f5f5;
  --bg-card: #fafafa;
  --border-color: #e0e0e0;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --header-height: 64px;
}

/* ===== 重置样式 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-dark);
}

ul, ol {
  list-style: none;
}

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

/* ===== 布局容器 ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== 页头 ===== */
.header {
  background: var(--bg-primary);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
}

.logo span {
  color: var(--text-primary);
}

.nav {
  display: flex;
  gap: 32px;
}

.nav a {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
}

.nav a:hover,
.nav a.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  width: 280px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 0.9rem;
}

.search-box button {
  background: none;
  border: none;
  color: var(--accent-color);
  cursor: pointer;
  font-size: 1rem;
}

/* ===== Hero 区域 ===== */
.hero {
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-dark) 100%);
  color: white;
  padding: 60px 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 16px;
  font-weight: 700;
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.95;
  max-width: 600px;
  margin: 0 auto 32px;
}

.hero-search {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  background: white;
  border-radius: var(--radius-lg);
  padding: 8px;
  box-shadow: var(--shadow-md);
}

.hero-search input {
  flex: 1;
  border: none;
  padding: 12px 16px;
  font-size: 1rem;
  outline: none;
}

.hero-search button {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.hero-search button:hover {
  background: var(--accent-dark);
}

/* ===== 分类标签 ===== */
.category-tags {
  padding: 40px 0;
  background: var(--bg-primary);
}

.category-tags h2 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 1.3rem;
  color: var(--text-primary);
}

.tags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
}

.tag-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  transition: all 0.2s;
}

.tag-card:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-sm);
}

.tag-card .icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.tag-card .name {
  font-weight: 600;
  color: var(--text-primary);
}

.tag-card .count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== 问题卡片 ===== */
.question-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: box-shadow 0.2s;
}

.question-card:hover {
  box-shadow: var(--shadow-md);
}

.question-header {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.vote-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 48px;
}

.vote-buttons button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
}

.vote-buttons .score {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.question-content {
  flex: 1;
}

.question-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  line-height: 1.4;
}

.question-title a {
  color: inherit;
}

.question-title a:hover {
  color: var(--accent-color);
}

.question-excerpt {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

.question-meta {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.question-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.best-answer-badge {
  background: #4caf50;
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.answer-count {
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ===== 内容区块 ===== */
.section {
  padding: 40px 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.view-all {
  font-size: 0.9rem;
  font-weight: 500;
}

/* ===== 文章列表 ===== */
.article-list {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.article-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.article-item a {
  color: var(--text-primary);
  font-weight: 500;
  display: block;
  margin-bottom: 4px;
}

.article-item a:hover {
  color: var(--accent-color);
}

.article-item .meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== 三栏布局 ===== */
.three-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* ===== 面包屑 ===== */
.breadcrumb {
  background: var(--bg-primary);
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.breadcrumb ol {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.breadcrumb li:not(:last-child)::after {
  content: ">";
  margin-left: 8px;
  color: var(--text-muted);
}

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

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

.breadcrumb li:last-child {
  color: var(--text-primary);
  font-weight: 500;
}

/* ===== 分类页头部 ===== */
.category-header {
  background: var(--bg-primary);
  padding: 32px 0;
  border-bottom: 1px solid var(--border-color);
}

.category-header h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.category-header p {
  color: var(--text-secondary);
}

/* ===== 筛选器 ===== */
.filter-bar {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.filter-bar a {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 4px 0;
}

.filter-bar a.active,
.filter-bar a:hover {
  color: var(--accent-color);
}

/* ===== 分页 ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 32px 0;
}

.pagination a,
.pagination span {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.pagination a {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.pagination a:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.pagination .current {
  background: var(--accent-color);
  color: white;
}

.pagination .disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ===== 文章详情页 ===== */
.article-header {
  background: var(--bg-primary);
  padding: 40px 0;
  border-bottom: 1px solid var(--border-color);
}

.article-header h1 {
  font-size: 1.8rem;
  line-height: 1.4;
  margin-bottom: 16px;
}

.article-info {
  display: flex;
  gap: 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.article-body {
  background: var(--bg-primary);
  padding: 40px 0;
}

.article-content {
  max-width: 800px;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.article-content p {
  margin-bottom: 20px;
}

.article-content h2 {
  font-size: 1.4rem;
  margin: 32px 0 16px;
  color: var(--text-primary);
}

.article-content h3 {
  font-size: 1.2rem;
  margin: 24px 0 12px;
  color: var(--text-primary);
}

.article-content ul,
.article-content ol {
  margin-bottom: 20px;
  padding-left: 24px;
}

.article-content ul li {
  list-style: disc;
  margin-bottom: 8px;
}

.article-content ol li {
  list-style: decimal;
  margin-bottom: 8px;
}

/* ===== 答案区域 ===== */
.answers-section {
  background: var(--bg-secondary);
  padding: 40px 0;
}

.answers-section h2 {
  font-size: 1.3rem;
  margin-bottom: 24px;
}

.answer-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.answer-card.best-answer {
  border-color: #4caf50;
  background: #f8fff8;
}

.answer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.answer-author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--accent-dark);
}

.author-info .name {
  font-weight: 600;
  color: var(--text-primary);
}

.author-info .time {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.answer-content {
  line-height: 1.8;
  color: var(--text-primary);
}

.answer-content p {
  margin-bottom: 16px;
}

/* ===== 404页面 ===== */
.error-page {
  min-height: calc(100vh - var(--header-height) - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
}

.error-code {
  font-size: 8rem;
  font-weight: 700;
  color: var(--accent-color);
  line-height: 1;
  margin-bottom: 16px;
}

.error-title {
  font-size: 1.8rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.error-message {
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 400px;
}

.btn-primary {
  display: inline-block;
  background: var(--accent-color);
  color: white;
  padding: 12px 32px;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--accent-dark);
  color: white;
}

/* ===== 页脚 ===== */
.footer {
  background: var(--text-primary);
  color: white;
  padding: 40px 0 20px;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}

.footer-brand .logo {
  margin-bottom: 16px;
}

.footer-brand p {
  color: #aaa;
  font-size: 0.9rem;
  line-height: 1.6;
}

.footer h4 {
  font-size: 1rem;
  margin-bottom: 16px;
  color: white;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  color: #aaa;
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--accent-color);
}

.footer-bottom {
  border-top: 1px solid #444;
  padding-top: 20px;
  text-align: center;
  color: #888;
  font-size: 0.85rem;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1024px) {
  .three-columns {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 768px) {
  .header .container {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 20px;
  }

  .nav {
    order: 3;
    width: 100%;
    gap: 16px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
  }

  .search-box {
    width: auto;
    flex: 1;
    margin-left: 16px;
  }

  .hero {
    padding: 40px 0;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .hero-search {
    flex-direction: column;
    margin: 0 20px;
  }

  .hero-search button {
    width: 100%;
  }

  .tags-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 20px;
  }

  .question-header {
    flex-direction: column;
    gap: 12px;
  }

  .vote-buttons {
    flex-direction: row;
    min-width: auto;
  }

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

  .error-code {
    font-size: 5rem;
  }
}

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

  .section {
    padding: 24px 0;
  }

  .article-header h1,
  .category-header h1 {
    font-size: 1.4rem;
  }

  .answer-card {
    padding: 16px;
  }
}
