/* ===========================================================
   ZhanQun CMS - 内置富文本编辑器样式（与后台 admin.css 主题一致）
   =========================================================== */

.zq-editor {
    border: 1px solid var(--border, #e6e9f0);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.zq-editor:focus-within { border-color: var(--primary, #111827); box-shadow: 0 0 0 3px rgba(17, 24, 39, .12); }
.zq-editor-orig { display: none !important; }

/* ---------------- 工具栏 ---------------- */
.zq-editor-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    padding: 7px 8px;
    background: #f7f9fc;
    border-bottom: 1px solid var(--border, #e6e9f0);
    position: sticky;
    top: 0;
    z-index: 5;
}
.zq-editor-bar button {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    font-size: 13px;
    line-height: 1;
    color: #465060;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.zq-editor-bar button:hover { background: var(--primary-l, #eef0f3); color: var(--primary, #111827); }
.zq-editor-bar button.on { background: var(--primary, #111827); color: #fff; border-color: var(--primary, #111827); }
.zq-editor-bar button.zb { font-weight: 700; }
.zq-editor-bar button.zi { font-style: italic; }
.zq-editor-bar button.zu { text-decoration: underline; }
.zq-editor-bar button.zs { text-decoration: line-through; }
.zq-editor-bar .zq-sep { width: 1px; height: 18px; margin: 0 5px; background: var(--border, #e6e9f0); }
.zq-editor-bar select {
    height: 30px;
    min-width: 96px;
    padding: 0 6px;
    font-size: 13px;
    color: #465060;
    background: #fff;
    border: 1px solid var(--border, #e6e9f0);
    border-radius: 7px;
    cursor: pointer;
}
.zq-editor-bar .zq-right { margin-left: auto; display: flex; gap: 3px; }

/* ---------------- 编辑区 ---------------- */
.zq-editor-area {
    min-height: 340px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 18px 20px;
    font-size: 15px;
    line-height: 1.85;
    color: #1f2733;
    outline: none;
    word-break: break-word;
}
.zq-editor-area:empty::before,
.zq-editor-area[data-empty="1"]::before {
    content: attr(data-placeholder);
    color: #a8b0bd;
    pointer-events: none;
}
.zq-editor-area p { margin: 0 0 14px; }
.zq-editor-area h2 { font-size: 20px; margin: 20px 0 12px; font-weight: 700; }
.zq-editor-area h3 { font-size: 17px; margin: 18px 0 10px; font-weight: 700; }
.zq-editor-area h4 { font-size: 15px; margin: 16px 0 8px; font-weight: 700; }
.zq-editor-area ul, .zq-editor-area ol { margin: 0 0 14px; padding-left: 26px; }
.zq-editor-area li { margin-bottom: 6px; }
.zq-editor-area blockquote {
    margin: 0 0 14px;
    padding: 10px 16px;
    border-left: 3px solid var(--primary, #111827);
    background: #f7f9fc;
    color: #4a5568;
}
.zq-editor-area pre {
    margin: 0 0 14px;
    padding: 12px 14px;
    background: #f4f6fa;
    border: 1px solid var(--border, #e6e9f0);
    border-radius: 8px;
    font: 13px/1.7 Consolas, Menlo, monospace;
    white-space: pre-wrap;
    overflow-x: auto;
}
.zq-editor-area img { max-width: 100%; height: auto; border-radius: 6px; vertical-align: bottom; }
.zq-editor-area a { color: var(--primary, #111827); text-decoration: underline; }
.zq-editor-area hr { border: 0; border-top: 1px solid var(--border, #e6e9f0); margin: 20px 0; }
.zq-editor-area table { width: 100%; border-collapse: collapse; margin: 0 0 14px; }
.zq-editor-area table td, .zq-editor-area table th { border: 1px solid #dfe3ea; padding: 7px 10px; }
.zq-editor-area table th { background: #f7f9fc; font-weight: 700; }
.zq-editor-area:focus { outline: none; }

/* ---------------- 源码 / 状态栏 ---------------- */
.zq-editor-source {
    display: none;
    width: 100%;
    min-height: 340px;
    max-height: 70vh;
    padding: 16px 18px;
    border: 0;
    outline: none;
    resize: vertical;
    font: 13px/1.7 Consolas, Menlo, monospace;
    color: #1f2733;
    background: #fbfcfe;
}
.zq-editor-status {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 10px;
    background: #f7f9fc;
    border-top: 1px solid var(--border, #e6e9f0);
    font-size: 12px;
    color: var(--muted, #7b8595);
}
.zq-editor-status .zq-count { margin-left: auto; }

/* ---------------- 全屏 ---------------- */
.zq-editor.zq-full {
    position: fixed;
    inset: 0;
    z-index: 9999;
    border: 0;
    border-radius: 0;
}
.zq-editor.zq-full .zq-editor-area,
.zq-editor.zq-full .zq-editor-source { max-height: calc(100vh - 90px); min-height: calc(100vh - 90px); }

/* ---------------- 弹窗 ---------------- */
.zq-editor-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(16, 24, 40, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.zq-editor-modal-box {
    width: 100%;
    max-width: 460px;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-lg, 0 12px 32px rgba(16, 24, 40, .14));
    padding: 20px;
}
.zq-editor-modal-box h4 { font-size: 15px; margin-bottom: 14px; }
.zq-editor-modal-box .zq-field { margin-bottom: 12px; }
.zq-editor-modal-box .zq-field label { display: block; font-size: 12.5px; color: var(--muted, #7b8595); margin-bottom: 6px; }
.zq-editor-modal-box input[type="text"] {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    font-size: 14px;
    border: 1px solid var(--border, #e6e9f0);
    border-radius: 8px;
    outline: none;
}
.zq-editor-modal-box input[type="text"]:focus { border-color: var(--primary, #111827); }
.zq-editor-modal-box input[type="file"] { font-size: 13px; }
.zq-editor-modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.zq-editor-modal-foot button {
    height: 34px;
    padding: 0 16px;
    font-size: 13.5px;
    border: 1px solid var(--border, #e6e9f0);
    background: #fff;
    color: #465060;
    border-radius: 8px;
    cursor: pointer;
}
.zq-editor-modal-foot button.primary { background: var(--primary, #111827); border-color: var(--primary, #111827); color: #fff; }
.zq-editor-modal-foot button:disabled { opacity: .6; cursor: default; }
.zq-editor-tip { font-size: 12.5px; color: var(--muted, #7b8595); margin-top: 8px; }
.zq-editor-tip.err { color: var(--err, #e0393e); }

@media (max-width: 560px) {
    .zq-editor-bar { gap: 2px; padding: 6px; }
    .zq-editor-bar .zq-sep { margin: 0 2px; }
    .zq-editor-area { padding: 14px; min-height: 260px; }
}
