:root {
    --editor-bg: var(--phoenix-body-bg);
    --editor-text: var(--phoenix-body-color);
    --editor-text-secondary: var(--phoenix-body-color-secondary);
    --editor-bg-hover: var(--phoenix-body-highlight-bg);
    --editor-border: var(--phoenix-border-color);
    --editor-border-strong: var(--phoenix-border-color-translucent);
    --editor-popover-bg: var(--phoenix-emphasis-bg);
    --editor-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --editor-icon-bg: var(--phoenix-secondary-bg-subtle);
    --editor-active-text: var(--phoenix-primary);
    --editor-active-bg: var(--phoenix-primary-bg-subtle);
    --editor-danger-bg: var(--phoenix-danger);
}

/* ========================================
   EditorJS 容器
   ======================================== */

.editorjs-container {
    width: 100%;
    position: relative;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    font-size:18px; 
}

.editorjs-wrapper {
    width: 100%;
    min-height: 300px;
}

/* ========================================
   固定工具栏 - Google/Apple 风格
   ======================================== */

.editorjs-toolbar {
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--phoenix-body-bg);
    border: 1px solid var(--phoenix-border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
}

/* 工具栏分组 */
.editorjs-toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 8px;
    border-right: 1px solid var(--phoenix-tertiary-bg);
}

.editorjs-toolbar-group:last-child {
    border-right: none;
}

.editorjs-toolbar-group:first-child {
    padding-left: 0;
}

/* 工具栏按钮 */
.editorjs-toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--phoenix-body-color);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    font-size: 14px;
}

.editorjs-toolbar-btn:hover {
    background: var(--phoenix-tertiary-bg);
    color: var(--phoenix-primary);
}

.editorjs-toolbar-btn:active {
    transform: scale(0.95);
    background: var(--phoenix-secondary-bg);
}

.editorjs-toolbar-btn.active {
    background: var(--phoenix-primary-bg-subtle);
    color: var(--phoenix-primary);
}

.editorjs-toolbar-btn i {
    font-size: 14px;
}

/* 下拉菜单容器 */
.editorjs-toolbar-dropdown {
    position: relative;
}

/* 下拉菜单面板 */
.editorjs-toolbar-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    padding: 4px 0;
    background: var(--phoenix-body-bg);
    border: 1px solid var(--phoenix-border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    min-width: 140px;
    display: none;
    z-index: 1000;
}

.editorjs-toolbar-dropdown.open .editorjs-toolbar-dropdown-menu {
    display: block;
}

/* 下拉菜单项 */
.editorjs-toolbar-dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: var(--phoenix-body-color);
    font-size: 14px;
    transition: background-color 0.15s ease;
}

.editorjs-toolbar-dropdown-item:hover {
    background: var(--phoenix-tertiary-bg);
}

.editorjs-toolbar-dropdown-item strong {
    color: var(--phoenix-primary);
    margin-right: 6px;
}

