/* 法规历史沿革样式 */

/* ========================================
   1. 沿革面板容器
   ======================================== */

.law-lineage-container {
  /* margin: 20px 0; */
  /* border: 1px solid #e0e0e0; */
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* 沿革标题栏（旧样式，保留以防回退） */
.law-lineage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  /* background: linear-gradient(to bottom, #f8f9fa, #ffffff); */
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

/* .law-lineage-header:hover {
  background: linear-gradient(to bottom, #f0f2f5, #f8f9fa);
} */

.law-lineage-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.law-lineage-title .icon {
  font-size: 18px;
}

.law-lineage-toggle {
  font-size: 14px;
  color: #666;
  transition: transform 0.3s ease;
}

.law-lineage-toggle.expanded {
  transform: rotate(180deg);
}

/* 沿革内容区域 */
.law-lineage-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease-out;
}

.law-lineage-content.expanded {
  max-height: 2000px;
  transition: max-height 0.5s ease-in;
}

.law-lineage-body {
  padding: 24px 20px;
  display: flex;
  flex-direction: column; /* 确保垂直排列 */
  align-items: center; /* 水平居中 */
  border-top: 1px solid #e0e0e0;
}

/* 空状态 */
.law-lineage-empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 14px;
}

/* ========================================
   2. 时间线列表
   ======================================== */

.lineage-timeline {
  position: relative;
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 900px;
  width: 100%;
}

/* 时间线项 */
.lineage-item {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  position: relative;
  padding-bottom: 10px; /* 使用padding创建间隔，而非margin */
}

.lineage-item:last-child {
  padding-bottom: 0; /* 最后一个不需要间隔 */
}

