/* Clean Professional Theme - 简洁专业的程序员风格 */
:root {
  /* 简洁配色方案 */
  --primary-color: #0366d6;
  --primary-hover: #0256cc;
  --text-primary: #24292e;
  --text-secondary: #586069;
  --text-muted: #8b949e;
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-sidebar: #fafbfc;
  --border-color: #e1e4e8;
  --border-light: #f6f8fa;
  --code-bg: #f6f8fa;
  --code-text: #24292e;
  --sidebar-width: 240px;
}

/* 全局重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

/* 布局容器 */
#app {
  display: flex;
  min-height: 100vh;
}

/* 简洁侧边栏 */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  z-index: 1000;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

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

.sidebar::-webkit-scrollbar-thumb {
  background: #c1c7cd;
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: #959da5;
}

/* 侧边栏标题 */
.sidebar-title {
  padding: 12px 8px 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-sidebar);
  letter-spacing: 0.3px;
}

.sidebar ul {
  list-style: none;
  padding: 8px;
  margin: 0;
}

.sidebar li {
  margin-bottom: 2px;
}

/* 分类标题样式（非链接） */
.sidebar li > p,
.sidebar li > span {
  color: var(--text-primary);
  font-weight: 600;
  padding: 8px 12px;
  margin: 0;
  font-size: 14px;
  display: block;
}

.sidebar li a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  display: block;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.sidebar li a:hover {
  color: var(--primary-color);
  background-color: var(--bg-secondary);
}

.sidebar li a.active,
.sidebar li.active > a {
  color: var(--primary-color);
  background-color: #ddf4ff;
  font-weight: 600;
}

/* 子菜单 */
.sidebar li ul {
  padding-left: 16px;
  margin-top: 2px;
}

.sidebar li ul li a {
  font-size: 13px;
  color: var(--text-muted);
  padding: 6px 8px;
}

.sidebar li ul li a:hover {
  color: var(--primary-color);
  background-color: var(--bg-secondary);
}

.sidebar li ul li a.active,
.sidebar li ul li.active > a {
  color: var(--primary-color);
  background-color: #ddf4ff;
  font-weight: 600;
}

/* 主内容区域 */
.markdown-section {
  margin-left: var(--sidebar-width);
  padding: 24px 32px;
  max-width: 900px;
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  box-sizing: border-box;
}

/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 12px;
  margin-top: 20px;
}

h1 {
  font-size: 32px;
  color: var(--text-primary);
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 8px;
  margin-bottom: 24px;
  margin-top: 0;
  letter-spacing: -0.5px;
}

/* 文章主标题样式 - 新闻标题风格 */
.markdown-section h1:first-child {
  font-size: 36px;
  color: #000000;
  font-weight: 700;
  margin-bottom: 24px;
  margin-top: 0;
  letter-spacing: -0.5px;
  line-height: 1.2;
  padding: 40px 0 20px 0;
  text-align: center;
  background: linear-gradient(135deg,
    rgba(240, 240, 245, 0.9) 0%,
    rgba(250, 250, 252, 0.95) 50%,
    rgba(245, 245, 250, 0.9) 100%),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 200" preserveAspectRatio="none"><defs><linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" style="stop-color:%23f8f9fa;stop-opacity:1" /><stop offset="100%" style="stop-color:%23e9ecef;stop-opacity:1" /></linearGradient></defs><rect width="1200" height="200" fill="url(%23bg)"/><path d="M0,100 Q300,50 600,100 T1200,100 L1200,200 L0,200 Z" fill="%23dee2e6" opacity="0.3"/><path d="M0,150 Q300,100 600,150 T1200,150 L1200,200 L0,200 Z" fill="%23ced4da" opacity="0.2"/></svg>') no-repeat center center;
  background-size: cover, 100% 100%;
  border-bottom: 3px solid #dee2e6;
  position: relative;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 文章主标题悬停效果 */
.markdown-section h1:first-child:hover {
  background: linear-gradient(135deg,
    rgba(235, 235, 240, 0.95) 0%,
    rgba(245, 245, 252, 1.0) 50%,
    rgba(240, 240, 245, 0.95) 100%),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 200" preserveAspectRatio="none"><defs><linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" style="stop-color:%23f1f3f4;stop-opacity:1" /><stop offset="100%" style="stop-color:%23e8eaed;stop-opacity:1" /></linearGradient></defs><rect width="1200" height="200" fill="url(%23bg)"/><path d="M0,100 Q300,50 600,100 T1200,100 L1200,200 L0,200 Z" fill="%23dee2e6" opacity="0.4"/><path d="M0,150 Q300,100 600,150 T1200,150 L1200,200 L0,200 Z" fill="%23ced4da" opacity="0.3"/></svg>') no-repeat center center;
  background-size: cover, 100% 100%;
}

/* 文章主标题后的第一个H2标题样式 */
.markdown-section h1:first-child + h2 {
  margin-top: 32px;
}

/* 移除文章主标题的链接样式 */
.markdown-section h1:first-child a {
  color: #000000;
  text-decoration: none;
}

.markdown-section h1:first-child a:hover {
  color: #000000;
  text-decoration: none;
}

h2 {
  font-size: 24px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
  margin-top: 32px;
  font-weight: 600;
}

h3 {
  font-size: 20px;
  color: var(--text-primary);
  margin-top: 28px;
  font-weight: 600;
}

h4 {
  font-size: 18px;
  color: var(--text-primary);
  margin-top: 24px;
  font-weight: 600;
}

h5 {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 20px;
  font-weight: 500;
}

h6 {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 16px;
  font-weight: 500;
}

/* 段落 */
p {
  margin-bottom: 12px;
  color: var(--text-primary);
  line-height: 1.6;
}

/* 链接 */
a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* 代码块 */
code {
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
  background-color: #f6f8fa;
  color: #24292e;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 85%;
  border: 1px solid #e1e4e8;
  font-weight: 500;
}

pre {
  background-color: #f6f8fa;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 100%;
  color: #24292e;
}

/* 代码高亮 - GitHub风格 */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #6a737d;
  font-style: italic;
}

