/* 代码块容器 */
.code-block-container {
  margin: 1.5rem 0;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  background-color: #f5f7fa;
  border: 1px solid rgba(0,0,0,0.1);
  font-size: 0.9rem;
}

[data-theme="dark"] .code-block-container {
  background-color: #282a36;
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* 标题栏 */
.code-block-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: #e2e8f0;
  border-bottom: 1px solid #cbd5e0;
  font-family: 'JetBrains Mono', Menlo, Monaco, Consolas, 'Courier New', monospace;
  font-size: 0.85rem;
}

[data-theme="dark"] .code-block-title {
  background-color: #343746;
  border-bottom: 1px solid #44475a;
  color: #f8f8f2;
}

/* 标题栏左侧 */
.code-title-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* 标题栏右侧 */
.code-title-right {
  display: flex;
  align-items: center;
}

/* 语言标识 */
.code-language {
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4a5568;
}

[data-theme="dark"] .code-language {
  color: #bd93f9;
}

/* 文件名 */
.code-filename {
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: #4a5568;
  font-weight: normal;
}

[data-theme="dark"] .code-filename {
  color: #f1fa8c;
}

/* 复制按钮 */
.copy-button {
  background: transparent;
  border: 1px solid #a0aec0;
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: #4a5568;
}

.copy-button:hover {
  background: #edf2f7;
  color: #2d3748;
}

[data-theme="dark"] .copy-button {
  border-color: #44475a;
  color: #f8f8f2;
}

[data-theme="dark"] .copy-button:hover {
  background: #44475a;
}

/* 代码内容区 */
.code-block-content {
  padding: 1rem;
  overflow: auto;
}