/* 工具栏固定状态 */
.editorjs-toolbar--fixed {
    position: fixed !important;
    top: 27px !important;
    z-index: 1000 !important;
    border-radius: 0 !important;
    border-bottom: 1px solid var(--phoenix-border-color) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 有工具栏时调整编辑器边框 */
.editorjs-toolbar + .editorjs-wrapper {
    border: 1px solid var(--phoenix-border-color);
    border-radius: 0 0 8px 8px;
    padding: 8px;
}

/* 隐藏图片 caption 输入框 */
.embed-tool .embed-tool__caption,
.image-tool .image-tool__caption {
    visibility: hidden !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    overflow: hidden !important;
}

.image-tool__image-picture {
    border-radius: 8px;
}
.editorjs-readonly .codex-editor {
    min-height: auto;
}

.editorjs-readonly .codex-editor__redactor {
    padding-bottom: 0 !important;
}

.editorjs-readonly .ce-block__content {
    max-width: 100%;

}

/* 修复editorjs遮挡问题 */
.tc-toolbox {
    z-index: 1000 !important; 
}

.ce-popover {
    z-index: 1000 !important;
}
.tc-table--heading {
    z-index: 1;
    position: relative;
}

/* 修复边距问题 */

.ce-block__content,
.ce-toolbar__content {
    max-width: 95% !important; 
}

.ce-block
{
    margin: 20px 0 !important;
}

@media (min-width: 650px) {
    .ce-block__content,
    .ce-toolbar__content {
        max-width: 88%;
        margin: 0 auto;
    }
}

/* 段落默认字体大小 */
.ce-paragraph span {
    letter-spacing: 0.02em;
    line-height:1.8em;
    font-size: 18px;
}

/* ========================================
   列表相关
   ======================================== */
.cdx-nested-list__item-content {
    font-size: 18px;
    color: var(--phoenix-secondary-color);
}

/* 无序列表圆点样式 */
.cdx-nested-list--unordered .cdx-nested-list__item::before {
    font-size: 24px;
    margin-right: 12px;
    color: rgba(var(--phoenix-body-color-rgb),0.93);
}

/* 有序列表数字样式 */
.cdx-nested-list--ordered .cdx-nested-list__item::before {
    font-size: 18px;
    margin-right: 8px;
    color: rgba(var(--phoenix-body-color-rgb), 0.93);
}

.cdx-nested-list__item
{
    line-height:2.1rem !important;
}


/* ========================================
   引用相关
   ======================================== */
.cdx-quote {
    border: none;
    padding: 0;
}

.cdx-quote__text {
    border: none;
    border-left: 4px solid var(--phoenix-primary);
    padding: 8px 20px 12px 20px;
    font-style: italic;
    background: transparent;
    min-height: 0px !important;
}

.cdx-quote__caption {
    display: none;
}
.cdx-input {
    -webkit-box-shadow: none !important;
}


/* ========================================
   其他
   ======================================== */

.cdx-block {
    padding: 0.1em 0 !important;
}

/* 针对 Editor.js Embed 插件生成的 iframe */
.embed-tool__content {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

@supports not (aspect-ratio: 16 / 9) {
    .embed-tool__content {
        height: 400px !important;
    }
}

/* 加号图标和六个点图标适配暗色系统 */
.ce-toolbar__plus,
.ce-toolbar__settings-btn {
    background: transparent;
    color: var(--phoenix-body-color);
    background-color: var(--phoenix-secondary-bg-subtle)
}

.ce-toolbar__plus:hover,
.ce-toolbar__settings-btn:hover {
    background: var(--phoenix-tertiary-bg);
    color: var(--phoenix-primary);
}

/* 链接输入框文字颜色修复 */
.codex-editor .ce-inline-tool-input {
    color: var(--color-text-primary) !important;
    background-color: var(--editor-bg-hover) !important;
    border: 1px solid var(--editor-border) !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    padding: 5px 10px !important;
    font-size: 14px !important;
}

.codex-editor .ce-inline-tool-input::placeholder {
    color: var(--phoenix-secondary) !important;
    opacity: 0.9; 
}

.codex-editor .ce-inline-tool-input:focus {
    border-color: var(--phoenix-primary) !important;
    background-color: var(--editor-bg) !important; 
    outline: none !important;
}

/* ========================================
   分割线样式
   ======================================== */
.ce-delimiter {
    line-height: 1.6em;
    width: 100%;
    text-align: center;
    margin: 2rem 0;
}

.ce-delimiter::before {
    display: inline-block !important;
    content: "" !important;
    border-top: 1px solid var(--phoenix-tertiary-bg);
    width: 100%;
    height: 0;
    line-height: 0;
    vertical-align: middle;
}

/* ========================================
   图片对齐样式
   ======================================== */

/* 居左 */
.ce-tune-alignment--left .image-tool {
    text-align: left !important;
}

.ce-tune-alignment--left .image-tool img {
    margin: 0 !important;
}

/* 居中 */
.ce-tune-alignment--center .image-tool {
    text-align: center !important;
}

.ce-tune-alignment--center .image-tool img {
    margin: 0 auto !important;
}

/* 居右 */
.ce-tune-alignment--right .image-tool {
    text-align: right !important;
}

.ce-tune-alignment--right .image-tool img {
    margin: 0 0 0 auto !important;
}

/* ========================================
   表格相关
   ======================================== */

.editorjs-container .tc-popover {
    --color-border: var(--editor-border) !important;
    --color-background: var(--editor-bg) !important;
    --color-background-hover: var(--editor-bg-hover) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(var(--editor-shadow),0.8) !important;
}

.editorjs-container .tc-add-row, 
.editorjs-container .tc-add-column,
.editorjs-container .tc-add-row::before { 
    transition: background-color 0.2s ease;
}

.editorjs-container .tc-add-column:hover {
    background-color: var(--editor-bg-hover) !important;
    cursor: pointer;
}
.editorjs-container .tc-add-row:hover {
    background-color: var(--editor-bg-hover) !important;
    cursor: pointer;
}

.editorjs-container .tc-add-row:hover::before {
    background-color: var(--editor-bg-hover) !important;
}

.tc-add-row svg,
.tc-add-column svg {
    background-color: var(--editor-text-secondary) !important;
}

.editorjs-container .tc-wrap {
    --color-border: var(--editor-border) !important;
    border-left: 1px solid var(--color-border) !important;
}

/* 第一行标题背景颜色  */
.editorjs-container .tc-table--heading .tc-row:first-child .tc-cell {
    background: var(--phoenix-body-highlight-bg) !important;
}

/* 修复表头边框粗细不一致问题 + 加粗表头边框 */
.editorjs-container .tc-table--heading .tc-row:first-child {
    border-bottom: 2px solid var(--color-border) !important;
}

.editorjs-container .tc-table--heading .tc-row:first-child::after {
    border-bottom: 2px solid var(--color-border) !important;
}

/* ========================================
   表格颜色主题 - 11 种颜色
   边框线 + 表头背景色
   ======================================== */

/* 主色 */
.tc-table--color-primary .tc-wrap,
.table-color-tune-wrapper.tc-table--color-primary .tc-wrap {
    --color-border: var(--phoenix-primary) !important;
}
.tc-table--color-primary.tc-table--heading .tc-row:first-child .tc-cell,
.table-color-tune-wrapper.tc-table--color-primary .tc-table--heading .tc-row:first-child .tc-cell {
    background: var(--phoenix-primary-bg-subtle) !important;
}

/* 成功 */
.tc-table--color-success .tc-wrap,
.table-color-tune-wrapper.tc-table--color-success .tc-wrap {
    --color-border: var(--phoenix-success) !important;
}
.tc-table--color-success.tc-table--heading .tc-row:first-child .tc-cell,
.table-color-tune-wrapper.tc-table--color-success .tc-table--heading .tc-row:first-child .tc-cell {
    background: var(--phoenix-success-bg-subtle) !important;
}

/* 危险 */
.tc-table--color-danger .tc-wrap,
.table-color-tune-wrapper.tc-table--color-danger .tc-wrap {
    --color-border: var(--phoenix-danger) !important;
}
.tc-table--color-danger.tc-table--heading .tc-row:first-child .tc-cell,
.table-color-tune-wrapper.tc-table--color-danger .tc-table--heading .tc-row:first-child .tc-cell {
    background: var(--phoenix-danger-bg-subtle) !important;
}

/* 警告 */
.tc-table--color-warning .tc-wrap,
.table-color-tune-wrapper.tc-table--color-warning .tc-wrap {
    --color-border: var(--phoenix-warning) !important;
}
.tc-table--color-warning.tc-table--heading .tc-row:first-child .tc-cell,
.table-color-tune-wrapper.tc-table--color-warning .tc-table--heading .tc-row:first-child .tc-cell {
    background: var(--phoenix-warning-bg-subtle) !important;
}

/* 信息 */
.tc-table--color-info .tc-wrap,
.table-color-tune-wrapper.tc-table--color-info .tc-wrap {
    --color-border: var(--phoenix-info) !important;
}
.tc-table--color-info.tc-table--heading .tc-row:first-child .tc-cell,
.table-color-tune-wrapper.tc-table--color-info .tc-table--heading .tc-row:first-child .tc-cell {
    background: var(--phoenix-info-bg-subtle) !important;
}

/* 强调 */
.tc-table--color-body-emphasis .tc-wrap,
.table-color-tune-wrapper.tc-table--color-body-emphasis .tc-wrap {
    --color-border: var(--phoenix-emphasis-color) !important;
}
.tc-table--color-body-emphasis.tc-table--heading .tc-row:first-child .tc-cell,
.table-color-tune-wrapper.tc-table--color-body-emphasis .tc-table--heading .tc-row:first-child .tc-cell {
    background: var(--phoenix-emphasis-bg) !important;
    color: var(--phoenix-emphasis-color) !important;
}

/* 次要文字 */
.tc-table--color-body-secondary .tc-wrap,
.table-color-tune-wrapper.tc-table--color-body-secondary .tc-wrap {
    --color-border: var(--phoenix-secondary-color) !important;
}
.tc-table--color-body-secondary.tc-table--heading .tc-row:first-child .tc-cell,
.table-color-tune-wrapper.tc-table--color-body-secondary .tc-table--heading .tc-row:first-child .tc-cell {
    background: var(--phoenix-secondary-bg) !important;
}

/* 辅助文字 */
.tc-table--color-body-tertiary .tc-wrap,
.table-color-tune-wrapper.tc-table--color-body-tertiary .tc-wrap {
    --color-border: var(--phoenix-tertiary-color) !important;
}
.tc-table--color-body-tertiary.tc-table--heading .tc-row:first-child .tc-cell,
.table-color-tune-wrapper.tc-table--color-body-tertiary .tc-table--heading .tc-row:first-child .tc-cell {
    background: var(--phoenix-tertiary-bg) !important;
}

/* 深蓝 */
.tc-table--color-primary-dark .tc-wrap,
.table-color-tune-wrapper.tc-table--color-primary-dark .tc-wrap {
    --color-border: var(--phoenix-primary-dark) !important;
}
.tc-table--color-primary-dark.tc-table--heading .tc-row:first-child .tc-cell,
.table-color-tune-wrapper.tc-table--color-primary-dark .tc-table--heading .tc-row:first-child .tc-cell {
    background: rgba(var(--phoenix-primary-dark-rgb), 0.1) !important;
}

/* 深红 */
.tc-table--color-danger-dark .tc-wrap,
.table-color-tune-wrapper.tc-table--color-danger-dark .tc-wrap {
    --color-border: var(--phoenix-danger-dark) !important;
}
.tc-table--color-danger-dark.tc-table--heading .tc-row:first-child .tc-cell,
.table-color-tune-wrapper.tc-table--color-danger-dark .tc-table--heading .tc-row:first-child .tc-cell {
    background: rgba(var(--phoenix-danger-dark-rgb), 0.1) !important;
}

/* 次要灰 */
.tc-table--color-secondary .tc-wrap,
.table-color-tune-wrapper.tc-table--color-secondary .tc-wrap {
    --color-border: var(--phoenix-secondary) !important;
}
.tc-table--color-secondary.tc-table--heading .tc-row:first-child .tc-cell,
.table-color-tune-wrapper.tc-table--color-secondary .tc-table--heading .tc-row:first-child .tc-cell {
    background: var(--phoenix-secondary-bg-subtle) !important;
}


/* ========================================
    弹窗 
   ======================================== */

.codex-editor .ce-popover {
    --color-background: var(--editor-popover-bg) !important;
    --color-border: var(--editor-border) !important;
    --color-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important; 
    --border-radius: 8px !important; 
    --color-text-primary: var(--editor-text) !important;
    --color-text-secondary: var(--editor-text-secondary) !important;
    --color-background-item-hover: var(--editor-bg-hover) !important;
    --color-text-icon-active: var(--phoenix-primary) !important;
    --color-background-icon-active: var(--phoenix-primary-bg-subtle) !important;
    --color-background-item-confirm: var(--phoenix-danger-bg-subtle) !important;
    --color-background-item-confirm-hover: var(--phoenix-danger-bg-subtle) !important;
    --color-text-confirm: var(--phoenix-danger) !important; 
}

.codex-editor .ce-popover__container {
    border: 1px solid var(--color-border) !important;
    padding: 6px !important;
}

.codex-editor .ce-popover__item-icon {
    background-color: transparent !important; 
    color: var(--editor-text) !important;
}

/* 弹窗内搜索框 */

.codex-editor .cdx-search-field {
    background-color: var(--editor-bg-hover) !important;
    border: 1px solid var(--editor-border) !important;
    border-radius: 6px !important;
}

.codex-editor .cdx-search-field__input {
    color: var(--editor-text) !important;
}

.codex-editor .cdx-search-field__icon {
    color: var(--editor-text-secondary) !important;
    margin-right: 10px !important; 
}

.codex-editor .cdx-search-field__input::placeholder {
    color: var(--editor-text-secondary) !important;
    opacity: 0.6;
}

.codex-editor .cdx-settings-button:hover {
    background-color: var(--editor-bg-hover) !important;
    color: var(--editor-text) !important;
}

.ce-popover-item--confirmation
{
    background:var(--editor-danger-bg) !important;
}

/* 行内工具条 */
.codex-editor .ce-popover-item,
.codex-editor .ce-inline-tool {
    color: var(--editor-text) !important;
    border-radius: 6px !important;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.codex-editor .ce-popover-item:hover,
.codex-editor .ce-inline-tool:hover {
    background-color: var(--editor-bg-hover) !important;
    color: var(--editor-text) !important;
    cursor: pointer;
}

.codex-editor .ce-inline-tool--active {
    background-color: var(--editor-active-bg) !important;
    color: var(--editor-active-text) !important;
}

.codex-editor .ce-popover-item__icon--chevron-right {
    color: var(--editor-text-secondary) !important;
}

/* 隐藏表格 Collapse 菜单项（通过图标特征隐藏） */
.codex-editor .ce-popover-item:has(svg path[d*="M7 9L10 12"]):has(svg path[d*="M17 9L14 12"]) {
    display: none !important;
}

/* ========================================
   目录浮动面板
   ======================================== */

.editorjs-toc-panel {
    position: fixed;
    top: 80px;
    right: -285px;
    width: 230px;
    max-height: calc(100vh - 100px);
    background: var(--phoenix-body-bg);
    border: 1px solid var(--phoenix-border-color);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editorjs-toc-panel.show {
    right: 15px;
}

/* 目录头部 */
.editorjs-toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 20px;
    border-bottom: 1px solid var(--phoenix-border-color);
    background: var(--phoenix-secondary-bg);
}

.editorjs-toc-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--phoenix-body-color);
}

.editorjs-toc-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--phoenix-secondary-color);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.editorjs-toc-close:hover {
    background: var(--phoenix-tertiary-bg);
    color: var(--phoenix-body-color);
}

