/* 公众号排版工具专属样式 */

:root {
    --primary-color: #07c160;
    /* 默认微信绿 */
    --accent-color: #ff502c;
    /* 强调色 */
}

/* 自定义滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    background-color: transparent;
}

::-webkit-scrollbar-track {
    background-color: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    transition: background-color 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

/* 主题色定义 */
.theme-green {
    --primary-color: #07c160;
}

.theme-blue {
    --primary-color: #1e88e5;
}

.theme-purple {
    --primary-color: #7b1fa2;
}

.theme-orange {
    --primary-color: #f57c00;
}

.bg-purple {
    background-color: #7b1fa2;
}

.theme-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

body.editor-body {
    padding: 0;
    margin: 0;
    background: #f8f9fa;
    /* 锁定页面高度，禁止整体滚动 */
    height: 100vh;
    overflow: hidden;
    /* 使用 Flex 垂直布局 */
    display: flex;
    flex-direction: column;
}

.editor-container {
    display: flex;
    flex-direction: column;
    /* height: calc(100vh - 56px); */
    /* 自动填充剩余空间 */
    flex: 1;
    overflow: hidden;
}

/* 工具栏 */
.editor-toolbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

.toolbar-brand {
    font-weight: 600;
    font-size: 1.1rem;
    color: #1a1a1a;
}

.toolbar-brand i {
    color: var(--primary-color);
    margin-right: 6px;
    transition: color 0.3s;
}

/* 主区域 */
.editor-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.editor-section {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    position: relative;
    /* 防止内部滚动触发外部滚动 */
    overscroll-behavior: contain;
}

/* 编辑区 */
.source-section {
    background: #fff;
    padding: 0;
}

#mdInput {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    padding: 40px;
    font-size: 16px;
    line-height: 1.6;
    color: #2c3e50;
    resize: none;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

/* 分割线 */
.editor-resizer {
    width: 6px;
    background: #f1f3f5;
    cursor: col-resize;
    transition: background 0.2s;
}

.editor-resizer:hover {
    background: #e9ecef;
}

/* 预览区 */
.preview-section {
    background: #f0f2f5;
    padding: 40px 0;
}

.output-container {
    width: 450px;
    /* 模拟公众号宽度 */
    margin: 0 auto;
    background: #fff;
    min-height: 100%;
    padding: 20px 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ========== 公众号正文样式重置 (支持主题色) ========== */
.wechat-style {
    /* 默认值 */
    --wechat-font-family: -apple-system-font, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
    --wechat-font-size: 16px;

    /* Mac 窗口默认变量 (深色) */
    --mac-bg: #21252b;
    --mac-header-bg: #21252b;
    --mac-border: none;
    --mac-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    --mac-text-color: #abb2bf;

    font-family: var(--wechat-font-family);
    font-size: var(--wechat-font-size);
    line-height: 1.75;
    color: #333;
    word-wrap: break-word;
}

/* ... existing styles ... */

/* Mac 风格代码块 */
.mac-code-block {
    margin: 1.5em 0;
    border-radius: 6px;
    box-shadow: var(--mac-shadow);
    overflow: hidden;
    background: var(--mac-bg);
    transition: background-color 0.3s, box-shadow 0.3s;
}

/* Mac 窗口头部 */
.mac-header {
    background: var(--mac-header-bg);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    border-bottom: var(--mac-border);
    transition: background-color 0.3s, border-color 0.3s;
}

.mac-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
}

.mac-dot.red {
    background-color: #ff5f56;
}

.mac-dot.yellow {
    background-color: #ffbd2e;
}

.mac-dot.green {
    background-color: #27c93f;
}

/* 修正 pre 的 margin */
.mac-code-block pre {
    margin: 0 !important;
}

/* 修正 hljs 的样式以适应深色容器 */
.wechat-style .hljs {
    border-radius: 0 0 6px 6px !important;
    padding: 15px 18px 20px 18px;
    background: transparent !important;
    color: var(--mac-text-color);
}

.wechat-style h1 {
    font-size: 1.6rem;
    text-align: center;
    margin: 2.2em 0 1.2em;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    color: #1a1a1a;
    transition: border-color 0.3s;
}

