/* 全局样式重置和基础设置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 头部样式 */
header {
  text-align: center;
  padding: 2rem 0;
  border-bottom: 1px solid #e9ecef;
  margin-bottom: 2rem;
  position: relative;
}

/* 语言切换器样式 */
.language-switcher {
  position: absolute;
  top: 1rem;
  right: 0;
  z-index: 10;
}

.language-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: #3498db;
  color: #fff;
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 2px solid #3498db;
}

.language-link:hover {
  background-color: #2980b9;
  border-color: #2980b9;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

header h1 a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}

header h1 a:hover {
  color: #3498db;
}

.subtitle {
  color: #6c757d;
  font-size: 1.1rem;
  font-style: italic;
}

/* 主要内容区域 */
main {
  flex: 1;
  padding: 2rem 0;
}

/* 文章网格布局 */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  margin-top: 1rem;
}

/* 文章卡片样式 */
.article-card {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid #e9ecef;
}

.article-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.article-card h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: #2c3e50;
}

.article-card h2 a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}

.article-card h2 a:hover {
  color: #3498db;
}

/* 文章元信息 */
.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: #6c757d;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.article-meta time {
  font-weight: 500;
}

.article-meta .author {
  color: #495057;
}

/* 文章摘要 */
.excerpt {
  color: #495057;
  margin-bottom: 1rem;
  line-height: 1.7;
}

