/* ABCDE网站 富文本编辑器样式 */
.rte {
    border: 1px solid #d8dee9;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    width: 100%;
}

.rte-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 2px;
    padding: 5px 6px;
    background: #f7f9fc;
    border-bottom: 1px solid #e3e8f0;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #cfd9e8 transparent;
}

.rte-toolbar::-webkit-scrollbar { height: 5px; }
.rte-toolbar::-webkit-scrollbar-thumb { background: #cfd9e8; border-radius: 5px; }

.rte-toolbar .rte-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 5px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 4px;
    font-size: 12.5px;
    color: #3a465a;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    flex: 0 0 auto;
}

.rte-toolbar .rte-btn:hover {
    background: #e9eff9;
    border-color: #cfdaeb;
    color: #1f4f9e;
}

.rte-toolbar .rte-btn.active {
    background: #dfe9f8;
    border-color: #b7cbe8;
    color: #1f4f9e;
}

.rte-toolbar .rte-btn b { font-weight: 700; }
.rte-toolbar .rte-btn i { font-style: italic; }
.rte-toolbar .rte-btn u { text-decoration: underline; }
.rte-toolbar .rte-btn s { text-decoration: line-through; }

/* 紧凑下拉菜单：H 段落 / T 字体 / A 字号 */
.rte-menu {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.rte-toolbar .rte-menu-toggle {
    min-width: 38px;
    padding: 0 4px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.rte-toolbar .rte-caret {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 3px;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-top: 4px solid #8594aa;
    transform: translateY(1px);
}

.rte-menu-panel {
    display: none;
    position: fixed;
    z-index: 9999;
    min-width: 132px;
    max-height: 300px;
    overflow-y: auto;
    padding: 6px;
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(31, 47, 76, 0.16);
}

.rte-menu.open .rte-menu-panel { display: block; }

.rte-menu-item {
    display: block;
    width: 100%;
    padding: 6px 10px;
    border: 0;
    background: transparent;
    border-radius: 5px;
    font-size: 13px;
    font-family: inherit;
    color: #3a465a;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.rte-menu-item:hover {
    background: #eef4ff;
    color: #1f4f9e;
}

/* 文字颜色 / 背景颜色 */
.rte-toolbar .rte-color-toggle {
    min-width: 40px;
    padding: 0 5px;
}

.rte-toolbar .rte-color-a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}

.rte-toolbar .rte-color-a-text {
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 2px;
}

.rte-toolbar .rte-color-a-bg {
    width: 17px;
    height: 17px;
    border-radius: 3px;
    background: #3a465a;
    color: #fff;
    font-size: 11.5px;
}

.rte-toolbar .rte-emoji {
    font-size: 15px;
    line-height: 1;
}

.rte-menu-panel.rte-color-panel {
    width: 336px;
    max-width: calc(100vw - 16px);
    padding: 12px 14px 14px;
}

.rte-color-reset {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 4px 6px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #4a5a75;
    font-family: inherit;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
}

.rte-color-reset:hover {
    background: #f2f5fa;
}

.rte-reset-icon {
    position: relative;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    border: 1.5px solid #7b8798;
    border-radius: 2px;
}

.rte-reset-icon::before {
    content: "";
    position: absolute;
    left: -2px;
    top: 7.5px;
    width: 22px;
    height: 1.5px;
    background: #7b8798;
    transform: rotate(-45deg);
    transform-origin: center;
}

.rte-swatches {
    display: grid;
    grid-template-columns: repeat(10, 24px);
    gap: 8px 7px;
    margin-top: 10px;
}

.rte-color-swatch {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 5px;
    cursor: pointer;
}

.rte-color-swatch:hover {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.rte-toolbar .rte-code-text {
    font-family: Consolas, Monaco, monospace;
    font-size: 11.5px;
    letter-spacing: -0.4px;
}

.rte-toolbar .rte-sep {
    width: 1px;
    height: 18px;
    background: #dfe5ee;
    margin: 0 3px;
}

.rte-body {
    position: relative;
    background: #fff;
}

.rte-content {
    min-height: 220px;
    max-height: 640px;
    overflow-y: auto;
    padding: 14px 16px;
    font-size: 15px;
    line-height: 1.75;
    color: #333;
    outline: none;
    word-break: break-word;
}

.rte-content:empty:before {
    content: attr(data-placeholder);
    color: #a9b3c2;
    pointer-events: none;
}

.rte-content h1, .rte-content h2, .rte-content h3 { margin: 12px 0 8px; color: #22345c; }
.rte-content h2 { font-size: 21px; }
.rte-content p { margin: 0 0 10px; }
.rte-content p.rte-p1 { font-size: 18px; line-height: 1.7; }
.rte-content p.rte-p2 { font-size: 16px; line-height: 1.7; }
.rte-content p.rte-p3 { font-size: 14px; line-height: 1.7; }
.rte-content p.rte-p4 { font-size: 13px; line-height: 1.7; }
.rte-content ul, .rte-content ol { padding-left: 24px; margin: 6px 0 10px; }
.rte-content blockquote {
    margin: 10px 0;
    padding: 8px 14px;
    border-left: 3px solid #9bb5dd;
    background: #f6f9fd;
    color: #4d5a70;
}
.rte-content pre {
    background: #f4f6fa;
    border: 1px solid #e2e8f1;
    border-radius: 6px;
    padding: 12px 14px;
    overflow-x: auto;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
}
.rte-content code { font-family: Consolas, Monaco, monospace; background: #f1f4f9; padding: 1px 5px; border-radius: 4px; }
.rte-content img { max-width: 100%; height: auto; border-radius: 6px; }
.rte-content table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.rte-content table th, .rte-content table td { border: 1px solid #dfe5ee; padding: 6px 10px; }
.rte-content a { color: #2563eb; }

/* 字号：execCommand fontSize 产生 <font size="1-7"> */
.rte-content font[size="1"] { font-size: 12px; }
.rte-content font[size="2"] { font-size: 14px; }
.rte-content font[size="3"] { font-size: 16px; }
.rte-content font[size="4"] { font-size: 18px; }
.rte-content font[size="5"] { font-size: 22px; }
.rte-content font[size="6"] { font-size: 26px; }
.rte-content font[size="7"] { font-size: 32px; }

.rte.rte-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9997;
    border-radius: 0;
    border: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.rte.rte-fullscreen .rte-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
}

.rte.rte-fullscreen .rte-body {
    flex: 1;
    display: flex;
}

.rte.rte-fullscreen .rte-content {
    flex: 1;
    max-height: none;
    min-height: 0 !important;
    padding: 18px 24px;
}

/* 前台内容展示 */
.rich-content {
    font-size: 15px;
    line-height: 1.8;
    color: #333;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.rich-content h1, .rich-content h2, .rich-content h3, .rich-content h4 { color: #22345c; margin: 14px 0 8px; }
.rich-content p { margin: 0 0 10px; }
.rich-content p.rte-p1 { font-size: 18px; }
.rich-content p.rte-p2 { font-size: 16px; }
.rich-content p.rte-p3 { font-size: 14px; }
.rich-content p.rte-p4 { font-size: 13px; }
.rich-content ul, .rich-content ol { padding-left: 24px; margin: 6px 0 10px; }
.rich-content blockquote { margin: 10px 0; padding: 8px 14px; border-left: 3px solid #9bb5dd; background: #f6f9fd; }
.rich-content pre { background: #f4f6fa; border: 1px solid #e2e8f1; border-radius: 6px; padding: 12px 14px; overflow-x: auto; white-space: pre-wrap; }
.rich-content code { font-family: Consolas, Monaco, monospace; background: #f1f4f9; padding: 1px 5px; border-radius: 4px; }
.rich-content img { max-width: 100%; height: auto; border-radius: 6px; }
.rich-content table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.rich-content table th, .rich-content table td { border: 1px solid #dfe5ee; padding: 6px 10px; }
.rich-content a { color: #2563eb; }
.rich-content font[size="1"] { font-size: 12px; }
.rich-content font[size="2"] { font-size: 14px; }
.rich-content font[size="3"] { font-size: 16px; }
.rich-content font[size="4"] { font-size: 18px; }
.rich-content font[size="5"] { font-size: 22px; }
.rich-content font[size="6"] { font-size: 26px; }
.rich-content font[size="7"] { font-size: 32px; }

@media (max-width: 720px) {
    .rte-content { min-height: 180px; padding: 12px; }
    .rte-toolbar { padding: 5px; }
    .rte-toolbar .rte-btn { min-width: 28px; height: 28px; padding: 0 6px; }
}