.token.punctuation {
  color: #24292e;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
  color: #005cc5;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #032f62;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: #d73a49;
}

.token.atrule,
.token.attr-value,
.token.keyword {
  color: #d73a49;
  font-weight: 600;
}

.token.function,
.token.class-name {
  color: #6f42c1;
}

.token.regex,
.token.important,
.token.variable {
  color: #e36209;
}

/* Python特定高亮 */
.language-python .token.keyword {
  color: #d73a49;
  font-weight: 600;
}

.language-python .token.function-name {
  color: #6f42c1;
}

.language-python .token.builtin {
  color: #005cc5;
}

/* Java特定高亮 */
.language-java .token.keyword {
  color: #d73a49;
  font-weight: 600;
}

.language-java .token.class-name {
  color: #6f42c1;
}

.language-java .token.annotation {
  color: #e36209;
}

/* JavaScript/TypeScript特定高亮 */
.language-javascript .token.keyword,
.language-typescript .token.keyword {
  color: #d73a49;
  font-weight: 600;
}

.language-javascript .token.function,
.language-typescript .token.function {
  color: #6f42c1;
}

/* JSON特定高亮 */
.language-json .token.property {
  color: #005cc5;
}

.language-json .token.string {
  color: #032f62;
}

.language-json .token.number {
  color: #005cc5;
}

/* YAML特定高亮 */
.language-yaml .token.key {
  color: #005cc5;
}

.language-yaml .token.string {
  color: #032f62;
}

.language-yaml .token.boolean {
  color: #005cc5;
}

/* SQL特定高亮 */
.language-sql .token.keyword {
  color: #d73a49;
  font-weight: 600;
}

.language-sql .token.function {
  color: #6f42c1;
}

/* HTML/XML特定高亮 */
.language-markup .token.tag {
  color: #22863a;
}

.language-markup .token.attr-name {
  color: #6f42c1;
}

.language-markup .token.attr-value {
  color: #032f62;
}

/* CSS特定高亮 */
.language-css .token.selector {
  color: #22863a;
}

.language-css .token.property {
  color: #005cc5;
}

.language-css .token.function {
  color: #6f42c1;
}

/* Vue特定高亮 */
.language-vue .token.tag {
  color: #22863a;
}

.language-vue .token.attr-name {
  color: #6f42c1;
}

.language-vue .token.attr-value {
  color: #032f62;
}

/* Bash/Shell特定高亮 */
.language-bash .token.builtin {
  color: #d73a49;
  font-weight: 600;
}

.language-bash .token.function {
  color: #6f42c1;
}

/* 代码块标题 */
pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  right: 0;
  background: #0366d6;
  color: white;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 0 8px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 10;
}

/* 右键菜单样式 */
.context-menu {
  position: fixed;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 4px 0;
  z-index: 1000;
  min-width: 160px;
  display: none;
}

.context-menu-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: background-color 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.context-menu-item:hover {
  background-color: var(--bg-secondary);
}

.context-menu-item-icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.context-menu-separator {
  height: 1px;
  background-color: var(--border-color);
  margin: 4px 0;
}

/* 行号样式 */
.line-numbers .line-numbers-rows {
  border-right: 1px solid #e1e4e8;
  padding-right: 8px;
  margin-right: 12px;
  color: #6a737d;
}

.line-numbers-rows > span:before {
  color: #6a737d;
}

/* 表格 */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

th, td {
  padding: 8px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
}

td {
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

/* 提示框 */
.tip, .warning, .danger {
  padding: 10px 12px;
  margin: 12px 0;
  border-left: 4px solid;
  border-radius: 0 6px 6px 0;
}

.tip {
  background-color: #f1f8ff;
  border-left-color: var(--primary-color);
  color: #0366d6;
}

.warning {
  background-color: #fff5b4;
  border-left-color: #d9a040;
  color: #6f4e00;
}

.danger {
  background-color: #ffeef0;
  border-left-color: #d73a49;
  color: #cb2431;
}

/* 分页导航 */
.pagination {
  display: flex;
  justify-content: space-between;
  margin: 24px 0;
  padding: 12px 0;
  border-top: 1px solid var(--border-color);
}

.pagination a {
  color: var(--primary-color);
  text-decoration: none;
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
}

.pagination a:hover {
  background-color: var(--bg-secondary);
  text-decoration: none;
}

/* 搜索框 */
.search input {
  width: calc(100% - 16px);
  margin: 0 8px 16px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
}

.search input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(3, 102, 214, 0.1);
}

