/* ==========================================================================
   文件路径: /public/css/laws/search.css
   文件描述: 法律检索页面 (laws search) 的特定样式文件。
             包含页面布局、筛选器、结果列表、状态标签、历史版本弹窗、
             以及响应式设计和 UI/UX 增强功能。
             注意：Hero区域、搜索栏、快捷关键词等共享组件样式已移至 search_bar.css
   ========================================================================== */


/* ==========================================================================
   1. 核心布局 (Main Layout)
   ========================================================================== */

/* 1.1 页面主容器 (V2) */
.laws-v2-layout {
  display: flex;
  gap: 16px;
  width: 90%;
  max-width: 1200px;
  margin: 20px auto 60px;
}

.lw-main-content {
  flex: 1;
  min-width: 0;
  /* 防止内容溢出时撑开布局 */
}

.lw-filter-sidebar {
  width: 260px;
  flex-shrink: 0;
}

/* 1.2 通用面板/容器样式 */
.lw-panel {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
}

/* 特定视图容器 */
#lwListView {
  background-color: #fff;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}


/* ==========================================================================
   2. 组件样式 (Components)
   ========================================================================== */

/* --- 2.1 状态与标签 (Status & Tags) --- */
.ri-status.core,
.lw-mini-tag.core,
.timeline-legend .core {
  background: linear-gradient(120deg, #d4a104, #f5cf4d);
  color: #523f00 !important;
}

.lw-status-valid,
.ri-status.valid,
.lw-mini-tag.valid,
.lw-status-pill.lw-status-valid {
  background: #8ec758;
  color: white;
}

.lw-status-expired,
.ri-status.expired,
.lw-mini-tag.expired,
.lw-status-pill.lw-status-expired {
  background: #d9d9d9;
  color: #555;
}

.lw-status-pending,
.ri-status.pending,
.lw-mini-tag.pending,
.lw-status-pill.lw-status-pending {
  background: #fff4d6;
  color: #9a6b00;
  position: relative;
}

/* 状态标签样式微调 */
.lw-status-pill {
  font-weight: 600;
  letter-spacing: .5px;
  border: 1px solid rgba(0, 0, 0, .05);
}


.lw-status-pill.lw-status-expired {
  background: #eceff3;
  color: #5b6470;
}

.lw-status-pill.lw-status-pending {
  background: #fff3cc;
  color: #8c6300;
}

/* 小尺寸标签 */
.lw-mini-tag.core {
  font-weight: 600;
}

/* "效力不明" 状态的 Tooltip 提示 */
.lw-status-pending[data-title]:hover:after,
.ri-status.pending[data-title]:hover:after,
.lw-mini-tag.pending[data-title]:hover:after {
  content: attr(data-title);
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 6px);
  background: #2c2d41;
  color: #fff;
  font-size: 11px;
  line-height: 1.3;
  white-space: normal;
  padding: 6px 8px;
  border-radius: 6px;
  width: 200px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
  z-index: 300;
}

.lw-status-pending[data-title]:hover:before,
.ri-status.pending[data-title]:hover:before,
.lw-mini-tag.pending[data-title]:hover:before {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 0);
  width: 10px;
  height: 6px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid #2c2d41;
  z-index: 301;
  /* 确保在 tooltip 内容之上 */
}

/* --- 2.2 筛选侧边栏 (Filter Sidebar) --- */
.lw-filter-sidebar {
  background: #ffffff;
  border: 1px solid #e2e6ee;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
  border-radius: 8px;
}

.lw-filter-block {
  margin-bottom: 20px;
  border: 1px solid #eef0f3;
  /* 微调样式 */
  background: #fff;
}

.lw-filter-block h4,
.lw-filter-block header {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
  color: #2c2d41;
}

.lw-filter-scroll {
  max-height: 200px;
  overflow-y: auto;
  padding-right: 8px;
}

.lw-filter-sidebar::-webkit-scrollbar {
  width: 10px;
}

.lw-filter-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.lw-filter-sidebar::-webkit-scrollbar-thumb {
  background: #c2ccd8;
  border-radius: 6px;
  border: 2px solid #f5f7fa;
}

.lw-filter-sidebar::-webkit-scrollbar-thumb:hover {
  background: #aab5c2;
}

.lw-check {
  display: block;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13px;
}