/* 左栏：版本类型 + 日期 */
.lineage-left {
  flex-shrink: 0;
  width: 180px;
  text-align: right;
  padding-top: 0px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* 多版本类型时垂直排列 */
.lineage-left.has-multiple-types {
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

/* 版本类型容器 */
.lineage-types-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.lineage-version-type {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  color: #8d99af;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
}

.lineage-item.current .lineage-version-type {
  color: #99202a;
  background: #ffe8ea;
}

.lineage-date {
  font-size: 15px;
  color: #8d99af;
  font-weight: 600;
  white-space: nowrap;
}

.lineage-item.current .lineage-date {
  color: #99202a;
  font-weight: 600;
}

/* 中栏：圆圈（竖线已移到外层） */
.lineage-middle {
  position: relative;
  flex-shrink: 0;
  width: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 3px;
}

/* 圆圈 */
.lineage-dot {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid #8d99af;
  background: white;
  flex-shrink: 0;
  z-index: 2; /* 确保圆圈在竖线上方 */
  transition: all 0.3s;
}

/* 当前法规：实心圆 + 图标 */
.lineage-item.current .lineage-dot {
  width: 24px;
  height: 24px;
  border-color: #99202a;
  background: #99202a;
  border-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(153, 32, 41, 0.3);
}

.lineage-dot-icon {
  width: 16px;
  height: 16px;
  color: white;
}

/* 竖线连接器 - 使用绝对定位，相对于 .lineage-item */
.lineage-connector {
  position: absolute;
  left: 212px; /* 180px(left宽度) + 20px(gap) + 12px(圆圈中心) */
  top: 19px; /* padding-top 3px + 圆圈高度 16px */
  bottom: 0; /* 延伸到item底部（包括padding区域） */
  width: 2px;
  background: #e0e0e0;
  z-index: 1; /* 在圆圈下方 */
}

/* 当前法规的竖线起点需要调整（圆圈更大：24px） */
.lineage-item.current .lineage-connector {
  top: 27px; /* padding-top 3px + 当前圆圈高度 24px */
}

/* 最后一个项目不显示竖线 */
.lineage-item:last-child .lineage-connector {
  display: none;
}

/* 右栏：法规信息 */
.lineage-right {
  flex: 1;
  padding-top: 0px;
}

.lineage-law-name {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  line-height: 1.5;
}

.lineage-law-name a {
  color: #8d99af;
  text-decoration: none;
  transition: color 0.2s;
}

.lineage-law-name a:hover {
  color: #666;
  text-decoration: underline;
}

.lineage-item.current .lineage-law-name {
  color: #99202a;
}

.lineage-item.current .lineage-law-name a {
  color: #99202a;
  cursor: default;
  pointer-events: none;
}

.lineage-law-number {
  font-size: 15px;
  font-weight: 600;
  color: inherit;
}

.lineage-description {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  background: #f8f9fa;
  padding: 10px 12px;
  border-radius: 6px;
  border-left: 3px solid #999;
  margin-top: 8px;
  margin-bottom: 10px;
  line-height: 2;
}
.lineage-description:hover {
  background: #eef0f2;
}
.lineage-item.current .lineage-description {
  border-left-color: #99202a;
  background: #fff0f1;
}
/* 可点击的说明文本 */
.lineage-description.clickable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.lineage-description.clickable:hover {
  background: #eef0f2;
  border-left-color: #666;
}

.lineage-item.current .lineage-description.clickable:hover {
  border-left-color: #99202a;
  background: #fff0f1;
}


.lineage-description.collapsed {
  position: relative;
}

.lineage-description-text {
  display: block;
}

/* 移除展开按钮样式（不再需要） */

/* 无说明时隐藏描述块 */
.lineage-description:empty {
  display: none;
}

/* ========================================
   3. 响应式设计
   ======================================== */

@media (max-width: 768px) {
  .lineage-item {
    gap: 12px;
  }

  .lineage-left {
    width: 120px;
    font-size: 12px;
  }

  .lineage-version-type {
    font-size: 12px;
    padding: 3px 8px;
  }

  .lineage-date {
    font-size: 12px;
  }

  .lineage-middle {
    width: 20px;
  }

  .lineage-dot {
    width: 14px;
    height: 14px;
    border-width: 2px;
  }

  .lineage-item.current .lineage-dot {
    width: 20px;
    height: 20px;
  }

  .lineage-law-name {
    font-size: 14px;
  }

  .lineage-description {
    font-size: 12px;
    padding: 8px 10px;
  }
}

/* ========================================
   4. 加载状态
   ======================================== */

.law-lineage-loading {
  text-align: center;
  padding: 30px 20px;
  color: #999;
  font-size: 14px;
}

.law-lineage-loading::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #e0e0e0;
  border-top-color: #589bc7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* ========================================
   5. 多链分组样式
   ======================================== */

/* 演变链分组容器 */
.lineage-chain-group {
  position: relative; /* 作为绝对定位的参照 */
  width: 100%; /* 确保每组占满宽度 */
  max-width: 900px; /* 与timeline宽度一致 */
  margin: 0 auto 30px; /* 保持居中 */
}

.lineage-chain-group:last-child {
  margin-bottom: 0;
}

/* 演变链组标题 - 绝对定位在左侧，竖排文字 */
.lineage-chain-header {
  position: absolute;
  left: -100px; /* 放在板块左侧 */
  top: 0;
  width: 60px;
  font-size: 14px;
  font-weight: 600;
  color: #589bc7;
  writing-mode: vertical-rl; /* 竖排文字 */
  text-align: center;
  padding: 12px 8px;
  background: linear-gradient(135deg, #f0f7ff 0%, #e6f2ff 100%);
  border: 2px solid #589bc7;
  border-radius: 4px;
  letter-spacing: 2px;
}

/* 分组之间的分割线 */
.lineage-chain-group + .lineage-chain-group {
  padding-top: 30px;
  border-top: 2px dashed #e0e0e0;
}

/* 多链模式下的时间线调整 */
.lineage-chain-group .lineage-timeline {
  margin-top: 0;
}

/* 响应式：窗口较窄时，标签移回上方横排显示 */
@media (max-width: 1200px) {
  .lineage-chain-header {
    position: static; /* 取消绝对定位 */
    width: auto;
    writing-mode: horizontal-tb; /* 改为横排 */
    margin-bottom: 15px;
  }
}