.search .search-keyword {
  color: var(--primary-color);
  font-weight: 600;
}

/* 页脚 */
footer {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border-color);
  margin-top: 48px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .markdown-section {
    margin-left: 0;
    padding: 16px 20px;
    width: 100%;
  }
  
  h1 {
    font-size: 28px;
  }
  
  h2 {
    font-size: 22px;
  }
  
  h3 {
    font-size: 18px;
  }
}

/* 汉堡菜单按钮 */
.hamburger {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1001;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  display: none;
  color: var(--text-primary);
  font-size: 16px;
}

.hamburger:hover {
  background-color: var(--bg-secondary);
}

@media (max-width: 768px) {
  .hamburger {
    display: block;
  }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: #c1c7cd;
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: #959da5;
}

/* 选择文本样式 */
::selection {
  background-color: #cce7ff;
  color: var(--text-primary);
}

/* 焦点样式 */
:focus {
  outline: 1px solid var(--primary-color);
  outline-offset: 2px;
}

/* 列表样式 */
ul, ol {
  margin-bottom: 16px;
  padding-left: 32px;
}

li {
  margin-bottom: 4px;
  color: var(--text-primary);
}

/* 引用样式 */
blockquote {
  padding: 0 16px;
  margin: 16px 0;
  color: var(--text-secondary);
  border-left: 4px solid var(--border-color);
}

/* 分隔线 */
hr {
  height: 1px;
  border: none;
  background-color: var(--border-color);
  margin: 24px 0;
}

/* 图片样式 */
img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 16px 0;
}

/* 面包屑导航 */
.breadcrumb {
  padding: 12px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  color: var(--text-secondary);
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
}

.breadcrumb-item:not(:last-child)::after {
  content: '/';
  margin: 0 8px;
  color: var(--text-muted);
  font-weight: 400;
}

.breadcrumb-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
  font-weight: 500;
}

.breadcrumb-link:hover {
  color: var(--primary-color);
  text-decoration: none;
}

.breadcrumb-item.active .breadcrumb-link {
  color: var(--text-primary);
  font-weight: 600;
  cursor: default;
}

.breadcrumb-item.active .breadcrumb-link:hover {
  color: var(--text-primary);
}

/* 右侧目录抽屉 */
.toc {
  position: fixed;
  top: 0;
  right: -300px;
  width: 300px;
  height: 100vh;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  z-index: 999;
  transition: right 0.3s ease;
  padding: 20px;
}

.toc.open {
  right: 0;
}

.toc-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.toc-toggle:hover {
  background-color: var(--primary-hover);
  transform: scale(1.05);
}

.toc .toc-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

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

.toc li {
  margin-bottom: 4px;
}

.toc a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 4px;
  display: block;
  font-size: 14px;
  transition: all 0.15s ease;
}

.toc a:hover {
  color: var(--primary-color);
  background-color: var(--bg-secondary);
}

.toc a.active {
  color: var(--primary-color);
  background-color: #ddf4ff;
  font-weight: 600;
}

.toc .toc-level-2 {
  padding-left: 16px;
}

.toc .toc-level-3 {
  padding-left: 32px;
}

.toc .toc-level-4 {
  padding-left: 48px;
}

.toc .toc-level-5 {
  padding-left: 64px;
}

.toc .toc-level-6 {
  padding-left: 80px;
}

/* 响应式设计 - 移动端隐藏目录抽屉 */
@media (max-width: 768px) {
  .toc {
    width: 280px;
    right: -280px;
  }
  
  .toc-toggle {
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}

/* 锚点高亮效果 */
.highlighted {
  background-color: #fff3cd;
  border-left: 4px solid #ffc107;
  padding-left: 8px;
  animation: highlightFade 2s ease-in-out;
}

@keyframes highlightFade {
  0% {
    background-color: #fff3cd;
    border-left-color: #ffc107;
  }
  100% {
    background-color: transparent;
    border-left-color: transparent;
  }
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 增强锚点目标可见性 */
h1[id], h2[id], h3[id], h4[id], h5[id], h6[id] {
  scroll-margin-top: 20px;
}

/* 滚动按钮样式 */
.scroll-buttons {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.scroll-button {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background-color: var(--primary-color);
  color: white;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  opacity: 0.8;
}

.scroll-button:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  opacity: 1;
}

.scroll-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.scroll-button span {
  line-height: 1;
  display: block;
}

/* 响应式设计 - 移动端滚动按钮 */
@media (max-width: 768px) {
  .scroll-buttons {
    bottom: 20px;
    right: 20px;
  }
  
  .scroll-button {
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
}

/* 滚动按钮动画效果 */
@keyframes bounceIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
}

.scroll-button {
  animation: bounceIn 0.5s ease-out;
}