.lw-check input {
  margin-right: 6px;
  width: 14px;
  height: 14px;
  accent-color: var(--color-primary);
}

/* --- 3.4 已选筛选条件栏 (Active Filters Bar) --- */
.lw-criteria-bar {
  display: flex;
  align-items: center;
  min-height: 40px;
  width: 90%;
  max-width: 1200px;
  margin: 0 auto 16px;
  background: #fff;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  box-sizing: border-box; /* 确保 padding 不会增加总宽度 */
  position: sticky;
  top: 0;
  z-index: 100;
  transition: box-shadow 0.3s ease;
}

/* 条件栏吸顶时添加阴影效果 */
.lw-criteria-bar.stuck {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.lw-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  row-gap: 10px;
  /* 增加行间距 */
  align-items: center;
}


/* 清除筛选按钮 */
.lw-condition-clear {
  border: 1px dashed var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 20px;
}

.lw-condition-clear:hover {
  border-color: var(--color-primary);
}

.lw-chip-placeholder {
  color: #888;
  font-size: 13px;
}

/* --- 3.5 排序与批量操作栏 (Sort & Batch Operations) --- */
.lw-sort-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--color-border);
}

.lw-sort-strip .sort-group {
  display: flex;
  gap: 6px;
}

.lw-sort-btn {
  appearance: none;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
  transition: .15s;
}

.lw-sort-btn:hover {
  border-color: var(--color-primary);
}

.lw-sort-btn.active {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
}

.lw-sort-btn .arrow {
  font-size: 10px;
  opacity: .7;
}

.lw-batch-ops {
  display: none;
  /* 默认隐藏，通过 .active 类显示 */
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: 8px;
}

.lw-batch-ops.active {
  display: flex;
}

.lw-batch-ops-left {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--color-text-sub);
}

.lw-batch-ops .lw-divider {
  width: 1px;
  height: 18px;
  background: var(--color-border);
}

.lw-batch-ops-actions {
  display: flex;
  gap: 8px;
}

.lw-batch-btn {
  appearance: none;
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.1;
}

.lw-batch-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.lw-batch-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
}

/* --- 3.6 搜索结果项 (Search Result Item) --- */
/* 结果项容器（扁平列表风格） */
.lw-flat-list {
  display: block;
  border: 1px solid #e2e6ee;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
}

.lw-flat-list .lw-result-item:not(:last-child) {
  border-bottom: 1px solid #f0f1f3;
}

/* 结果项基础样式 */ 
.lw-result-item {
  padding: 16px 20px;
  position: relative;
  transition: background .14s, box-shadow .2s;
  background: #fff;
  /* 旧版独立卡片样式 */
  border-bottom: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  /* margin-bottom: 12px; */
}

.lw-result-item:hover {
  background: #f7f8fa;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}

/* 标题行 */
.ri-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 45px;
  margin-bottom: 8px;
}

.ri-title {
  font-size: 20px;
  /* 统一尺寸 */
  font-weight: 600;
  color: #2c2d41;
  text-decoration: none;
  flex: 1;
  line-height: 1.35;
  letter-spacing: .3px;
}

.ri-title:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* 标签容器 */
.ri-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ri-status {
  flex-shrink: 0;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 20px;
  /* 圆角药丸状 */
  font-weight: 500;
  line-height: 1.2;
}

/* 核心标签样式 */
.ri-status.lw-status-core {
  background: #c7a351;
  /* color: #6b5300; */
  color: white;
  box-shadow: 0 1px 3px rgba(245, 211, 71, 0.3);
}

/* 已更新标签样式（新增） */
.ri-status.lw-status-updated {
  background: #589bc7;
  color: white;
  box-shadow: 0 1px 3px rgba(88, 155, 199, 0.3);
}

.ri-status.lw-status-expired {
  opacity: .85;
}

.ri-status.lw-status-pending {
  opacity: .9;
}

/* 元数据表格布局 */
.ri-desc-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 20px 0 10px 0;
  font-size: 15px;
  color: #666;
}

/* 元数据行 */
.ri-desc-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 24px;
  align-items: baseline;
}

.ri-desc-row > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

.ri-meta {
  white-space: nowrap;
  position: relative;
}

