/**
 * 自定义蓝黑色系 Prism.js 代码高亮主题
 * 基于 Prism.js default theme，配色以蓝黑色系为主
 * 美观且有区分度
 * 
 * 注意：此文件必须在 blog_basic.css 之后加载，以确保样式优先级
 */

/* 使用更高的优先级确保覆盖默认prism.css样式 */
code[class*="language-"],
pre[class*="language-"] {
	color: #333 !important; /* 深色文字，在白色背景上清晰可见 */
	background: none !important;
	text-shadow: none !important;
	font-family: 'Consolas', 'Monaco', 'Andale Mono', 'Ubuntu Mono', monospace;
	font-size: 1em;
	text-align: left;
	white-space: pre;
	word-spacing: normal;
	word-break: normal;
	word-wrap: normal;
	line-height: 1.6;

	-moz-tab-size: 4;
	-o-tab-size: 4;
	tab-size: 4;

	-webkit-hyphens: none;
	-moz-hyphens: none;
	-ms-hyphens: none;
	hyphens: none;
}

pre[class*="language-"]::-moz-selection, 
pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection, 
code[class*="language-"] ::-moz-selection {
	text-shadow: none;
	background: rgba(100, 150, 255, 0.3); /* 蓝色选中背景 */
}

pre[class*="language-"]::selection, 
pre[class*="language-"] ::selection,
code[class*="language-"]::selection, 
code[class*="language-"] ::selection {
	text-shadow: none;
	background: rgba(100, 150, 255, 0.3); /* 蓝色选中背景 */
}

@media print {
	code[class*="language-"],
	pre[class*="language-"] {
		text-shadow: none;
	}
}

/* Code blocks - 标准 Prism 格式 */
pre[class*="language-"] {
	padding: 1.2em !important;
	margin: .8em 0 !important;
	overflow: auto !important;
	background: rgba(255, 255, 255, 0.6) !important;
	border-radius: 6px !important;
	border: 1px solid rgba(0, 0, 0, 0.12) !important; /* 简单边框 */
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
	position: relative !important;
}

/* Code blocks - hexo-prism-plugin 格式 (figure.highlight) */
figure.highlight {
	position: relative !important;
	margin: .8em 0 !important;
	border-radius: 6px !important;
	overflow: hidden !important;
	background: rgba(255, 255, 255, 0.6) !important;
	border: 1px solid rgba(0, 0, 0, 0.12) !important; /* 简单边框 */
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
	line-height: 1.6 !important;
	overflow-x: auto !important;
}

figure.highlight table {
	margin: 0;
	border: none;
	background: transparent;
}

figure.highlight pre {
	margin: 0;
	padding: 1.2em;
	background: transparent !important;
	border: none;
	color: #24292e !important; /* 变量名颜色 - 深灰色 */
}

/* 确保代码行中的所有文本默认使用变量名颜色 */
figure.highlight .code pre span.line {
	color: #24292e !important; /* 变量名颜色 - 仅作为后备 */
}

/* 移除 inherit，让特定class的颜色生效 */
figure.highlight .code pre span.line > * {
	/* 不设置 color，让各个class的颜色规则生效 */
}

figure.highlight .gutter {
	background: rgba(0, 0, 0, 0.05) !important;
	border-right: 1px solid rgba(0, 0, 0, 0.1);
}

figure.highlight .code {
	background: transparent !important;
}

/* 语言标签样式 - 右上角小圆角矩形（缩小版） */
pre[class*="language-"]::before,
figure.highlight::before {
	content: attr(data-language);
	position: absolute;
	top: 0.4em;
	right: 0.6em;
	padding: 0.15em 0.4em;
	background: rgba(255, 255, 255, 0.6) !important; /* 白色半透明背景 */
	color: #666 !important; /* 深灰色文字，适配日间夜间模式 */
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 3px;
	font-size: 0.65em;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.3px;
	z-index: 10;
	pointer-events: none;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	line-height: 1.2;
}

:not(pre) > code[class*="language-"],
pre[class*="language-"] {
	background: rgba(255, 255, 255, 0.6) !important; /* 白色半透明背景 */
}