.code-block-content pre {
  margin: 0;
  padding: 0;
  background: transparent;
  overflow: visible;
  font-family: 'JetBrains Mono', Menlo, Monaco, Consolas, 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

.code-block-content code {
  background: transparent;
  padding: 0;
  font-family: inherit;
  color: inherit;
  border-radius: 0;
}

/* ----------------------- */
/* 终端样式 */
/* ----------------------- */

.terminal-container {
  background-color: #f8fafc;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid #adc2ff;
  box-shadow: 0 8px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  position: relative;
}


[data-theme="dark"] .terminal-container {
  background-color: #1a1e2a;
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .terminal-container::before {
  display: none;
}

/* 终端标题栏 */
.terminal-container .code-block-title {
  background-color: #f1f5f9;
  border-bottom: 1px solid #adc2ff;
  padding: 0.4rem 1rem;
  color: #334155;
  font-weight: 500;
}

[data-theme="dark"] .terminal-container .code-block-title {
  background-color: #111827;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  color: #f8fafc;
}

/* 终端控制按钮 */
.terminal-controls {
  display: flex;
  gap: 6px;
  margin-right: 10px;
}

.terminal-control {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.terminal-close {
  background-color: #f87171;
}

.terminal-minimize {
  background-color: #fbbf24;
}

.terminal-maximize {
  background-color: #34d399;
}

/* 终端内容区 */
.terminal-container .code-block-content {
  background-color: #f8fafc;
  color: #334155;
  padding: 1rem;
}

[data-theme="dark"] .terminal-container .code-block-content {
  background-color: #1a1e2a;
  color: #f1f5f9;
}

.terminal-pre {
  color: #334155;
}

[data-theme="dark"] .terminal-pre {
  color: #f1f5f9;
}

/* 语言标签在终端样式中的颜色 */
.terminal-container .code-language {
  color: #64748b;
  font-weight: 500;
}

[data-theme="dark"] .terminal-container .code-language {
  color: #a0aec0;
}

/* 终端中的复制按钮 */
.terminal-container .copy-button {
  border-color: #adc2ff;
  color: #4a5568;
  transition: all 0.2s ease;
}

.terminal-container .copy-button:hover {
  background: #ebf0ff;
  color: #4b6bff;
  border-color: #4b6bff;
}

[data-theme="dark"] .terminal-container .copy-button {
  border-color: rgba(255,255,255,0.3);
  color: #e2e8f0;
}

[data-theme="dark"] .terminal-container .copy-button:hover {
  background: rgba(255,255,255,0.15);
  color: #ffffff;
}

/* ----------------------- */
/* Mermaid 图表样式 */
/* ----------------------- */

.mermaid-figure {
  margin: 2rem auto;
  text-align: center;
  max-width: 100%;
  display: flex;
  justify-content: center;
}

.mermaid-figure img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 亮色主题图表 */
.light-theme-diagram {
  display: block;
}

[data-theme="dark"] .light-theme-diagram {
  display: none;
}

/* 暗色主题图表 */
.dark-theme-diagram {
  display: none;
}

[data-theme="dark"] .dark-theme-diagram {
  display: block;
}

/* Mermaid 错误样式 */
.mermaid-error {
  border: 1px solid #e53e3e;
  background-color: #fff5f5;
  padding: 1rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}

[data-theme="dark"] .mermaid-error {
  background-color: #3b1a1a;
  border-color: #fc8181;
}

.mermaid-error-message {
  color: #c53030;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

[data-theme="dark"] .mermaid-error-message {
  color: #fc8181;
}

/* ----------------------- */
/* Highlight.js 主题样式 */
/* ----------------------- */

/* 基本颜色方案 - 亮色 */
.hljs {
  color: #1a202c;
  background: transparent;
}

[data-theme="dark"] .hljs {
  color: #f8f8f2;
  background: transparent;
}

/* 注释 */
.hljs-comment,
.hljs-quote {
  color: #718096;
  font-style: italic;
}

[data-theme="dark"] .hljs-comment,
[data-theme="dark"] .hljs-quote {
  color: #6272a4;
}

/* 关键字 */
.hljs-keyword,
.hljs-selector-tag,
.hljs-addition {
  color: #805ad5;
}

[data-theme="dark"] .hljs-keyword,
[data-theme="dark"] .hljs-selector-tag,
[data-theme="dark"] .hljs-addition {
  color: #ff79c6;
}

/* 变量名和属性 */
.hljs-variable,
.hljs-template-variable,
.hljs-literal,
.hljs-attr,
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-meta {
  color: #dd6b20;
}

[data-theme="dark"] .hljs-variable,
[data-theme="dark"] .hljs-template-variable,
[data-theme="dark"] .hljs-literal,
[data-theme="dark"] .hljs-attr,
[data-theme="dark"] .hljs-selector-attr,
[data-theme="dark"] .hljs-selector-pseudo,
[data-theme="dark"] .hljs-meta {
  color: #f1fa8c;
}

/* 函数名 */
.hljs-title,
.hljs-function .hljs-title,
.hljs-section {
  color: #3182ce;
}

[data-theme="dark"] .hljs-title,
[data-theme="dark"] .hljs-function .hljs-title,
[data-theme="dark"] .hljs-section {
  color: #50fa7b;
}

/* 类名和ID */
.hljs-title.class_,
.hljs-type,
.hljs-class .hljs-title,
.hljs-selector-id,
.hljs-selector-class {
  color: #d53f8c;
}

[data-theme="dark"] .hljs-title.class_,
[data-theme="dark"] .hljs-type,
[data-theme="dark"] .hljs-class .hljs-title,
[data-theme="dark"] .hljs-selector-id,
[data-theme="dark"] .hljs-selector-class {
  color: #8be9fd;
}

/* 字符串 */
.hljs-string,
.hljs-regexp,
.hljs-attribute,
.hljs-doctag {
  color: #38a169;
}

[data-theme="dark"] .hljs-string,
[data-theme="dark"] .hljs-regexp,
[data-theme="dark"] .hljs-attribute,
[data-theme="dark"] .hljs-doctag {
  color: #f1fa8c;
}

/* 数字 */
.hljs-number,
.hljs-deletion,
.hljs-symbol,
.hljs-bullet,
.hljs-link,
.hljs-formula {
  color: #e53e3e;
}

[data-theme="dark"] .hljs-number,
[data-theme="dark"] .hljs-deletion,
[data-theme="dark"] .hljs-symbol,
[data-theme="dark"] .hljs-bullet,
[data-theme="dark"] .hljs-link,
[data-theme="dark"] .hljs-formula {
  color: #bd93f9;
}

/* HTML标签 */
.hljs-tag,
.hljs-name,
.hljs-selector-tag {
  color: #2b6cb0;
}

[data-theme="dark"] .hljs-tag,
[data-theme="dark"] .hljs-name,
[data-theme="dark"] .hljs-selector-tag {
  color: #ff79c6;
}

/* 内置对象 */
.hljs-built_in {
  color: #c05621;
}

[data-theme="dark"] .hljs-built_in {
  color: #8be9fd;
}

/* 高亮代码行 */
.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: bold;
}

/* 终端命令特殊着色 */
.terminal-container .hljs-built_in,
.terminal-container .hljs-keyword {
  color: #4b6bff;
  font-weight: 500;
}

[data-theme="dark"] .terminal-container .hljs-built_in,
[data-theme="dark"] .terminal-container .hljs-keyword {
  color: #9ae6b4;
}

/* 终端中的字符串 */
.terminal-container .hljs-string {
  color: #ea580c;
}

[data-theme="dark"] .terminal-container .hljs-string {
  color: #fbd38d;
}

/* 终端中的变量 */
.terminal-container .hljs-variable {
  color: #8b5cf6;
}

[data-theme="dark"] .terminal-container .hljs-variable {
  color: #b794f4;
}

/* 终端中的参数 */
.terminal-container .hljs-params {
  color: #475569;
}

[data-theme="dark"] .terminal-container .hljs-params {
  color: #cbd5e0;
}

/* 终端中的注释 */
.terminal-container .hljs-comment {
  color: #64748b;
  font-style: italic;
}

[data-theme="dark"] .terminal-container .hljs-comment {
  color: #a0aec0;
}

/* 滚动条样式 */
.code-block-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.code-block-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.code-block-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.code-block-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .code-block-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .code-block-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .code-block-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
} 