/* 目录内容区 */
.editorjs-toc-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.editorjs-toc-content::-webkit-scrollbar {
    width: 6px;
}

.editorjs-toc-content::-webkit-scrollbar-track {
    background: transparent;
}

.editorjs-toc-content::-webkit-scrollbar-thumb {
    background: var(--phoenix-tertiary-bg);
    border-radius: 3px;
}

.editorjs-toc-content::-webkit-scrollbar-thumb:hover {
    background: var(--phoenix-secondary-bg);
}

/* 目录项 */
.editorjs-toc-item {
    display: flex;
    align-items: flex-start;
    padding: 8px 20px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-left: 3px solid transparent;
}

.editorjs-toc-item:hover {
    background: var(--phoenix-tertiary-bg);
    border-left-color: var(--phoenix-primary);
}

.editorjs-toc-item:active {
    background: var(--phoenix-secondary-bg);
}

.editorjs-toc-number {
    flex-shrink: 0;
    min-width: 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--phoenix-primary);
    margin-right: 4px;
}

.editorjs-toc-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: var(--phoenix-body-color);
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 空状态 */
.editorjs-toc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--phoenix-tertiary-color);
}

.editorjs-toc-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.editorjs-toc-empty p {
    font-size: 14px;
    margin: 0;
}

/* 标题高亮效果 */
.editorjs-header-highlight {
    animation: headerHighlight 1.5s ease;
}

@keyframes headerHighlight {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: var(--phoenix-primary-bg-subtle);
    }
}

/* 响应式 - 移动端 */
@media (max-width: 768px) {
    .editorjs-toc-panel {
        width: 200px;
        top: 60px;
        right: -220px;
    }

    .editorjs-toc-panel.show {
        right: 10px; 
    }

    .editorjs-toc-item {
        padding: 8px 16px;
    }

    .editorjs-toc-number {
        min-width: 18px;
        font-size: 12px;
    }

    .editorjs-toc-text {
        font-size: 13px;
    }
}


@media (max-width: 480px) {
    .editorjs-toc-panel {
        width: 200px; 
        right: -220px; 
        left: auto;
        top: 120px;
    }

    .editorjs-toc-panel.show {
        right: 10px;
        left: auto;
    }
}