/* Inline code */
:not(pre) > code[class*="language-"] {
	padding: .2em .4em;
	border-radius: .3em;
	white-space: normal;
	background: rgba(255, 255, 255, 0.6) !important; /* 白色半透明背景 */
	color: #333 !important; /* 深色文字 */
	border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* 注释 */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata,
figure.highlight .comment,
figure.highlight .comment *,
figure.highlight span.comment {
	color: #6a737d !important; /* 灰色注释，适配白色背景 */
	font-style: italic;
}

/* 标点符号 */
.token.punctuation,
figure.highlight .punctuation {
	color: #00a8a8 !important; /* 青色标点符号（重复度高） */
}

.token.namespace {
	opacity: .8;
	color: #268bd2;
}

/* 属性、标签、布尔值、数字、常量、符号、删除 */
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted,
figure.highlight .number,
figure.highlight .literal,
figure.highlight .constant,
figure.highlight span.number {
	color: #e36209 !important; /* 橙色数字和常量 */
}

/* 选择器、属性名、字符串、字符、内置函数、插入 */
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted,
figure.highlight .string,
figure.highlight .attr-value,
figure.highlight span.string {
	color: #0c178c !important; /* 深蓝色字符串 */
}

/* 运算符、实体、URL、CSS字符串 */
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
figure.highlight .operator {
	color: #00a8a8 !important; /* 青色运算符（重复度高） */
}

/* 规则、属性值、关键字 */
.token.atrule,
.token.attr-value,
.token.keyword,
figure.highlight .keyword,
figure.highlight .function .keyword,
figure.highlight span.keyword {
	color: #d73a49 !important; /* 红色关键字 */
	font-weight: 500;
}

/* 函数、类名 */
.token.function,
.token.class-name,
figure.highlight .function,
figure.highlight .title,
figure.highlight span.title,
figure.highlight span.title.function_ {
	color: #6f42c1 !important; /* 紫色函数名 */
}

/* 正则表达式、重要、变量 */
.token.regex,
.token.important,
.token.variable,
figure.highlight .regexp {
	color: #e36209 !important; /* 橙色正则表达式 */
}

/* hexo-prism-plugin 生成的特定类名 - 确保优先级最高 */
/* 使用更精确的选择器，确保覆盖所有情况 */
figure.highlight .code pre span.line span.keyword,
figure.highlight .code span.keyword,
figure.highlight span.keyword,
figure.highlight .code pre span.keyword {
	color: #d73a49 !important; /* 关键字红色 */
	font-weight: 500;
}

figure.highlight .code pre span.line span.title,
figure.highlight .code pre span.line span.title.function_,
figure.highlight .code span.title,
figure.highlight .code span.title.function_,
figure.highlight span.title,
figure.highlight span.title.function_ {
	color: #6f42c1 !important; /* 函数名紫色 */
}

figure.highlight .code pre span.line span.string,
figure.highlight .code span.string,
figure.highlight span.string {
	color: #0c178c !important; /* 字符串深蓝色 */
}

figure.highlight .code pre span.line span.number,
figure.highlight .code span.number,
figure.highlight span.number {
	color: #e36209 !important; /* 橙色数字 */
}

figure.highlight .code pre span.line span.built_in,
figure.highlight .code span.built_in,
figure.highlight span.built_in {
	color: #005cc5 !important; /* 内置函数蓝色 */
}

figure.highlight .code pre span.line span.params,
figure.highlight .code span.params,
figure.highlight span.params {
	color: #355 !important; /* 参数青色 */
}

figure.highlight .code pre span.line span.meta,
figure.highlight .code span.meta,
figure.highlight span.meta {
	color: #6a737d !important; /* 预处理指令灰色 */
}

/* C++/C 类型关键字（int, char, float, double, void等） */
figure.highlight .code pre span.line span.type,
figure.highlight .code span.type,
figure.highlight span.type,
figure.highlight.highlight-cpp .code pre span.line span.type,
figure.highlight.highlight-cpp .code span.type,
figure.highlight.highlight-c .code pre span.line span.type,
figure.highlight.highlight-c .code span.type {
	color: #005cc5 !important; /* 蓝色类型关键字 */
	font-weight: 500;
}

/* C++标准库类型和命名空间（vector, unordered_map, std等） */
/* 通过JavaScript动态添加class后，使用这些规则着色 */
figure.highlight.highlight-cpp .code pre span.line span.std-type,
figure.highlight.highlight-cpp .code span.std-type,
figure.highlight.cpp .code pre span.line span.std-type,
figure.highlight.cpp .code span.std-type {
	color: #005cc5 !important; /* 标准库类型蓝色 */
	font-weight: 500;
}

figure.highlight.highlight-cpp .code pre span.line span.std-namespace,
figure.highlight.highlight-cpp .code span.std-namespace,
figure.highlight.cpp .code pre span.line span.std-namespace,
figure.highlight.cpp .code span.std-namespace {
	color: #005cc5 !important; /* std命名空间蓝色 */
	font-weight: 500;
}

/* 变量名 - 确保所有没有特定class的文本都显示为变量名颜色 */
figure.highlight .code pre span.line > span:not([class]),
figure.highlight .code pre span.line > span:not(.keyword):not(.string):not(.number):not(.title):not(.built_in):not(.params):not(.meta):not(.type):not(.function):not(.comment):not(.operator):not(.punctuation):not(.regexp):not(.attr-value):not(.std-type):not(.std-namespace) {
	color: #24292ee0 !important; /* 变量名深灰色 */
}

figure.highlight .code pre span.line span.function,
figure.highlight .code span.function,
figure.highlight span.function {
	color: #6f42c1 !important; /* 函数紫色 */
}

/* 变量名和普通标识符 - 确保没有特定类的文本显示为变量名 */
figure.highlight .code pre span.line {
	color: #24292ee0 !important; /* 默认文字颜色（变量名） */
}

/* 匹配没有class的span（通常是变量名） */
figure.highlight .code pre span.line > span:not([class]) {
	color: #24292ee0 !important; /* 变量名深灰色 */
}

/* 确保代码行中的文本默认颜色 */
figure.highlight .code pre span.line > *:not(.keyword):not(.string):not(.number):not(.title):not(.built_in):not(.params):not(.meta):not(.type):not(.function):not(.comment):not(.operator):not(.punctuation):not(.regexp):not(.attr-value):not([class*="token"]) {
	color: #24292ee0 !important; /* 变量名深灰色 */
}

.token.important,
.token.bold {
	font-weight: bold;
}

.token.italic {
	font-style: italic;
}

.token.entity {
	cursor: help;
}

/* 行号样式（如果启用） */
.line-numbers .line-numbers-rows {
	border-right: 1px solid #3a4a5a; /* 深蓝灰色边框 */
	color: #5a6b7c; /* 灰蓝色行号 */
}

.line-numbers-rows > span {
	color: #5a6b7c;
}

/* 代码块标题栏（如果有） */
pre[class*="language-"]::before {
	color: #9db4c8;
}

/* 针对特定语言的额外样式 - 确保所有语言都使用统一的配色 */
.language-cpp .token.keyword,
figure.highlight.highlight-cpp .code span.keyword {
	color: #d73a49 !important; /* C++关键字红色 */
}

.language-python .token.keyword,
figure.highlight.highlight-python .code span.keyword {
	color: #d73a49 !important; /* Python关键字红色 */
}

.language-javascript .token.keyword,
figure.highlight.highlight-javascript .code span.keyword,
figure.highlight.highlight-js .code span.keyword {
	color: #d73a49 !important; /* JavaScript关键字红色 */
}

/* 其他语言的关键字 */
figure.highlight.highlight-java .code span.keyword,
figure.highlight.highlight-go .code span.keyword,
figure.highlight.highlight-rust .code span.keyword,
figure.highlight.highlight-php .code span.keyword,
figure.highlight.highlight-ruby .code span.keyword,
figure.highlight.highlight-swift .code span.keyword,
figure.highlight.highlight-kotlin .code span.keyword,
figure.highlight.highlight-scala .code span.keyword {
	color: #d73a49 !important; /* 关键字统一红色 */
}

/* 代码块滚动条样式 - 适配白色背景 */
pre[class*="language-"]::-webkit-scrollbar,
figure.highlight::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

pre[class*="language-"]::-webkit-scrollbar-track,
figure.highlight::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.05);
	border-radius: 4px;
}

pre[class*="language-"]::-webkit-scrollbar-thumb,
figure.highlight::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.2);
	border-radius: 4px;
}

pre[class*="language-"]::-webkit-scrollbar-thumb:hover,
figure.highlight::-webkit-scrollbar-thumb:hover {
	background: rgba(0, 0, 0, 0.3);
}