/* 标签样式 */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tag {
  background-color: #e3f2fd;
  color: #1976d2;
  padding: 0.25rem 0.75rem;
  border-radius: 15px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* 阅读更多链接 */
.read-more {
  display: inline-block;
  color: #3498db;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.read-more:hover {
  color: #2980b9;
  text-decoration: underline;
}

/* 文章详情页样式 */
.article-detail {
  background: #fff;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border: 1px solid #e9ecef;
}

.article-header {
  text-align: center;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.article-detail h1 {
  font-size: 2.5rem;
  color: #2c3e50;
  margin-bottom: 1rem;
  line-height: 1.3;
}

/* 文章内容样式 */
.article-content {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #333;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: #2c3e50;
  font-weight: 600;
}

.article-content h1 { font-size: 2rem; }
.article-content h2 { font-size: 1.8rem; }
.article-content h3 { font-size: 1.5rem; }
.article-content h4 { font-size: 1.3rem; }
.article-content h5 { font-size: 1.2rem; }
.article-content h6 { font-size: 1.1rem; }

.article-content p {
  margin-bottom: 1.5rem;
  text-align: justify;
}

.article-content blockquote {
  border-left: 4px solid #3498db;
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: #6c757d;
  background-color: #f8f9fa;
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-radius: 0 8px 8px 0;
}

.article-content ul,
.article-content ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

.article-content li {
  margin-bottom: 0.5rem;
}

.article-content code {
  background-color: #f1f3f4;
  color: #d73a49;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.9em;
}

.article-content pre {
  background-color: #f6f8fa;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.article-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.article-content table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1.5rem;
}

.article-content th,
.article-content td {
  border: 1px solid #dee2e6;
  padding: 0.75rem;
  text-align: left;
}

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

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1.5rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.article-content hr {
  border: none;
  border-top: 2px solid #e9ecef;
  margin: 2rem 0;
}

/* 文章底部 */
.article-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e9ecef;
  text-align: center;
}

.wechat-note {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.wechat-note::before {
  content: "💡 ";
  margin-right: 0.5rem;
}

.back-to-home {
  display: inline-block;
  color: #3498db;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.back-to-home:hover {
  color: #2980b9;
  text-decoration: underline;
}

/* 错误页面样式 */
.error-page {
  background: #fff;
  border-radius: 8px;
  padding: 3rem;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border: 1px solid #e9ecef;
  max-width: 600px;
  margin: 0 auto;
}

.error-page h2 {
  color: #dc3545;
  margin-bottom: 1rem;
  font-size: 2rem;
}

.error-page p {
  color: #6c757d;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

/* 底部样式 */
footer {
  text-align: center;
  padding: 2rem 0;
  border-top: 1px solid #e9ecef;
  margin-top: 3rem;
  color: #6c757d;
}

footer p {
  margin-bottom: 0.5rem;
}

.footer-links {
  font-size: 0.9rem;
  margin-top: 0.5rem !important;
}

.footer-links span {
  color: #6c757d;
  margin-right: 0.5rem;
}

.footer-links a {
  color: #3498db;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: #2980b9;
  text-decoration: underline;
}

.footer-contact {
  font-size: 0.9rem;
  margin-top: 0.5rem !important;
}

.footer-contact span {
  color: #6c757d;
  margin-right: 0.5rem;
}

.footer-contact a {
  color: #3498db;
  text-decoration: none;
  transition: color 0.3s ease;
  margin-right: 0.5rem;
}

.footer-contact a:hover {
  color: #2980b9;
  text-decoration: underline;
}

.cooperation-welcome {
  color: #28a745 !important;
  font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }

  header h1 {
    font-size: 2rem;
  }

  .article-detail h1 {
    font-size: 2rem;
  }

  .articles-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .article-card,
  .article-detail {
    padding: 1rem;
  }

  .article-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .language-switcher {
    position: static;
    text-align: center;
    margin-bottom: 1rem;
  }

  .language-link {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  .footer-contact {
    font-size: 0.8rem;
    text-align: center;
  }

  .footer-contact a {
    display: inline-block;
    margin: 0.25rem 0;
  }

  .cooperation-welcome {
    display: block;
    margin-top: 0.25rem;
  }
}

@media (max-width: 480px) {
  header {
    padding: 1rem 0;
  }

  header h1 {
    font-size: 1.8rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .article-content {
    font-size: 1rem;
  }

  .article-detail h1 {
    font-size: 1.8rem;
  }
}

/* 代码高亮优化 */
.hljs {
  background-color: #f6f8fa !important;
  color: #24292e !important;
  padding: 1rem !important;
  border-radius: 6px !important;
}

/* 深色模式代码高亮 */
@media (prefers-color-scheme: dark) {
  .hljs {
    background-color: #2d333b !important;
    color: #c9d1d9 !important;
  }
}

/* 打印样式 - 定义可打印区域 */
@media print {
  /* 隐藏不需要打印的元素 */
  header,
  footer,
  .article-footer,
  .wechat-note,
  .back-to-home,
  .navigation,
  .sidebar,
  .comments,
  .social-share,
  .ads,
  .popup,
  .modal,
  .language-switcher {
    display: none !important;
  }

  /* 打印容器设置 */
  body {
    font-family: 'Times New Roman', serif;
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
    margin: 0;
    padding: 0;
  }

  .container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    min-height: auto;
  }

  /* 主要打印内容区域 */
  main {
    margin: 0;
    padding: 0;
    flex: none;
  }

  /* 文章详情页打印样式 */
  .article-detail {
    background: #fff;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    margin: 0;
    page-break-inside: avoid;
  }

  /* 文章头部打印样式 */
  .article-header {
    text-align: left;
    border-bottom: 2px solid #000;
    padding-bottom: 20pt;
    margin-bottom: 30pt;
    page-break-after: avoid;
  }

  .article-detail h1 {
    font-size: 18pt;
    color: #000;
    margin-bottom: 10pt;
    line-height: 1.2;
    page-break-after: avoid;
  }

  .article-meta {
    color: #000;
    font-size: 10pt;
    margin-bottom: 15pt;
  }

  .article-meta time,
  .article-meta .author {
    color: #000;
  }

  /* 标签打印样式 */
  .tags {
    display: inline;
    margin-bottom: 15pt;
  }

  .tag {
    background: #f0f0f0;
    color: #000;
    border: 1px solid #ccc;
    padding: 2pt 6pt;
    border-radius: 2pt;
    font-size: 9pt;
    display: inline-block;
    margin-right: 5pt;
  }

  /* 正文内容打印样式 */
  .article-content {
    font-size: 12pt;
    line-height: 1.6;
    color: #000;
    text-align: justify;
    orphans: 3;
    widows: 3;
    page-break-inside: avoid;
  }

  /* 标题打印样式 */
  .article-content h1,
  .article-content h2,
  .article-content h3,
  .article-content h4,
  .article-content h5,
  .article-content h6 {
    color: #000;
    font-weight: bold;
    page-break-after: avoid;
    page-break-inside: avoid;
    margin-top: 24pt;
    margin-bottom: 12pt;
  }

  .article-content h1 { font-size: 16pt; }
  .article-content h2 { font-size: 14pt; }
  .article-content h3 { font-size: 13pt; }
  .article-content h4 { font-size: 12pt; }
  .article-content h5 { font-size: 11pt; }
  .article-content h6 { font-size: 10pt; }

  /* 段落打印样式 */
  .article-content p {
    margin-bottom: 12pt;
    text-align: justify;
    orphans: 3;
    widows: 3;
    page-break-inside: avoid;
  }

  /* 引用块打印样式 */
  .article-content blockquote {
    border-left: 3px solid #000;
    padding-left: 15pt;
    margin: 15pt 0;
    font-style: italic;
    color: #333;
    background: #f9f9f9;
    padding-top: 10pt;
    padding-bottom: 10pt;
    page-break-inside: avoid;
  }

  /* 列表打印样式 */
  .article-content ul,
  .article-content ol {
    margin-bottom: 12pt;
    padding-left: 30pt;
    page-break-inside: avoid;
  }

  .article-content li {
    margin-bottom: 6pt;
    page-break-inside: avoid;
  }

  /* 代码打印样式 */
  .article-content code {
    background: #f5f5f5;
    color: #000;
    border: 1px solid #ddd;
    padding: 2pt 4pt;
    border-radius: 2pt;
    font-family: 'Courier New', monospace;
    font-size: 10pt;
  }

  .article-content pre {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 2pt;
    padding: 10pt;
    overflow-x: auto;
    margin-bottom: 15pt;
    font-size: 9pt;
    line-height: 1.3;
    page-break-inside: avoid;
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  .article-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
  }

  /* 表格打印样式 */
  .article-content table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 15pt;
    page-break-inside: avoid;
  }

  .article-content th,
  .article-content td {
    border: 1px solid #000;
    padding: 8pt;
    text-align: left;
  }

  .article-content th {
    background: #f0f0f0;
    font-weight: bold;
  }

  /* 图片打印样式 */
  .article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0;
    margin: 15pt 0;
    page-break-inside: avoid;
    page-break-before: auto;
    page-break-after: auto;
  }

  /* 分割线打印样式 */
  .article-content hr {
    border: none;
    border-top: 1px solid #000;
    margin: 20pt 0;
    page-break-inside: avoid;
  }

  /* 链接打印样式 */
  .article-content a {
    color: #000;
    text-decoration: underline;
  }

  .article-content a::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
  }

  .article-content a[href^="#"]::after {
    content: "";
  }

  
  /* 首页打印样式 - 隐藏不必要内容 */
  .articles-grid,
  .article-card,
  .read-more {
    display: none !important;
  }

  /* 错误页面打印样式 */
  .error-page {
    background: #fff;
    border: none;
    border-radius: 0;
    padding: 0;
    text-align: left;
    box-shadow: none;
    max-width: 100%;
    margin: 0;
  }

  .error-page h2 {
    color: #000;
    margin-bottom: 15pt;
    font-size: 16pt;
  }

  .error-page p {
    color: #000;
    margin-bottom: 20pt;
    font-size: 12pt;
  }

  /* 打印分页控制 */
  .print-page-break {
    page-break-before: always;
  }

  .no-print-break {
    page-break-inside: avoid;
  }

  /* @page 规则设置页边距 */
  @page {
    margin: 2cm;
    size: A4;
  }

  @page :first {
    margin-top: 1.5cm;
  }

  @page :left {
    margin-left: 2cm;
    margin-right: 1.5cm;
  }

  @page :right {
    margin-left: 1.5cm;
    margin-right: 2cm;
  }

  /* 隐藏代码高亮库的样式 */
  .hljs {
    background: #f5f5f5 !important;
    color: #000 !important;
    padding: 10pt !important;
    border-radius: 2pt !important;
    border: 1px solid #ddd !important;
  }
}