/* 文号和发布机关的 tooltip */
.ri-meta[title]:hover::after,
.ri-agency[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 6px;
  background: #2c2d41;
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  padding: 6px 10px;
  border-radius: 6px;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 100;
  word-break: break-all;
  pointer-events: none;
}

.ri-meta[title]:hover::before,
.ri-agency[title]:hover::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 100%;
  margin-top: 0px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid #2c2d41;
  z-index: 101;
  pointer-events: none;
}

/* 发布机关样式 - 支持文本截断 */
.ri-agency {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  position: relative;
}

/* 响应式：小屏幕改为单列布局 */
@media (max-width: 768px) {
  .ri-desc-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

}

/* 摘要/代码片段 */
.ri-abstract {
  font-size: 13px;
  color: #555;
  line-height: 1.6;
}

.ri-snippet {
  font-size: 15px;
  line-height: 1.6;
  color: #444;
  background: #f6f8fa;
  padding: 6px 10px;
  border-radius: 6px;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
}

.ri-abstract mark,
.ri-snippet mark {
  background: var(--color-accent);
  padding: 0 2px;
  border-radius: 2px;
}

/* 卡片底部操作区 */
.lw-law-footer {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lw-law-footer .lw-btn {
  font-size: 11px;
  padding: 4px 10px;
}


/* --- 3.7 分页 (Pagination) --- */
#lwPagination {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 6px;
}

/* --- 3.8 空状态与加载 (Empty & Loading States) --- */
.lw-empty {
  text-align: center;
  padding: 50px 28px;
  color: #5b6572;
  background: linear-gradient(135deg, #ffffff, #f5f7fa);
  border: 1px dashed #d6dce3;
  border-radius: 12px;
}

/* 加载覆盖层 (未来功能) */
.lw-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .65);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: saturate(180%) blur(4px);
  z-index: 10;
}

.lw-loading-overlay .spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #d0d5dc;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* 小型加载动画（按钮内使用） */
.lw-btn .spinner-small,
.lw-btn [style*="animation:spin"] {
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 骨架屏加载状态 */
.lw-skeleton {
  background: linear-gradient(90deg, #f2f4f7 25%, #e9ecf1 37%, #f2f4f7 63%);
  background-size: 400% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes skeleton {
  0% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0 50%;
  }
}

.lw-card-skel {
  height: 120px;
  margin-bottom: 12px;
}


/* --- 3.9 历史版本弹窗 (History Modal) --- */
.lw-history-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
  background: rgba(0, 0, 0, .35);
  backdrop-filter: saturate(180%) blur(2px);
}

.lw-history-modal[hidden] {
  display: none;
}

.lw-history-modal .lw-hm-panel {
  background: #fff;
  width: 980px;
  max-width: 100%;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
  overflow: hidden;
}

.lw-history-modal.visible .lw-hm-panel {
  animation: hmPop .28s ease;
}

@keyframes hmPop {
  0% {
    transform: translateY(18px);
    opacity: 0;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.lw-hm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #e5e8ed;
  flex-shrink: 0;
}

.lw-hm-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #2c2d41;
}

.lw-hm-close {
  background: transparent;
  border: 0;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #666;
}

.lw-hm-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 300px;
}

.lw-hm-timeline {
  flex: 0 0 280px;
  padding: 16px 14px 20px;
  overflow: auto;
  border-right: 1px solid #eef0f3;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fbfcfd;
}

.hm-version-node {
  position: relative;
  padding-left: 14px;
}

.hm-version-node .v-line {
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #d9dee4;
}

.hm-version-node:last-child .v-line {
  display: none;
}

.hm-version-node .v-btn {
  background: #fff;
  border: 1px solid #e2e6ee;
  border-radius: 6px;
  padding: 8px 10px;
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: .18s;
}

.hm-version-node .v-btn:hover {
  background: #f5f7fa;
}

.hm-version-node .v-btn.active {
  border-color: #798095;
  box-shadow: 0 0 0 2px rgba(121, 128, 149, .15);
  background: #f0f2f5;
}

.hm-version-node .v-date {
  font-weight: 600;
  color: #2c2d41;
}

.hm-version-node .v-status {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 12px;
  margin-left: 6px;
}

.hm-version-node .v-status.valid {
  background: #e4f7ef;
  color: #137349;
}

