/**
 * 代码高亮样式 - GitHub 主题
 */

/* 代码块容器 */
.xwme-code-block {
    margin: 1.5em 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
}

.dark .xwme-code-block,
[data-theme="dark"] .xwme-code-block {
    background: #161b22;
    border-color: #30363d;
}

/* Pre 标签 */
.xwme-pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 14px;
    line-height: 1.6;
    background: transparent;
    white-space: pre;
    word-wrap: normal;
    tab-size: 4;
}

/* Code 标签 */
.xwme-pre code {
    display: block;
    padding: 0;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: #24292e;
}

.dark .xwme-pre code,
[data-theme="dark"] .xwme-pre code {
    color: #c9d1d9;
}

/* 语言标签 */
.xwme-pre::before {
    content: attr(data-language);
    display: block;
    padding: 8px 16px;
    margin: -16px -16px 12px -16px;
    background: #e1e4e8;
    color: #586069;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dark .xwme-pre::before,
[data-theme="dark"] .xwme-pre::before {
    background: #21262d;
    color: #8b949e;
}

.xwme-pre[data-language=""]::before {
    display: none;
}

/* 行号 */
.xwme-pre.line-numbers {
    padding-left: 56px;
    counter-reset: line;
}

.xwme-pre.line-numbers code {
    position: relative;
}

.xwme-pre.line-numbers code::before {
    counter-increment: line;
    content: counter(line);
    position: absolute;
    left: -40px;
    width: 24px;
    text-align: right;
    color: #959da5;
    font-size: 12px;
}

/* 语法高亮 - 亮色主题 */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #6a737d;
}

.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;
}

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

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

/* 暗色主题 */
.dark .token.comment,
.dark .token.prolog,
.dark .token.doctype,
.dark .token.cdata,
[data-theme="dark"] .token.comment,
[data-theme="dark"] .token.prolog,
[data-theme="dark"] .token.doctype,
[data-theme="dark"] .token.cdata {
    color: #8b949e;
}

.dark .token.punctuation,
[data-theme="dark"] .token.punctuation {
    color: #c9d1d9;
}

.dark .token.property,
.dark .token.tag,
.dark .token.boolean,
.dark .token.number,
.dark .token.constant,
.dark .token.symbol,
.dark .token.deleted,
[data-theme="dark"] .token.property,
[data-theme="dark"] .token.tag,
[data-theme="dark"] .token.boolean,
[data-theme="dark"] .token.number,
[data-theme="dark"] .token.constant,
[data-theme="dark"] .token.symbol,
[data-theme="dark"] .token.deleted {
    color: #79c0ff;
}

.dark .token.selector,
.dark .token.attr-name,
.dark .token.string,
.dark .token.char,
.dark .token.builtin,
.dark .token.inserted,
[data-theme="dark"] .token.selector,
[data-theme="dark"] .token.attr-name,
[data-theme="dark"] .token.string,
[data-theme="dark"] .token.char,
[data-theme="dark"] .token.builtin,
[data-theme="dark"] .token.inserted {
    color: #a5d6ff;
}

.dark .token.operator,
.dark .token.entity,
.dark .token.url,
.dark .language-css .token.string,
.dark .style .token.string,
[data-theme="dark"] .token.operator,
[data-theme="dark"] .token.entity,
[data-theme="dark"] .token.url,
[data-theme="dark"] .language-css .token.string,
[data-theme="dark"] .style .token.string {
    color: #ff7b72;
}

.dark .token.atrule,
.dark .token.attr-value,
.dark .token.keyword,
[data-theme="dark"] .token.atrule,
[data-theme="dark"] .token.attr-value,
[data-theme="dark"] .token.keyword {
    color: #ff7b72;
}

.dark .token.function,
.dark .token.class-name,
[data-theme="dark"] .token.function,
[data-theme="dark"] .token.class-name {
    color: #d2a8ff;
}

.dark .token.regex,
.dark .token.important,
.dark .token.variable,
[data-theme="dark"] .token.regex,
[data-theme="dark"] .token.important,
[data-theme="dark"] .token.variable {
    color: #ffa657;
}

/* 复制按钮 */
.xwme-code-block {
    position: relative;
}

.xwme-code-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    color: #57606a;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
}

.xwme-code-block:hover .xwme-code-copy {
    opacity: 1;
}

.xwme-code-copy:hover {
    background: #f3f4f6;
    border-color: #bbb;
}

.xwme-code-copy.copied {
    background: #dafbe1;
    border-color: #54da5d;
    color: #1a7f37;
}

.dark .xwme-code-copy,
[data-theme="dark"] .xwme-code-copy {
    background: #21262d;
    border-color: #30363d;
    color: #c9d1d9;
}

.dark .xwme-code-copy:hover,
[data-theme="dark"] .xwme-code-copy:hover {
    background: #30363d;
}

/* 滚动条美化 */
.xwme-pre::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.xwme-pre::-webkit-scrollbar-track {
    background: transparent;
}

.xwme-pre::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.xwme-pre::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.dark .xwme-pre::-webkit-scrollbar-thumb,
[data-theme="dark"] .xwme-pre::-webkit-scrollbar-thumb {
    background: #484f58;
}

.dark .xwme-pre::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .xwme-pre::-webkit-scrollbar-thumb:hover {
    background: #6e7681;
}
