/* 文章详情页样式 */

/* 文章页面布局 - 支持TOC目录的新布局 */
.article-page-layout {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 主内容区域 - 版心 */
.article-main {
  width: 100%;
}

/* 文章容器 - 旧版布局（兼容） */
.article-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 100px 20px 60px;
}

/* TOC侧边栏 */
.toc-sidebar {
  position: fixed;
  right: calc((100vw - 800px) / 2 - 300px);
  top: 120px;
  width: 260px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.toc-container {
  background: #eff6ff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #dbeafe;
}

/* CTA按钮 - 目录顶部 */
.toc-cta {
  margin-bottom: 16px;
}

.toc-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.toc-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.toc-cta-btn:active {
  transform: translateY(0);
}

.toc-cta-icon {
  font-size: 18px;
}

.toc-cta-text {
  font-weight: 600;
}

.toc-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #3b82f6;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toc-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  border-radius: 2px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin-bottom: 8px;
}

.toc-list a {
  display: block;
  color: #666;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.5;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.toc-list a:hover {
  color: #3b82f6;
  background: #eff6ff;
}

.toc-list a.active {
  color: #3b82f6;
  background: #eff6ff;
  border-left-color: #3b82f6;
  font-weight: 500;
}

/* TOC层级缩进 */
.toc-list .toc-h2 {
  padding-left: 12px;
}

.toc-list .toc-h3 {
  padding-left: 24px;
  font-size: 13px;
}

.toc-list .toc-h4 {
  padding-left: 36px;
  font-size: 12px;
  color: #888;
}

/* 面包屑导航 */
.breadcrumb {
  font-size: 14px;
  color: #666;
  margin-bottom: 30px;
}

.breadcrumb a {
  color: #666;
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb a:hover {
  color: #f86a3a;
}

.breadcrumb .separator {
  margin: 0 8px;
  color: #ccc;
}

.breadcrumb .current {
  color: #999;
}

/* 文章头部 */
.article-header {
  margin-bottom: 30px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.article-meta .category {
  display: inline-block;
  padding: 4px 12px;
  background: linear-gradient(135deg, #fff5f2 0%, #ffebe5 100%);
  border-radius: 4px;
  font-size: 13px;
  color: #f86a3a;
  font-weight: 500;
}

.article-meta .date,
.article-meta .author {
  color: #999;
  font-size: 14px;
}

.article-title {
  font-size: 32px;
  font-weight: 700;
  color: #222;
  line-height: 1.4;
  margin: 0;
}

/* 封面图 */
.cover-image,
.article-cover {
  margin-bottom: 40px;
  border-radius: 12px;
  overflow: hidden;
  max-height: 400px;
}

.cover-image img,
.article-cover img {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  display: block;
}

/* 文章正文 */
.article-content {
  font-size: 16px;
  line-height: 1.9;
  color: #333;
}

.article-content h2 {
  font-size: 24px;
  font-weight: 600;
  color: #222;
  margin: 40px 0 20px;
  padding-left: 12px;
  border-left: 4px solid #f86a3a;
}

.article-content h3 {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin: 30px 0 16px;
}

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

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

.article-content li {
  margin-bottom: 10px;
  line-height: 1.8;
}

.article-content strong {
  color: #222;
  font-weight: 600;
}

.article-content a {
  color: #f86a3a;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.article-content a:hover {
  border-bottom-color: #f86a3a;
}

.article-content blockquote {
  margin: 24px 0;
  padding: 20px 24px;
  background: #f9f9f9;
  border-left: 4px solid #f86a3a;
  border-radius: 0 8px 8px 0;
  color: #555;
  font-style: italic;
}

.article-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 20px 0;
}

.article-content pre {
  background: #f5f5f5;
  padding: 16px 20px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.6;
}

.article-content code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 14px;
  color: #e83e8c;
}

/* 表格样式 */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}

.article-content th,
.article-content td {
  border: 1px solid #e8e8e8;
  padding: 12px 16px;
  text-align: left;
}