.wechat-style h2 {
    font-size: 1.4rem;
    margin: 2em 0 1em;
    padding-left: 12px;
    border-left: 5px solid var(--primary-color);
    line-height: 1.4;
    color: #1a1a1a;
    transition: border-color 0.3s;
}

.wechat-style h3 {
    font-size: 1.2rem;
    margin: 1.8em 0 0.8em;
    color: var(--primary-color);
    font-weight: bold;
    transition: color 0.3s;
}

.wechat-style p {
    margin: 1.5em 0;
    text-align: justify;
    line-height: 1.8;
    color: #3e3e3e;
    letter-spacing: 0.5px;
}

.wechat-style p code {
    background: #f6f6f6;
    color: #ff502c;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.92em;
    margin: 0 2px;
    font-family: Menlo, Monaco, Consolas, Courier New, monospace;
}

.wechat-style blockquote {
    margin: 1.8em 0;
    padding: 20px;
    background: #fcfcfc;
    border-left: 4px solid var(--primary-color);
    color: #666;
    border-radius: 0 8px 8px 0;
    transition: border-color 0.3s;
}

.wechat-style blockquote p {
    margin: 0;
    color: #666;
    font-size: 15px;
}

.wechat-style pre {
    margin: 1.8em 0;
    padding: 0;
    background: transparent;
}

.wechat-style pre code {
    display: block;
    padding: 15px;
    font-size: 14px;
}

/* 代码高亮样式微调 */
.wechat-style .hljs {
    display: block;
    padding: 18px;
    /* background: #f8f8f8; */
    /* color: #333; */
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    /* border: 1px solid #f0f0f0; */
}

/* ========== 公众号专属卡片组件 ========== */

.wechat-style ul,
.wechat-style ol {
    margin: 1.5em 0;
    padding-left: 1.8em;
    color: #3e3e3e;
}

.wechat-style li {
    margin: 0.6em 0;
    line-height: 1.8;
}

.wechat-style img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 20px auto;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.wechat-style hr {
    margin: 2em 0;
    border: 0;
    border-top: 1px solid #eee;
}

.wechat-style table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.8rem 0;
    font-size: 14px;
}

.wechat-style th,
.wechat-style td {
    border: 1px solid #dfe2e5;
    padding: 10px 14px;
}

/* 4. 公众号轮播图滑块 (SVG/属性兼容预览方案) */
.wechat-style section[style*="overflow-x: auto"]::-webkit-scrollbar {
    display: none;
    /* 隐藏滚动条 */
}

.wechat-style section[style*="overflow-x: auto"] {
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
}

.wechat-style section[style*="overflow-x: auto"] div[style*="flex: 1"] {
    scroll-snap-align: start;
}

/* 1. 强调卡片盒 */
.wechat-style .card-box {
    margin: 2em 0;
    padding: 24px;
    border: 1px solid var(--primary-color);
    border-radius: 12px;
    background: #fff;
    position: relative;
    transition: border-color 0.3s;
}

.wechat-style .card-box::before {
    content: "TIP";
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--primary-color);
    color: #fff;
    padding: 2px 12px;
    font-size: 12px;
    border-radius: 4px;
    font-weight: bold;
    transition: background 0.3s;
}

/* 2. 装饰引用 */
.wechat-style .card-quote {
    margin: 2em 0;
    padding: 15px 20px;
    background: linear-gradient(to right, rgba(7, 193, 96, 0.05), transparent);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    transition: all 0.3s;
}

.wechat-style .card-quote.blue {
    background: linear-gradient(to right, rgba(30, 136, 229, 0.05), transparent);
}

.wechat-style .card-quote.purple {
    background: linear-gradient(to right, rgba(123, 31, 162, 0.05), transparent);
}

.wechat-style .card-quote.orange {
    background: linear-gradient(to right, rgba(245, 124, 0, 0.05), transparent);
}

/* 3. 设计分割线 */
.wechat-style .card-hr {
    margin: 3em 0;
    height: 1px;
    background: #eee;
    position: relative;
    text-align: center;
}

.wechat-style .card-hr::after {
    content: "◆";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 0 15px;
    color: var(--primary-color);
    font-size: 14px;
    transition: color 0.3s;
}