.hm-version-node .v-status.expired {
  background: #e1e3e6;
  color: #555;
}

.hm-version-node .v-status.pending {
  background: #fff2c2;
  color: #8a6400;
}

.lw-hm-detail {
  flex: 1;
  overflow: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.v-detail-block {
  background: #fff;
  border: 1px solid #e2e6ee;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v-meta-row {
  font-size: 12px;
  line-height: 1.5;
  color: #444;
}

.v-diff {
  font-size: 12px;
  line-height: 1.55;
  background: #f6f8fa;
  padding: 10px 12px;
  border-radius: 6px;
  white-space: pre-wrap;
}

.hm-loading,
.hm-error,
.hm-empty {
  font-size: 12px;
  color: #666;
  padding: 6px 4px;
  text-align: center;
}

.lw-hm-footer {
  padding: 10px 16px;
  border-top: 1px solid #e5e8ed;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #fafbfc;
  flex-shrink: 0;
}


/* ==========================================================================
   4. UI/UX 增强 (Enhancements & Additions)
   ========================================================================== */

/* 4.1 辅助功能：焦点可见性 */
.lw-view-tab:focus,
#lwPagination button:focus,
.lw-filter-block input[type=checkbox]:focus+span,
.lw-chip button:focus,
#lwSortSelect:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* 4.2 平滑过渡与微交互 */
.lw-law-card,
.lw-tl-node,
.lw-filter-block,
.lw-filter-chip {
  transition: background .22s, box-shadow .25s, transform .22s;
}

/* 条件栏样式重新设计 */
#lwActiveChips {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 0;
  min-height: 44px;
}

.lw-no-filters {
  font-size: 13px;
  color: #94a3b8;
  font-style: italic;
}

.lw-chips-container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
}

.lw-filter-chip {
  display: inline-flex;
  align-items: center;
  max-width: 400px;
  padding: 6px 12px;
  background: var(--color-bg);
  border-radius: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-size: 13px;
  transition: all 0.2s ease;
  margin:0 10px;
}

.lw-filter-chip:hover {
  background: var(--color-border);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px var(--color-border);
}

.lw-chip-label {
  font-weight: 600;
  white-space: nowrap;
  opacity: 0.95;
}

.lw-chip-content {
  margin-left: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.lw-chip-remove {
  margin-left: 8px;
  padding: 0;
  width: 18px;
  height: 18px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lw-chip-remove:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.lw-clear-all-filters {
  padding: 6px 16px !important;
  margin:0 10px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  border: 1px solid #e5e7eb !important;
  background: white !important;
  color: #ef4444 !important;
  border-radius: 20px !important;
  white-space: nowrap;
  transition: all 0.2s ease !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.lw-clear-all-filters:hover {
  border-color: #ef4444 !important;
  background: #fef2f2 !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2) !important;
}


.lw-law-card:active,
.lw-back-top:active {
  transform: scale(.985);
}

.lw-filter-block:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, .08);
}

#lwPagination button {
  position: relative;
  overflow: hidden;
}

#lwPagination button:after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 100%;
  background: rgba(255, 255, 255, .25);
  transition: .25s;
}

#lwPagination button:hover:after {
  width: 100%;
}

/* 4.3 列表/时间线内容淡入动画 */
#lwCardContainer,
#lwTimelineContainer {
  animation: fadeIn .35s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 4.4 暗黑模式支持 */
@media (prefers-color-scheme: dark) {

  .laws-v2,
  body.laws-page {
    background: #1e2227;
    color: #d8dde3;
  }

  .lw-filter-block,
  .lw-law-card,
  .lw-tl-node,
  .lw-top-search,
  .lw-history-modal .lw-hm-panel {
    background: #232a31;
    border-color: #37414c;
  }

  .lw-law-title,
  .lw-tl-title a,
  .lw-hm-header h3 {
    color: #e7ecf2;
  }

  .lw-meta span,
  .ri-meta {
    background: #2c343c;
  }

  .lw-status-valid {
    background: #1e3f2e;
    color: #58c996;
  }

  .lw-status-expired {
    background: #3a4047;
    color: #adb4bd;
  }

  .lw-status-pending {
    background: #4a3b11;
    color: #f5cf4d;
  }

  .lw-chip {
    background: #2b333b;
    border-color: #3c4651;
    color: #b5bdc6;
  }

  #lwPagination button {
    background: #2b333b;
    border-color: #3c4651;
    color: #c9d1d9;
  }

  #lwPagination button.primary {
    background: var(--color-primary);
  }

  .lw-back-top {
    box-shadow: 0 4px 18px rgba(0, 0, 0, .55);
  }

  .lw-tl-node:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, .6);
  }

  /* ... more dark mode styles ... */
}

