﻿/* wangEditor 核心样式 */
:root, :host {
    --w-e-textarea-bg-color: #fff;
    --w-e-textarea-color: #333;
    --w-e-textarea-border-color: #ccc;
    --w-e-textarea-slight-border-color: #e8e8e8;
    --w-e-textarea-slight-color: #d4d4d4;
    --w-e-textarea-slight-bg-color: #f5f2f0;
    --w-e-textarea-selected-border-color: #B4D5FF;
    --w-e-textarea-handler-bg-color: #4290f7;
    --w-e-toolbar-color: #595959;
    --w-e-toolbar-bg-color: #fff;
    --w-e-toolbar-active-color: #333;
    --w-e-toolbar-active-bg-color: #f1f1f1;
    --w-e-toolbar-disabled-color: #999;
    --w-e-toolbar-border-color: #e8e8e8;
    --w-e-modal-button-bg-color: #fafafa;
    --w-e-modal-button-border-color: #d9d9d9;
}

/* ====== 编辑器页面整体布局 ====== */
.editor-page {
    background: #f0f4f8;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ====== 顶部标题栏 ====== */
.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.25);
}
.editor-header-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}
.editor-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex: 1;
}
.editor-header-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.editor-header-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ====== 表单内容区 ====== */
.editor-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* 分区卡片 */
.editor-section {
    background: #fff;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.3s ease;
}
.editor-section:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.editor-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(59, 130, 246, 0.1);
}
.editor-section-title svg {
    color: #3b82f6;
}

/* 表单行 */
.editor-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.editor-field {
    flex: 1;
    min-width: 240px;
}

/* 标签 */
.editor-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}
.editor-label svg {
    color: #94a3b8;
    flex-shrink: 0;
}
.editor-required {
    color: #ef4444;
    font-weight: 800;
}

/* 输入框 */
.editor-input-wrap {
    position: relative;
}
.editor-input {
    width: 100%;
    height: 44px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 0 16px;
    font-size: 0.92rem;
    color: #1e293b;
    background: #f8fafc;
    transition: all 0.25s ease;
    outline: none;
    box-sizing: border-box;
}
.editor-input:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}
.editor-input::placeholder {
    color: #94a3b8;
}
.editor-input-hint {
    display: block;
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 6px;
}

/* 下拉选择框 */
.editor-select-wrap {
    position: relative;
}
.editor-select {
    width: 100%;
    height: 44px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 0 16px;
    font-size: 0.92rem;
    color: #1e293b;
    background: #f8fafc;
    transition: all 0.25s ease;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    box-sizing: border-box;
}
.editor-select:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}
.editor-select-wrap::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-right: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}