.article-content th {
  background: #fafafa;
  font-weight: 600;
  color: #333;
}

.article-content tbody tr:nth-child(even) {
  background: #fafafa;
}

.article-content tbody tr:hover {
  background: #fff7e6;
}

/* 删除线 */
.article-content del {
  text-decoration: line-through;
  color: #999;
}

/* 任务列表 */
.article-content input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.2);
}

/* 脚注 */
.article-content sup {
  font-size: 12px;
  color: #f86a3a;
}

.article-content sup a {
  color: #f86a3a;
  text-decoration: none;
  font-weight: 600;
}

.article-content sup a:hover {
  text-decoration: underline;
}

/* 脚注区域（文章底部） */
.article-content section[data-footnotes],
.article-content .footnotes {
  font-size: 14px;
  color: #666;
  border-top: 2px solid #f86a3a;
  padding-top: 16px;
  margin-top: 40px;
}

.article-content section[data-footnotes]::before,
.article-content .footnotes::before {
  content: '参考注释';
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
}

.article-content section[data-footnotes] ol,
.article-content .footnotes ol {
  padding-left: 20px;
  margin: 0;
}

.article-content section[data-footnotes] li,
.article-content .footnotes li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.article-content a[data-footnote-backref] {
  color: #f86a3a;
  text-decoration: none;
  margin-left: 4px;
}

/* 高亮 */
.article-content mark {
  background: #fff7e6;
  padding: 2px 4px;
  border-radius: 2px;
}

/* 定义列表 */
.article-content dl {
  margin: 16px 0;
}

.article-content dt {
  font-weight: 600;
  color: #333;
  margin-top: 12px;
}

.article-content dd {
  margin-left: 20px;
  color: #666;
}

/* 文章标签 */
.article-tags {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid #eee;
}

.article-tags .label {
  color: #666;
  font-size: 14px;
  margin-right: 8px;
}

.article-tags .tag {
  display: inline-block;
  padding: 4px 12px;
  background: #f5f5f5;
  border-radius: 4px;
  margin-right: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #666;
  text-decoration: none;
  transition: all 0.2s;
}

.article-tags .tag:hover {
  background: #fff5f2;
  color: #f86a3a;
}

/* 文章导航 */
.article-nav {
  margin-top: 40px;
  text-align: center;
}

.article-nav .back-to-list {
  display: inline-block;
  padding: 12px 32px;
  background: linear-gradient(135deg, #f86a3a 0%, #ff8c5a 100%);
  color: white;
  text-decoration: none;
  border-radius: 24px;
  font-size: 15px;
  transition: all 0.3s;
}

.article-nav .back-to-list:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(248, 106, 58, 0.4);
}

/* 相关推荐 */
.related-articles {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid #eee;
}

.related-articles h3 {
  font-size: 22px;
  font-weight: 600;
  color: #222;
  margin-bottom: 24px;
}

.related-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.related-item {
  display: block;
  text-decoration: none;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s;
}

.related-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.related-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.related-cover {
  width: 100%;
  height: 140px;
  background-size: cover;
  background-position: center;
  background-color: #f5f5f5;
  background-image: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}

.related-item .info {
  padding: 16px;
}

.related-item h4 {
  font-size: 15px;
  font-weight: 500;
  color: #333;
  line-height: 1.5;
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-item .date {
  font-size: 13px;
  color: #999;
}

/* 响应式 */
@media screen and (max-width: 768px) {
  .article-container {
    padding: 80px 16px 40px;
  }

  .article-title {
    font-size: 24px;
  }

  .article-content {
    font-size: 15px;
  }

  .article-content h2 {
    font-size: 20px;
    margin: 30px 0 16px;
  }

  .related-list {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .related-item {
    display: flex;
  }

  .related-item img {
    width: 120px;
    height: 90px;
  }

  .related-cover {
    width: 120px;
    min-width: 120px;
    height: 90px;
  }

  .related-item .info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}