/* 4.5 减弱动态效果支持 */
@media (prefers-reduced-motion: reduce) {

  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}



/* ==========================================================================
   6. 响应式设计 (Responsive Design)
   ========================================================================== */

/* --- 6.1 中等屏幕 (平板等) --- */
@media (max-width: 1100px) {
  .lw-criteria-bar {
    /* flex-direction: column;
    align-items: flex-start; */
    display:none;
  }
}

@media (max-width: 900px) {
  .lw-result-item {
    padding: 14px;
  }

  .ri-desc-row {
    column-gap: 12px;
  }

  .ri-title {
    font-size: 15px;
  }

  .lw-sort-strip {
    gap: 6px;
  }

  /* 历史弹窗响应式 */
  .lw-history-modal .lw-hm-panel {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .lw-history-modal .lw-hm-body {
    flex-direction: column;
  }

  .lw-history-modal .lw-hm-timeline {
    flex: 0 0 auto;
    flex-direction: row;
    overflow-x: auto;
    white-space: nowrap;
    border-right: 0;
    border-bottom: 1px solid #eef0f3;
  }

  .hm-version-node {
    min-width: 180px;
    padding-left: 0;
  }

  .hm-version-node .v-line {
    display: none;
  }

  /* 筛选器侧边栏动画 */
  .lw-filter-sidebar {
    animation: slideIn .4s ease;
  }

  @keyframes slideIn {
    from {
      opacity: 0;
      transform: translateY(12px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* --- 6.2 移动端小屏幕 --- */
@media (max-width: 640px) {
  .lw-result-item {
    padding: 12px;
  }

  /* 移动端重新设计结果项布局 */
  .ri-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .ri-title {
    width: 100%;
    font-size: 16px;
    line-height: 1.4;
    margin-bottom: 8px;
  }

  .ri-tags {
    display: none; /* 隐藏原有的标签行 */
  }

  /* 新增移动端信息行：核心标签、生效标志（左）+ 发布日期（右） */
  .ri-mobile-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 4px 0;
    padding: 6px 0;
  }

  .ri-mobile-tags {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .ri-mobile-number {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ri-mobile-date {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    flex-shrink: 0;
  }

  /* 隐藏原有的元数据表格，只显示摘要 */
  .ri-desc-table {
    display: none;
  }

  .ri-snippet {
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.5;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    /* 移动端取消行数限制，完全显示摘要内容 */
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    line-clamp: unset;
    overflow: visible;
    white-space: pre-wrap;
  }

  /* 摘要显示由JavaScript控制 */
}

/* 桌面端隐藏移动端专用信息行 */
@media (min-width: 641px) {
  .ri-mobile-info-row {
    display: none !important;
  }
}

/* --- 3.4.1 法律法规分类树 (Category Tree) --- */
.lw-cat-tree {
  padding: 5px;
}

.cat-item {
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease;
  border-radius: 4px;
}

.cat-label-wrapper {
  display: flex;
  align-items: center;
  padding: 6px 4px;
  cursor: pointer;
  border-radius: 4px;
}

.cat-item:hover > .cat-label-wrapper {
  background-color: #f0f5ff; /* Light blue on hover */
}

.cat-item.level-1 > .cat-label-wrapper {
  background-color: #f7f8fa; /* Slightly darker for top level */
}

.cat-toggle, .cat-toggle-placeholder {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-right: 4px;
  display: inline-block;
  text-align: center;
  line-height: 16px;
  transition: transform 0.2s ease-in-out;
}

.cat-toggle::before {
  content: '▶';
  font-size: 10px;
  color: #667085;
}

.cat-item:not(.collapsed) > .cat-label-wrapper > .cat-toggle {
  transform: rotate(90deg);
}

.cat-children {
  overflow: hidden;
  max-height: 1000px; /* Set a large max-height for transition */
  transition: max-height 0.3s ease-in-out, opacity 0.2s ease-in-out;
  opacity: 1;
}

.cat-item > .cat-children {
  padding-left: 20px; /* Indentation for children */
}

.cat-item.collapsed > .cat-children {
  max-height: 0;
  opacity: 0;
  pointer-events: none; /* Disable interaction when collapsed */
}

.cat-label-wrapper label {
  display: flex;
  align-items: center;
  flex-grow: 1;
  cursor: pointer;
  font-size: 15px;
}

.cat-label-wrapper input[type="checkbox"] {
  margin-right: 8px;
  width: 14px;
  height: 14px;
  accent-color: var(--color-primary);
}

/* --- 年份分段样式 (Year Segments) --- */
.year-segments {
  padding: 5px;
}

.year-segment {
  margin-bottom: 8px;
}

.year-segment-header {
  display: flex;
  align-items: center;
  padding: 6px 4px;
  cursor: pointer;
  border-radius: 4px;
  background-color: #f7f8fa;
  transition: background-color 0.2s ease;
}

.year-segment-header:hover {
  background-color: #e8edf5;
}

.year-toggle {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  display: inline-block;
  text-align: center;
  line-height: 16px;
  font-size: 10px;
  color: #667085;
  transition: transform 0.2s ease-in-out;
}

.year-segment-label {
  display: flex;
  align-items: center;
  flex-grow: 1;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #344054;
}

.year-segment-label input[type="checkbox"] {
  margin-right: 8px;
  width: 14px;
  height: 14px;
  accent-color: var(--color-primary);
}

.year-label {
  font-size: 13px;
  font-weight: 500;
  color: #344054;
}

.year-segment-items {
  padding-left: 22px;
  padding-top: 4px;
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.3s ease-in-out, opacity 0.2s ease-in-out;
  opacity: 1;
}

.year-segment-items.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  pointer-events: none;
}

.year-segment-items label {
  display: flex;
  align-items: center;
  padding: 4px 2px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 3px;
  transition: background-color 0.15s ease;
}

.year-segment-items label:hover {
  background-color: #f0f5ff;
}

.year-segment-items input[type="checkbox"] {
  margin-right: 8px;
  width: 14px;
  height: 14px;
  accent-color: #798095;
}

/* 筛选条复选框统一颜色 */
.lw-filter-block input[type="checkbox"] {
  margin-top: 6px;
  flex-shrink: 0;
  accent-color: #798095;
}


/* ==========================================================================
   排序块样式 (Sort Blocks)
   ========================================================================== */

.lw-list-topbar {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.sort-prefix-label,
.criteria-prefix-label {
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  white-space: nowrap;
  /* min-width: 56px; */
  display: inline-block;
}

.lw-sort-blocks {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.lw-sort-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  height: 32px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #495057;
  transition: all 0.2s ease;
  user-select: none;
}

.lw-sort-item:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

.lw-sort-item.active {
  background: #798095;
  border-color: #798095;
  color: #fff;
  font-weight: 500;
}

.lw-sort-item .sort-label {
  font-size: 13px;
  line-height: 1;
}

.lw-sort-item .sort-arrow {
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
}

.lw-sort-item .sort-arrows {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

.lw-sort-item .arrow-up,
.lw-sort-item .arrow-down {
  font-size: 10px;
  color: #adb5bd;
  cursor: pointer;
  transition: color 0.15s ease;
  line-height: 1;
}

.lw-sort-item.active .arrow-up,
.lw-sort-item.active .arrow-down {
  color: rgba(255, 255, 255, 0.3);
}

.lw-sort-item.active .arrow-up.active,
.lw-sort-item.active .arrow-down.active {
  color: #fff;
  font-weight: bold;
}

.lw-sort-item:not(.active) .arrow-up:hover,
.lw-sort-item:not(.active) .arrow-down:hover {
  color: #495057;
}

/* 排序块响应式 */
@media (max-width: 768px) {
  .lw-sort-blocks {
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
  }

  .lw-sort-blocks::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
  }

  .lw-sort-item {
    padding: 5px 10px;
    font-size: 12px;
    flex-shrink: 0;
  }
}

/* ==========================================================================
   12. 筛选器折叠功能 (Filter Collapse)
   ========================================================================== */

/* 筛选器头部 */
.filter-header {
  cursor: pointer;
  user-select: none;
  padding: 10px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #2c2d41;
  transition: background 0.2s ease;
}

.filter-header:hover {
  background: #e9ecef;
}

.filter-title {
  flex: 1;
}

.filter-toggle {
  font-size: 10px;
  color: #6c757d;
  transition: transform 0.2s ease;
  width: 12px;
  text-align: center;
  flex-shrink: 0;
}

/* 折叠状态 */
.lw-filter-block[data-collapsed="true"] .filter-toggle {
  transform: rotate(0deg);
}

.lw-filter-block[data-collapsed="false"] .filter-toggle {
  transform: rotate(0deg);
}

.lw-filter-block[data-collapsed="true"] .filter-content {
  display: none;
}

/* 筛选器内容 */
.filter-content {
  padding: 12px 6px;
}

/* ==========================================================================
   13. 标签树结构 (Tag Tree)
   ========================================================================== */

/* 树形项 */
.tag-tree-item {
  margin-bottom: 4px;
}

.tag-tree-header {
  display: flex;
  align-items: flex-start;
  padding: 2px 0;
}

.tree-toggle {
  cursor: pointer;
  user-select: none;
  font-size: 10px;
  color: #6c757d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform 0.15s ease;
  flex-shrink: 0;

  margin-top: 9px;
  width: 20px;
  /* 建议给一个固定宽度，方便点击 */
  height: 16px;
}

.tree-toggle:hover {
  color: #495057;
}

.tag-tree-item.collapsed .tree-toggle {
  transform: rotate(-90deg);
}

.tree-toggle-placeholder {
  width: 20px; 
  flex-shrink: 0;
  height: 16px;
  margin-top: 9px;
}

.tag-tree-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex: 1;
}

.tag-tree-checkbox input[type="checkbox"] {
  cursor: pointer;
  margin: 0;
}

.tag-tree-checkbox label {
  cursor: pointer;
  margin: 0;
  font-size: 14px;
  color: #2c2d41;
  user-select: none;
}

/* 子节点容器 */
.tag-tree-children {
  margin-left: 12px;
  margin-top: 4px;
  padding-left: 4px;
  border-left: 1px solid #e9ecef;
}

.tag-tree-item.collapsed > .tag-tree-children {
  display: none;
}

/* 统一树形标签样式与扁平标签一致 */
.tag-tree-header label {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 15px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
    line-height: 1.5;
}

.tag-tree-checkbox input[type="checkbox"] {
  margin-right: 6px;
  cursor: pointer;
}

.tag-tree-checkbox input[type="checkbox"]:indeterminate {
  opacity: 0.6;
}

.tag-tree-checkbox input[type="checkbox"]:indeterminate::before {
  content: '';
  display: block;
  width: 8px;
  height: 2px;
  background: currentColor;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}


/* 视图切换按钮容器 */
.lw-view-switch {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

/* 视图切换按钮 */
.lw-view-tab {
  flex: 1;
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #6b7280;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.lw-view-tab.active {
  background: var(--color-primary, #2563eb);
  color: #fff;
  border-color: var(--color-primary, #2563eb);
}

.lw-view-tab:hover:not(.active):not(.disabled) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

/* 视图切换按钮禁用状态 */
.lw-view-tab.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  position: relative;
}
/* 1. 选中特定的按钮 */
.lw-view-tab.disabled[data-view="reference"] {
  font-size: 0 !important;
  /* 将原本的“正在开发”文字大小设为0，从而隐藏它 */
}

/* 2. 设置默认显示状态 (使用伪元素) */
.lw-view-tab.disabled[data-view="reference"]::before {
  content: "参考法规";
  /* 默认显示的文字 */
  font-size: 14px;
  /* 恢复字体大小 (需与原按钮字体一致) */
  display: inline-block;
  /* 确保伪元素表现为块级行为 */
  vertical-align: middle;
  /* 修复因font-size:0导致的垂直对齐问题 */
}

/* 3. 设置悬浮 (Hover) 状态 */
.lw-view-tab.disabled[data-view="reference"]:hover::before {
  content: "正在开发";
  /* 悬浮时变成的文字 */
  /* 可选：如果你希望悬浮时文字颜色也变化，可以在这里加 color: #xxx; */
}

