/*
 * 云码小栈AI文章助手 - 前台代码块样式
 *
 * 安全边界说明：
 *   1. PHP 侧 is_single() 判断，CSS 只在单篇文章页加载，不影响其他页面
 *   2. 所有规则均以 body.single 作为父级限定，不会溢出到侧边栏/页眉/页脚
 *   3. !important 仅用于背景色和字色，避免与主题字体/布局设置冲突
 *   4. 只选取公认的"文章正文"容器 class，不使用 .site-content 等宽泛选择器
 */

/* ── 适用环境声明框 ──────────────────────────────── */
.yunma-env-notice {
    background: #fff8e1;
    border-left: 4px solid #f9a825;
    border-radius: 0 4px 4px 0;
    padding: 10px 16px;
    margin: 0 0 1.5em 0;
    font-size: 14px;
    line-height: 1.7;
    color: #5d4037;
}
.yunma-env-notice strong {
    color: #e65100;
}
/* 纯 CSS 图标，避免 Linux 下 emoji 显示为 ? */
.yunma-env-notice .yunma-env-icon::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    background: #f9a825;
    border-radius: 2px;
    margin-right: 8px;
    vertical-align: middle;
}

/* ── 代码块 wrapper（由 JS 动态插入） ────────────── */
.yunma-code-wrapper {
    position: relative;
    margin: 1.2em 0;
}

/* ── pre 深色样式 ────────────────────────────────
 * 覆盖范围（均加 body.single 父级限定）：
 *   .entry-content   → WordPress 官方主题 / 绝大多数主题
 *   .post-content    → Astra、OceanWP、GeneratePress
 *   .article-content → 星河 Meteor / Ripple 等国产主题
 *   .single-content  → 部分独立主题
 *   .post-body       → Newspaper、MagPlus
 *   .content-body    → Soledad、ColorMag
 *   .the-content     → Flatsome 等
 *   .article-body    → 部分自定义主题
 *   .content-inner   → 部分自定义主题
 *   .post-detail     → 部分中文主题
 *   .article-detail  → 部分中文主题
 * ──────────────────────────────────────────────── */
body.single .entry-content   pre,
body.single .post-content    pre,
body.single .article-content pre,
body.single .single-content  pre,
body.single .post-body       pre,
body.single .content-body    pre,
body.single .the-content     pre,
body.single .article-body    pre,
body.single .content-inner   pre,
body.single .post-detail     pre,
body.single .article-detail  pre,
body.single .yunma-code-wrapper pre {
    background: #1e1e2e !important;   /* 只强制覆盖背景色 */
    color: #cdd6f4 !important;         /* 只强制覆盖字色 */
    border: 1px solid #313244;
    border-radius: 6px;
    padding: 40px 18px 16px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13.5px;
    line-height: 1.7;
    margin: 0;
}

/* pre > code：重置为透明，让 pre 的颜色透传 */
body.single .entry-content   pre code,
body.single .post-content    pre code,
body.single .article-content pre code,
body.single .single-content  pre code,
body.single .post-body       pre code,
body.single .content-body    pre code,
body.single .the-content     pre code,
body.single .article-body    pre code,
body.single .content-inner   pre code,
body.single .post-detail     pre code,
body.single .article-detail  pre code,
body.single .yunma-code-wrapper pre code {
    background: transparent !important;
    color: inherit !important;
    padding: 0;
    font-size: inherit;
    border: none;
    white-space: pre;
}

/* ── 语言标签 ──────────────────────────────────── */
.yunma-code-lang {
    position: absolute;
    top: 0;
    left: 0;
    background: #313244;
    color: #cba6f7;
    font-size: 11px;
    font-family: 'Consolas', monospace;
    padding: 3px 10px;
    border-top-left-radius: 6px;
    border-bottom-right-radius: 6px;
    user-select: none;
    letter-spacing: .5px;
    pointer-events: none;
}

/* ── 复制按钮 ──────────────────────────────────── */
.yunma-copy-btn {
    position: absolute;
    top: 6px;
    right: 10px;
    background: #45475a;
    color: #cdd6f4;
    border: 1px solid #585b70;
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s, color .15s;
    line-height: 1.6;
    user-select: none;
}
.yunma-copy-btn:hover  { background: #585b70; color: #fff; }
.yunma-copy-btn.copied { background: #a6e3a1; color: #1e1e2e; border-color: #a6e3a1; }

/* ── 行内 code（不影响 pre 内的 code）────────────
 * 同样加 body.single 父级限定
 * ──────────────────────────────────────────────── */
body.single .entry-content   code:not(pre code),
body.single .post-content    code:not(pre code),
body.single .article-content code:not(pre code),
body.single .single-content  code:not(pre code),
body.single .post-body       code:not(pre code),
body.single .content-body    code:not(pre code),
body.single .the-content     code:not(pre code),
body.single .article-body    code:not(pre code),
body.single .content-inner   code:not(pre code),
body.single .post-detail     code:not(pre code),
body.single .article-detail  code:not(pre code) {
    background: #313244 !important;
    color: #f38ba8 !important;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 13px;
    font-family: 'Consolas', monospace;
}
