/* =============================================
   前台展示页面样式
   ============================================= */

/* 头部导航 */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-logo {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
  text-decoration: none;
}
.site-logo:hover { text-decoration: none; color: var(--primary); }
.header-nav { display: flex; align-items: center; gap: 24px; }
.header-nav a {
  color: var(--gray-600);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.15s;
}
.header-nav a:hover { color: var(--primary); text-decoration: none; }

/* 搜索栏 */
.search-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 0;
}
.search-box {
  display: flex;
  align-items: center;
  border: 2px solid var(--gray-300);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s;
}
.search-box:focus-within { border-color: var(--primary); }
.search-box input {
  flex: 1;
  padding: 14px 16px;
  border: none;
  font-size: 15px;
  outline: none;
  color: var(--gray-800);
}
.search-box button {
  padding: 14px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.search-box button:hover { background: #1648b8; }
.search-mode {
  display: flex; align-items: center; gap: 16px; margin-top: 8px; padding-left: 4px;
}
.search-mode label { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--gray-500); cursor: pointer; }
.search-mode input[type="radio"] { accent-color: var(--primary); }

/* 分类标签栏 */
.category-bar {
  max-width: 1200px;
  margin: 16px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.category-tag {
  padding: 6px 16px;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  font-size: 13px;
  color: var(--gray-600);
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.category-tag:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.category-tag.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 主内容区 */
.main-content { max-width: 1200px; margin: 24px auto; padding: 0 24px; }

/* 法规列表 */
.law-list { display: flex; flex-direction: column; gap: 12px; }
.law-item {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px 20px;
  transition: all 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.law-item:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(26,86,219,0.08); text-decoration: none; }
.law-item-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.law-item-title { font-size: 16px; font-weight: 500; color: var(--gray-900); }
.law-item-meta { margin-top: 6px; font-size: 13px; color: var(--gray-500); }

/* 法规详情页 */
.detail-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 24px;
  margin-bottom: 24px;
}
.detail-title { font-size: 22px; font-weight: 600; color: var(--gray-900); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-meta {
  margin-top: 12px;
  font-size: 14px;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.detail-meta span { white-space: nowrap; }

/* 详情页三栏布局 */
.detail-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
.detail-sidebar {
  position: sticky;
  top: 84px;
  height: fit-content;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px;
}

/* 目录导航 */
.toc-title { font-size: 14px; font-weight: 500; color: var(--gray-700); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--gray-100); }
.toc-item {
  display: block;
  padding: 4px 8px;
  font-size: 13px;
  color: var(--gray-600);
  text-decoration: none;
  border-radius: 4px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background 0.1s;
}
.toc-item:hover { background: var(--gray-100); text-decoration: none; color: var(--gray-900); }
.toc-item.toc-part { font-weight: 500; color: var(--gray-800); font-size: 13px; }
.toc-item.toc-chapter { padding-left: 16px; }
.toc-item.toc-section { padding-left: 28px; font-size: 12px; color: var(--gray-500); }
.toc-item .toc-range { font-size: 11px; color: var(--gray-400); margin-left: 6px; }

/* 正文区 */
.detail-body {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 32px 40px;
}

/* 法条样式 */
.law-article { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px dashed var(--gray-100); }
.law-article:last-child { border-bottom: none; }
.law-article p { font-size: 15px; line-height: 2; color: var(--gray-800); }
.law-article strong { color: var(--primary); font-weight: 600; }
.article-paragraph { text-indent: 0; }

/* 操作按钮组 */
.action-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: #fff;
  color: var(--gray-600);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.action-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); text-decoration: none; }
.action-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.action-btn svg { width: 16px; height: 16px; }

/* 历史沿革 */
.history-panel {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px 20px;
  margin-top: 24px;
}
.history-title { font-size: 14px; font-weight: 500; color: var(--gray-700); margin-bottom: 12px; }
.history-item { display: flex; align-items: center; gap: 12px; padding: 6px 0; font-size: 13px; }
.history-date { color: var(--gray-500); white-space: nowrap; min-width: 90px; }
.history-event { color: var(--gray-700); }
.history-link { color: var(--primary); cursor: pointer; }

/* 批注区域 */
.annotation-section { margin-top: 24px; }
.annotation-section h3 { font-size: 15px; margin-bottom: 12px; color: var(--gray-700); }
.annotation-item {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
  border-left: 3px solid var(--primary);
}
.annotation-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.annotation-user { font-size: 13px; font-weight: 500; color: var(--gray-700); }
.annotation-time { font-size: 12px; color: var(--gray-400); }
.annotation-quote { font-size: 12px; color: var(--gray-500); font-style: italic; margin-bottom: 4px; padding: 4px 8px; background: #fff; border-radius: 4px; }
.annotation-content { font-size: 14px; color: var(--gray-800); }
.annotation-form {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
}
.annotation-form input, .annotation-form textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 14px; margin-bottom: 8px;
}
.annotation-form textarea { min-height: 60px; resize: vertical; }

/* 搜索结果页 - 左右布局 */
.search-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
.filter-panel {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px;
  height: fit-content;
  position: sticky;
  top: 84px;
}
.filter-title { font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 8px; }
.filter-list { list-style: none; }
.filter-list li {
  padding: 6px 8px;
  font-size: 13px;
  color: var(--gray-600);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s;
  display: flex;
  justify-content: space-between;
}
.filter-list li:hover { background: var(--gray-100); }
.filter-list li.active { background: var(--primary-light); color: var(--primary); }
.filter-list li .count { color: var(--gray-400); font-size: 12px; }
.search-result-count { font-size: 13px; color: var(--gray-500); margin-bottom: 16px; }

/* 收藏图标动画 */
.action-btn.favorited svg { fill: #dc2626; color: #dc2626; }

/* 打印样式 */
@media print {
  .site-header, .detail-sidebar, .action-bar, .annotation-section, .history-panel { display: none !important; }
  .detail-layout { grid-template-columns: 1fr !important; }
  .detail-body { border: none; padding: 0; }
  .law-article { break-inside: avoid; }
}

/* 响应式 */
@media (max-width: 768px) {
  .detail-layout { grid-template-columns: 1fr; }
  .detail-sidebar { position: static; max-height: none; }
  .detail-body { padding: 16px 20px; }
  .search-layout { grid-template-columns: 1fr; }
  .filter-panel { position: static; }
  .header-inner { padding: 0 16px; }
  .main-content { padding: 0 16px; }
}