/* ====== 复选框组 ====== */
.editor-checkbox-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.editor-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.88rem;
    color: #475569;
    font-weight: 500;
    user-select: none;
}
.editor-checkbox-item:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}
.editor-checkbox-item input[type="checkbox"] {
    display: none;
}
.editor-checkbox-box {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    transition: all 0.25s ease;
}
.editor-checkbox-item input:checked + .editor-checkbox-box {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
.editor-checkbox-top { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.editor-checkbox-hot { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.editor-checkbox-rec { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.editor-checkbox-banner { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.editor-checkbox-item input:checked + .editor-checkbox-top {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
.editor-checkbox-item input:checked + .editor-checkbox-hot {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}
.editor-checkbox-item input:checked + .editor-checkbox-rec {
    background: #f59e0b;
    color: #fff;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}
.editor-checkbox-item input:checked + .editor-checkbox-banner {
    background: #10b981;
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* ====== 编辑器区域 ====== */
.editor-toolbar-wrap {
    border-bottom: 2px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
    background: #fff;
}
.editor-textarea-wrap {
    height: 280px;
    border: 2px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    background: #fff;
    overflow: hidden;
}

/* 字数统计 */
.editor-word-count {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: #f8fafc;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 0.82rem;
    color: #64748b;
}
.editor-count-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.editor-count-item svg {
    color: #94a3b8;
}
.editor-count-item strong {
    color: #3b82f6;
    font-weight: 700;
}
.editor-count-warning {
    display: none;
    align-items: center;
    gap: 4px;
    color: #ef4444;
    font-weight: 600;
    margin-left: auto;
    font-size: 0.82rem;
}

/* ====== 底部操作栏 ====== */
.editor-footer {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    position: sticky;
    bottom: 0;
    z-index: 100;
}
.editor-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 32px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}
.editor-btn-save {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
}
.editor-btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
    background: linear-gradient(135deg, #2563eb, #4f46e5);
}
.editor-btn-save:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}
.editor-btn-cancel {
    background: #f1f5f9;
    color: #64748b;
    border: 2px solid #e2e8f0;
}
.editor-btn-cancel:hover {
    background: #e2e8f0;
    color: #475569;
    transform: translateY(-1px);
}
.editor-btn-cancel:active {
    transform: translateY(0);
}

/* ====== 保存蒙版 ====== */
.editor-saving-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: editorMaskFadeIn 0.3s ease;
}
.editor-saving-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.editor-saving-spinner {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(59, 130, 246, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}
.editor-spin-svg {
    color: #3b82f6;
    animation: editorSpin 1s linear infinite;
}
.editor-saving-text {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.02em;
}
@keyframes editorMaskFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes editorSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ====== wangEditor 核心样式 ====== */
.w-e-text-container *, .w-e-toolbar * {
    box-sizing: border-box;
    margin: 0;
    outline: none;
    padding: 0;
}
.w-e-text-container blockquote, .w-e-text-container li, .w-e-text-container p,
.w-e-text-container td, .w-e-text-container th, .w-e-toolbar * {
    line-height: 1.5;
}
.w-e-text-container {
    background-color: var(--w-e-textarea-bg-color);
    color: var(--w-e-textarea-color);
    height: 100%;
    position: relative;
}
.w-e-text-container .w-e-scroll {
    -webkit-overflow-scrolling: touch;
    height: 100%;
}
.w-e-text-container [data-slate-editor] {
    word-wrap: break-word;
    border-top: 1px solid transparent;
    min-height: 100%;
    outline: 0;
    padding: 0 10px;
    white-space: pre-wrap;
}
.w-e-text-container [data-slate-editor] p { margin: 15px 0; }
.w-e-text-container [data-slate-editor] h1,
.w-e-text-container [data-slate-editor] h2,
.w-e-text-container [data-slate-editor] h3,
.w-e-text-container [data-slate-editor] h4,
.w-e-text-container [data-slate-editor] h5 { margin: 20px 0; }
.w-e-text-container [data-slate-editor] img {
    cursor: default;
    display: inline !important;
    max-width: 100%;
    min-height: 20px;
    min-width: 20px;
}
.w-e-text-container [data-slate-editor] span { text-indent: 0; }
.w-e-text-container [data-slate-editor] [data-selected=true] {
    box-shadow: 0 0 0 2px var(--w-e-textarea-selected-border-color);
}
.w-e-text-placeholder {
    font-style: italic;
    left: 10px;
    top: 17px;
    width: 90%;
}
.w-e-max-length-info, .w-e-text-placeholder {
    color: var(--w-e-textarea-slight-color);
    pointer-events: none;
    position: absolute;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}
.w-e-max-length-info {
    bottom: .5em;
    right: 1em;
}
.w-e-bar {
    background-color: var(--w-e-toolbar-bg-color);
    color: var(--w-e-toolbar-color);
    font-size: 14px;
    padding: 0 5px;
}
.w-e-bar svg {
    fill: var(--w-e-toolbar-color);
    height: 14px;
    width: 14px;
}
.w-e-bar-show { display: flex; }
.w-e-bar-hidden { display: none; }
.w-e-hover-bar {
    border: 1px solid var(--w-e-toolbar-border-color);
    border-radius: 3px;
    box-shadow: 0 2px 5px #0000001f;
    position: absolute;
}
.w-e-toolbar {
    flex-wrap: wrap;
    position: relative;
}
.w-e-bar-divider {
    background-color: var(--w-e-toolbar-border-color);
    display: inline-flex;
    height: 40px;
    margin: 0 5px;
    width: 1px;
}
.w-e-bar-item {
    display: flex;
    height: 40px;
    padding: 4px;
    position: relative;
    text-align: center;
}
.w-e-bar-item, .w-e-bar-item button {
    align-items: center;
    justify-content: center;
}
.w-e-bar-item button {
    background: transparent;
    border: none;
    color: var(--w-e-toolbar-color);
    cursor: pointer;
    display: inline-flex;
    height: 32px;
    overflow: hidden;
    padding: 0 8px;
    white-space: nowrap;
}
.w-e-bar-item button:hover {
    background-color: var(--w-e-toolbar-active-bg-color);
    color: var(--w-e-toolbar-active-color);
}
.w-e-bar-item button .title { margin-left: 5px; }
.w-e-bar-item .active {
    background-color: var(--w-e-toolbar-active-bg-color);
    color: var(--w-e-toolbar-active-color);
}
.w-e-bar-item .disabled {
    color: var(--w-e-toolbar-disabled-color);
    cursor: not-allowed;
}
.w-e-bar-item .disabled svg { fill: var(--w-e-toolbar-disabled-color); }
.w-e-bar-item .disabled:hover {
    background-color: var(--w-e-toolbar-bg-color);
    color: var(--w-e-toolbar-disabled-color);
}
.w-e-bar-item .disabled:hover svg { fill: var(--w-e-toolbar-disabled-color); }
.w-e-modal {
    background-color: var(--w-e-toolbar-bg-color);
    border: 1px solid var(--w-e-toolbar-border-color);
    border-radius: 3px;
    box-shadow: 0 2px 10px #0000001f;
    color: var(--w-e-toolbar-color);
    font-size: 14px;
    min-height: 40px;
    min-width: 100px;
    padding: 20px 15px 0;
    position: absolute;
    text-align: left;
    z-index: 1;
}
.w-e-modal .btn-close {
    cursor: pointer;
    line-height: 1;
    padding: 5px;
    position: absolute;
    right: 8px;
    top: 7px;
}
.w-e-modal .btn-close svg {
    fill: var(--w-e-toolbar-color);
    height: 10px;
    width: 10px;
}
.w-e-modal button {
    background-color: var(--w-e-modal-button-bg-color);
    border: 1px solid var(--w-e-modal-button-border-color);
    border-radius: 4px;
    color: var(--w-e-toolbar-color);
    cursor: pointer;
    font-weight: 400;
    height: 32px;
    padding: 4.5px 15px;
    text-align: center;
    touch-action: manipulation;
    transition: all .3s cubic-bezier(.645,.045,.355,1);
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    white-space: nowrap;
}
.w-e-modal input[type=number], .w-e-modal input[type=text], .w-e-modal textarea {
    font-feature-settings: "tnum";
    background-color: var(--w-e-toolbar-bg-color);
    border: 1px solid var(--w-e-modal-button-border-color);
    border-radius: 4px;
    color: var(--w-e-toolbar-color);
    font-variant: tabular-nums;
    padding: 4.5px 11px;
    transition: all .3s;
    width: 100%;
}
.w-e-modal textarea { min-height: 60px; }
body .w-e-modal, body .w-e-modal * { box-sizing: border-box; }
.w-e-text-container [data-slate-editor] code {
    background-color: var(--w-e-textarea-slight-bg-color);
    border-radius: 3px;
    font-family: monospace;
    padding: 3px;
}
.w-e-text-container [data-slate-editor] blockquote {
    background-color: var(--w-e-textarea-slight-bg-color);
    border-left: 8px solid var(--w-e-textarea-selected-border-color);
    display: block;
    font-size: 100%;
    line-height: 1.5;
    margin: 10px 0;
    padding: 10px;
}
.w-e-text-container [data-slate-editor] pre > code {
    background-color: var(--w-e-textarea-slight-bg-color);
    border: 1px solid var(--w-e-textarea-slight-border-color);
    border-radius: 4px 4px;
    display: block;
    font-size: 14px;
    padding: 10px;
    text-indent: 0;
    word-wrap: normal;
    font-family: Consolas, Monaco, Andale Mono, Ubuntu Mono, monospace;
    line-height: 1.5;
    margin: .5em 0;
    overflow: auto;
    padding: 1em;
    tab-size: 4;
    text-align: left;
    white-space: pre;
    word-break: normal;
}
.w-e-text-container [data-slate-editor] .w-e-image-container {
    display: inline-block;
    margin: 0 3px;
}
.w-e-text-container [data-slate-editor] .w-e-image-container:hover {
    box-shadow: 0 0 0 2px var(--w-e-textarea-selected-border-color);
}
.w-e-text-container [data-slate-editor] .table-container {
    border: 1px dashed var(--w-e-textarea-border-color);
    border-radius: 5px;
    margin-top: 10px;
    overflow-x: auto;
    padding: 10px;
    width: 100%;
}
.w-e-text-container [data-slate-editor] table { border-collapse: collapse; }
.w-e-text-container [data-slate-editor] table td,
.w-e-text-container [data-slate-editor] table th {
    border: 1px solid var(--w-e-textarea-border-color);
    line-height: 1.5;
    min-width: 30px;
    padding: 3px 5px;
    text-align: left;
}
.w-e-text-container [data-slate-editor] table th {
    background-color: var(--w-e-textarea-slight-bg-color);
    font-weight: 700;
    text-align: center;
}

/* ====== 基础重置样式 ====== */
html { line-height: 1.15; -webkit-text-size-adjust: 100%; }
body { margin: 0; }
h1 { font-size: 2em; margin: .67em 0; }
hr { box-sizing: content-box; height: 0; overflow: visible; }
pre { font-family: monospace, monospace; font-size: 1em; }
a { background-color: transparent; }
b, strong { font-weight: bolder; }
code, kbd, samp { font-family: monospace, monospace; font-size: 1em; }
small { font-size: 80%; }
img { border-style: none; }
button, input, optgroup, select, textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: 1.15;
    margin: 0;
}
button, input { overflow: visible; }
button, select { text-transform: none; }
[type=button], [type=reset], [type=submit], button { -webkit-appearance: button; }
fieldset { padding: .35em .75em .625em; }
legend {
    box-sizing: border-box;
    color: inherit;
    display: table;
    max-width: 100%;
    padding: 0;
    white-space: normal;
}
textarea { overflow: auto; }
[type=checkbox], [type=radio] { box-sizing: border-box; padding: 0; }
progress { vertical-align: baseline; }
details { display: block; }
summary { display: list-item; }
template { display: none; }
[hidden] { display: none; }
