/* 编辑器样式 */

/* 遮罩层 */
.editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 编辑面板 */
.editor-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 70%;
    max-width: none;
    height: 100dvh;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
}

@media (max-width: 1023px) {
    .editor-panel {
        border-left: none !important;
    }
}

.editor-panel-show {
    transform: translateX(0);
}

/* 平板端适配 */
@media (max-width: 1023px) {
    .editor-panel {
        width: 80%;
    }
}

/* 移动端保持全屏 */
@media (max-width: 1023px) {
    .editor-panel {
        width: 100%;
        max-width: 100%;
    }
}

/* 工具类 - 移动端和桌面端显示控制 */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 1023px) {
    .mobile-only {
        display: block;
    }

    .desktop-only {
        display: none;
    }
}

/* 编辑器头部 */
.editor-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.editor-header-content {
    flex: 1;
    display: flex;
    /* justify-content: start; */
    align-items: center;
}

@media (max-width: 1023px) {
    .editor-header-content {
        justify-content: center;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 88px);
        /* 减去左右按钮的宽度 */
    }
}

.editor-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.editor-back-btn,
.editor-close-btn {
    padding: 0.5rem;
    border: none;
    background: none;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    /* display: flex !important; */
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.editor-close-btn {
    /* padding: 0.5rem 0.5rem 0.5rem 0; */
    display: flex !important;
}

.editor-close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.editor-back-btn i {
    font-size: 1.75rem;
}

/* 编辑器主体 */
.editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.editor-form {
    max-width: 100%;
}

/* 表单组件 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-tertiary);
    opacity: 0.8;
}

.form-input,
.form-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.6;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* 禁用摘要输入框的拖拽调整大小功能 */
.editor-excerpt-input {
    resize: none !important;
}

/* 确保在暗色主题下也生效 */
[data-theme="dark"] .editor-excerpt-input {
    resize: none !important;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

/* 复选框样式 */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.form-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.form-checkbox-mark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    position: relative;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.form-checkbox input:checked+.form-checkbox-mark {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.form-checkbox input:checked+.form-checkbox-mark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.form-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* 标签选择器 */
.tags-selector {
    position: relative;
}

.tags-select-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    /* background: var(--bg-primary); */
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.6;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tags-select-btn:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.tags-select-btn .ri-price-tag-3-line {
    color: var(--text-secondary);
    font-size: 1rem;
}

.tags-display {
    flex: 1;
    text-align: left;
    margin: 0 0.5rem;
}

.tags-display.selected {
    color: var(--primary-color);
    font-weight: 500;
}

.tags-arrow {
    color: var(--text-secondary);
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.tags-select-btn[aria-expanded="true"] .tags-arrow {
    transform: rotate(180deg);
}

/* 旧的标签显示区域样式已移除，现在使用统一的选择按钮 */

/* 标签下拉框 */
.tags-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 10;
    max-height: 300px;
    overflow: hidden;
}

.tags-dropdown-header {
    padding: 0.2rem 1rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    font-weight: 500;
}

.tags-dropdown-close {
    padding: 0.25rem;
    border: none;
    background: none;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tags-dropdown-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tags-dropdown-body {
    max-height: 240px;
    overflow-y: auto;
    padding: 0.5rem;
}

.tags-tree {
    max-height: 240px;
    overflow-y: auto;
    padding: 0.5rem;
}

.tags-tree .tag-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: normal;
}

.tags-tree .tag-item:hover {
    background: var(--bg-secondary);
}

.tags-tree .tag-item.selected {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

.tags-tree .tag-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tags-tree .tag-name {
    flex: 1;
    font-size: 0.875rem;
}

.tags-tree .tag-check {
    color: var(--primary-color);
    font-weight: bold;
}

.no-tags {
    padding: 2rem;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

/* 编辑器内容区域 */
.editor-content-group {
    margin-bottom: 0;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.editor-toolbar-buttons {
    display: flex;
    gap: 0.25rem;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    font-size: 0.875rem;
    font-weight: 600;
}

.toolbar-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.toolbar-btn:active {
    background: var(--primary-color);
    color: white;
}

/* 编辑器容器 */
.editor-container {
    /* border: 1px solid var(--border-color); */
    /* border-radius: 8px; */
    overflow: hidden;
    background: var(--bg-primary);
}

/* 编辑器标签页 */
.editor-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.editor-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.editor-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.editor-tab.active {
    color: var(--primary-color);
    background: var(--bg-primary);
    position: relative;
}

.editor-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* 编辑器内容 */
.editor-content {
    min-height: 300px;
    position: relative;
}

.editor-textarea {
    width: 100%;
    height: 300px;
    padding: 1rem;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: none;
}

.editor-preview {
    padding: 1rem;
    min-height: 300px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.875rem;
    line-height: 1.6;
}

.editor-preview h1,
.editor-preview h2,
.editor-preview h3,
.editor-preview h4,
.editor-preview h5,
.editor-preview h6 {
    margin: 1rem 0 0.5rem 0;
    color: var(--text-primary);
}

.editor-preview h1 {
    font-size: 2em !important;
}

.editor-preview h2 {
    font-size: 1.6em !important;
}

.editor-preview h3 {
    font-size: 1.25em !important;
}

.editor-preview h4 {
    font-size: 1em !important;
}

.editor-preview h5 {
    font-size: 0.8em !important;
}

.editor-preview h6 {
    font-size: 0.65em !important;
}

.editor-preview p {
    margin: 0.5rem 0;
    color: var(--text-primary);
}

.editor-preview strong {
    color: var(--text-primary);
    font-weight: 600;
}

.editor-preview em {
    color: var(--text-secondary);
}

.editor-preview code {
    background: var(--bg-secondary);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-family: 'JetBrains Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.8rem;
}

.editor-preview a {
    color: var(--primary-color);
    text-decoration: none;
}

.editor-preview a:hover {
    text-decoration: underline;
}

.editor-preview ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.editor-preview li {
    margin: 0.25rem 0;
    color: var(--text-primary);
}

.empty-preview {
    color: var(--text-tertiary);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* 消息提示 */
.message {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.message-show {
    transform: translateX(0);
}

.message-success {
    background: #10b981;
}

.message-error {
    background: #ef4444;
}

.message-info {
    background: #3b82f6;
}

/* 移动端粘性工具栏优化 */
@media (max-width: 1023px) {
    .quill-editor .ql-toolbar.sticky {
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        padding: 0.75rem 1rem;
        box-sizing: border-box !important;
    }

    .quill-editor .ql-toolbar.sticky .ql-formats {
        margin-right: 0.5rem;
    }

    .quill-editor .ql-toolbar.sticky button,
    .quill-editor .ql-toolbar.sticky .ql-picker,
    .quill-editor .ql-toolbar.sticky .ql-align,
    .quill-editor .ql-toolbar.sticky .ql-indent {
        width: 32px !important;
        height: 32px !important;
        margin: 0 0.25rem;
    }

    /* 移动端工具提示样式调整 */
    .ql-toolbar .ql-align::after,
    .ql-toolbar .ql-indent[value="-1"]::after,
    .ql-toolbar .ql-indent[value="+1"]::after {
        font-size: 10px !important;
        padding: 1px 4px !important;
        bottom: -20px !important;
    }

    /* 移动端暗色主题工具提示 */
    [data-theme="dark"] .ql-toolbar .ql-align::after,
    [data-theme="dark"] .ql-toolbar .ql-indent[value="-1"]::after,
    [data-theme="dark"] .ql-toolbar .ql-indent[value="+1"]::after {
        background: rgba(30, 30, 30, 0.95) !important;
        color: #ffffff !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
    }

    /* 移动端对齐选项优化 */
    .ql-toolbar .ql-align .ql-picker-options {
        min-width: 120px !important;
        font-size: 11px !important;
    }

    .ql-toolbar .ql-align .ql-picker-item {
        padding: 0.375rem 0.5rem !important;
        min-height: 28px !important;
    }

    .ql-toolbar .ql-align .ql-picker-item::after {
        font-size: 11px !important;
    }
}

/* 响应式设计 */
@media (max-width: 1023px) {
    .editor-header {
        padding: 0.5rem 0.5rem 0.5rem 0rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }

    .editor-title {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: calc(100% - 60px);
    }

    .editor-close-btn {
        padding: 0.75rem;
        min-width: 44px;
        min-height: 44px;
        border-radius: 8px;
        flex-shrink: 0;
    }

    .editor-header-right {
        justify-content: flex-end;
    }

    .editor-body {
        /* padding: 1rem; */
        padding: 1rem 0.75rem;
    }

    .editor-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .editor-toolbar-buttons {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .message {
        left: 1rem;
        right: 1rem;
        top: 1rem;
        transform: translateY(-100%);
    }

    .message-show {
        transform: translateY(0);
    }
}

/* 按钮样式增强 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    outline: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-icon {
    padding: 0.5rem;
    min-width: 36px;
    min-height: 36px;
    justify-content: center;
}

/* 滚动条样式 */
.editor-body::-webkit-scrollbar,
.tags-dropdown-body::-webkit-scrollbar,
.editor-preview::-webkit-scrollbar {
    width: 6px;
}

.editor-body::-webkit-scrollbar-track,
.tags-dropdown-body::-webkit-scrollbar-track,
.editor-preview::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.editor-body::-webkit-scrollbar-thumb,
.tags-dropdown-body::-webkit-scrollbar-thumb,
.editor-preview::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.editor-body::-webkit-scrollbar-thumb:hover,
.tags-dropdown-body::-webkit-scrollbar-thumb:hover,
.editor-preview::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* 编辑器底部 */
.editor-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Quill 编辑器样式 */
.quill-editor {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
}

.quill-editor .ql-toolbar {
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    background: var(--bg-secondary);
    padding: 0.5rem;
    position: relative;
    z-index: 10;
    transition: all 0.3s ease;
}

/* 工具栏粘性悬浮样式 */
.quill-editor .ql-toolbar.sticky {
    position: fixed !important;
    top: 0 !important;
    /* 移除固定的 left 和 right，让 JavaScript 控制准确位置 */
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    z-index: 9999 !important;
    margin: 0 !important;
    transform: translateY(0) !important;
    animation: stickyToolbarSlideDown 0.3s ease-out;
}

/* 粘性工具栏滑入动画 */
@keyframes stickyToolbarSlideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 粘性工具栏指示器 */
.quill-editor .ql-toolbar.sticky::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    opacity: 0.7;
}

/* 暗色模式下的工具栏粘性样式 */
[data-theme="dark"] .quill-editor .ql-toolbar.sticky,
.theme-dark .quill-editor .ql-toolbar.sticky {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    background: var(--bg-secondary, #1f2937) !important;
    border-color: var(--border-color, #374151) !important;
}

/* 确保粘性工具栏状态下的对齐和缩进按钮暗色主题样式 */
[data-theme="dark"] .ql-toolbar.sticky .ql-align .ql-picker-options {
    background: var(--bg-secondary, #1f2937) !important;
    border: 1px solid var(--border-color, #374151) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4) !important;
}

/* 确保粘性状态下的对齐选项正确显示 */
.ql-toolbar.sticky .ql-align .ql-picker-options {
    min-width: 140px !important;
    max-height: 200px !important;
    z-index: 10000 !important;
}

.ql-toolbar.sticky .ql-align .ql-picker-item {
    padding: 0.5rem 0.75rem !important;
    min-height: 32px !important;
}

[data-theme="dark"] .ql-toolbar.sticky .ql-align .ql-picker-item::after {
    color: var(--text-primary, #f9fafb) !important;
}

[data-theme="dark"] .ql-toolbar.sticky .ql-align::after,
[data-theme="dark"] .ql-toolbar.sticky .ql-indent[value="-1"]::after,
[data-theme="dark"] .ql-toolbar.sticky .ql-indent[value="+1"]::after {
    background: rgba(30, 30, 30, 0.95) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* 工具栏占位元素 - 防止页面跳动 */
.toolbar-placeholder,
.ql-toolbar-placeholder {
    height: 44px;
    /* 与工具栏高度相同 */
    background: transparent !important;
    display: none;
    visibility: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    pointer-events: none !important;
    font-size: 0 !important;
    line-height: 0 !important;
}

/* 缩小工具栏按钮 */
.quill-editor .ql-toolbar .ql-formats {
    margin-right: 0.75rem;
}

.quill-editor .ql-toolbar button,
.quill-editor .ql-toolbar .ql-picker {
    width: 28px !important;
    height: 28px !important;
    padding: 0.25rem !important;
    border-radius: 4px;
    margin: 0 0.125rem;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative;
}

.quill-editor .ql-toolbar button svg,
.quill-editor .ql-toolbar .ql-picker svg {
    width: 14px !important;
    height: 14px !important;
}

/* 强制统一所有图标大小 */
.ql-toolbar.ql-snow .ql-stroke {
    stroke: var(--text-primary) !important;
    stroke-width: 1.5 !important;
}

.ql-toolbar.ql-snow button::before,
.ql-toolbar.ql-snow .ql-picker::before {
    font-size: 12px !important;
    line-height: 1 !important;
    display: block !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

/* 特殊处理一些可能过大的图标 */
.ql-toolbar.ql-snow .ql-header .ql-picker-label::before,
.ql-toolbar.ql-snow .ql-header .ql-picker-item::before {
    font-size: 10px !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
}

.ql-toolbar.ql-snow .ql-color .ql-picker-label,
.ql-toolbar.ql-snow .ql-background .ql-picker-label {
    width: 14px !important;
    height: 14px !important;
    padding: 2px !important;
    margin: 0 auto !important;
}

/* 确保所有SVG图标大小一致并居中 */
.ql-toolbar.ql-snow svg {
    width: 14px !important;
    height: 14px !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

.quill-editor .ql-toolbar .ql-picker-label {
    font-size: 0.875rem !important;
    padding: 0.25rem 0.5rem !important;
    border-radius: 4px;
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

.quill-editor .ql-toolbar button:hover,
.quill-editor .ql-toolbar .ql-picker:hover {
    background: var(--bg-tertiary);
}

.quill-editor .ql-toolbar button.ql-active,
.quill-editor .ql-toolbar .ql-picker.ql-active {
    background: var(--primary-color);
    color: white;
}

.quill-editor .ql-container {
    border-radius: 0 0 8px 8px;
    font-size: 1rem;
    line-height: 1.6;
}

.quill-editor .ql-editor {
    min-height: 200px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.6;
    border-bottom-left-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
}

/* 编辑器中的段落样式 - 与知识库详情保持一致 */
.quill-editor .ql-editor p {
    margin: 0.25rem 0;
}

.quill-editor .ql-editor p:last-child {
    margin-bottom: 0;
}

/* 只包含br标签的元素统一高度为0.5rem，上下边距为0 */
.ql-editor p:has(> br:only-child),
.ql-editor h1:has(> br:only-child),
.ql-editor h2:has(> br:only-child),
.ql-editor h3:has(> br:only-child),
.ql-editor h4:has(> br:only-child),
.ql-editor h5:has(> br:only-child),
.ql-editor h6:has(> br:only-child),
.ql-editor div:has(> br:only-child),
.quill-editor .ql-editor p:has(> br:only-child),
.quill-editor .ql-editor h1:has(> br:only-child),
.quill-editor .ql-editor h2:has(> br:only-child),
.quill-editor .ql-editor h3:has(> br:only-child),
.quill-editor .ql-editor h4:has(> br:only-child),
.quill-editor .ql-editor h5:has(> br:only-child),
.quill-editor .ql-editor h6:has(> br:only-child),
.quill-editor .ql-editor div:has(> br:only-child) {
    height: 1rem !important;
    line-height: 1rem !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 1rem !important;
    max-height: 1rem !important;
}

@media screen and (max-width: 1023px) {

    /* 只包含br标签的元素统一高度为0.5rem，上下边距为0 */
    .ql-editor p:has(> br:only-child),
    .ql-editor h1:has(> br:only-child),
    .ql-editor h2:has(> br:only-child),
    .ql-editor h3:has(> br:only-child),
    .ql-editor h4:has(> br:only-child),
    .ql-editor h5:has(> br:only-child),
    .ql-editor h6:has(> br:only-child),
    .ql-editor div:has(> br:only-child),
    .quill-editor .ql-editor p:has(> br:only-child),
    .quill-editor .ql-editor h1:has(> br:only-child),
    .quill-editor .ql-editor h2:has(> br:only-child),
    .quill-editor .ql-editor h3:has(> br:only-child),
    .quill-editor .ql-editor h4:has(> br:only-child),
    .quill-editor .ql-editor h5:has(> br:only-child),
    .quill-editor .ql-editor h6:has(> br:only-child),
    .quill-editor .ql-editor div:has(> br:only-child) {
        height: 0.5rem !important;
        line-height: 0.5rem !important;
        margin: 0 !important;
        padding: 0 !important;
        min-height: 0.5rem !important;
        max-height: 0.5rem !important;
    }
}

/* 编辑器中的标题样式 - 与知识库详情保持一致 */
.quill-editor .ql-editor h1,
.quill-editor .ql-editor h2,
.quill-editor .ql-editor h3,
.quill-editor .ql-editor h4,
.quill-editor .ql-editor h5,
.quill-editor .ql-editor h6 {
    margin: 0.25rem 0;
    font-weight: 600;
}

.quill-editor .ql-editor h1 {
    font-size: 2em !important;
}

.quill-editor .ql-editor h2 {
    font-size: 1.6em !important;
}

.quill-editor .ql-editor h3 {
    font-size: 1.25em !important;
}

.quill-editor .ql-editor h4 {
    font-size: 1em !important;
}

.quill-editor .ql-editor h5 {
    font-size: 0.8em !important;
}

.quill-editor .ql-editor h6 {
    font-size: 0.65em !important;
}

.quill-editor .ql-editor h1:first-child,
.quill-editor .ql-editor h2:first-child,
.quill-editor .ql-editor h3:first-child,
.quill-editor .ql-editor h4:first-child,
.quill-editor .ql-editor h5:first-child,
.quill-editor .ql-editor h6:first-child {
    margin-top: 0;
}

/* 编辑器中的列表项样式 - 与知识库详情保持一致 */
.quill-editor .ql-editor li {
    margin-bottom: 0.5rem;
}

.quill-editor .ql-editor li:last-child {
    margin-bottom: 0;
}

.quill-editor .ql-editor.ql-blank::before {
    color: var(--text-tertiary);
    opacity: 0.8;
    font-style: normal;
    font-size: 1rem;
    left: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 深色主题下的Quill编辑器适配 */
[data-theme="dark"] .quill-editor .ql-toolbar {
    border-color: var(--border-color);
    background: var(--bg-secondary);
}

[data-theme="dark"] .quill-editor .ql-toolbar .ql-stroke {
    stroke: var(--text-primary);
}

[data-theme="dark"] .quill-editor .ql-toolbar .ql-fill {
    fill: var(--text-primary);
}

[data-theme="dark"] .quill-editor .ql-toolbar .ql-picker-label {
    color: var(--text-primary);
}

[data-theme="dark"] .quill-editor .ql-toolbar .ql-picker-options {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .quill-editor .ql-toolbar .ql-picker-item {
    color: var(--text-primary);
}

[data-theme="dark"] .quill-editor .ql-toolbar .ql-picker-item:hover {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .quill-editor .ql-container {
    border-color: var(--border-color);
    background: var(--bg-primary);
}

[data-theme="dark"] .quill-editor .ql-editor {
    color: var(--text-primary);
}

[data-theme="dark"] .quill-editor .ql-editor.ql-blank::before {
    color: var(--text-tertiary);
}

/* 更全面的Quill图标尺寸控制 */
.ql-toolbar.ql-snow {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    border: 1px solid var(--border-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
    border-radius: 8px 8px 0 0 !important;
    background: var(--bg-secondary) !important;
    padding: 0.5rem !important;
    box-sizing: border-box !important;
}

.ql-toolbar.ql-snow .ql-formats {
    margin-right: 0.75rem !important;
    display: flex !important;
    align-items: center !important;
}

.ql-toolbar.ql-snow button {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    margin: 0 0.125rem !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    background: transparent !important;
    position: relative !important;
    vertical-align: top !important;
}

.ql-toolbar.ql-snow button * {
    vertical-align: middle !important;
}

.ql-toolbar.ql-snow .ql-picker {
    height: 28px !important;
    margin: 0 0.125rem !important;
    border-radius: 4px !important;
    border: none !important;
    background: transparent !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.ql-toolbar.ql-snow button:hover,
.ql-toolbar.ql-snow .ql-picker:hover {
    background: var(--bg-tertiary) !important;
}

.ql-toolbar.ql-snow button.ql-active,
.ql-toolbar.ql-snow .ql-picker.ql-active {
    background: var(--primary-color) !important;
    color: white !important;
}

.ql-toolbar.ql-snow .ql-stroke {
    stroke: var(--text-primary) !important;
    stroke-width: 2 !important;
}

.ql-toolbar.ql-snow .ql-fill {
    fill: var(--text-primary) !important;
}

.ql-toolbar.ql-snow .ql-picker-label {
    color: var(--text-primary) !important;
    width: auto !important;
    min-width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 0.5rem !important;
    border: none !important;
    background: transparent !important;
    font-size: 11px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    margin: 0 !important;
}

/* 特殊处理header下拉框 */
.ql-toolbar.ql-snow .ql-header .ql-picker-label {
    width: auto !important;
    min-width: 65px !important;
    text-align: left !important;
    justify-content: flex-start !important;
    padding: 0 0.5rem !important;
}

/* 字体大小选择器两边对齐布局 */
.ql-toolbar.ql-snow .ql-size .ql-picker-label {
    width: auto !important;
    min-width: 65px !important;
    padding: 0 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    position: relative !important;
}

/* 为字体大小选择器添加箭头 */
.ql-toolbar.ql-snow .ql-size .ql-picker-label::after {
    content: "▼" !important;
    font-size: 8px !important;
    opacity: 0.6 !important;
    margin-left: 0.25rem !important;
    display: inline-block !important;
    line-height: 1 !important;
    vertical-align: middle !important;
}

/* 为标题选择器添加箭头 */
.ql-toolbar.ql-snow .ql-header .ql-picker-label::after {
    content: "▼" !important;
    font-size: 8px !important;
    opacity: 0.6 !important;
    margin-left: 0.25rem !important;
    display: inline-block !important;
    line-height: 1 !important;
    vertical-align: middle !important;
}

/* 暗色模式下的箭头颜色 */
[data-theme="dark"] .ql-toolbar.ql-snow .ql-size .ql-picker-label::after,
[data-theme="dark"] .ql-toolbar.ql-snow .ql-header .ql-picker-label::after {
    color: var(--text-primary) !important;
    opacity: 0.7 !important;
}

/* 修复下拉箭头位置 */
.ql-toolbar.ql-snow .ql-picker-label::after {
    margin-left: 0.25rem !important;
    font-size: 10px !important;
    vertical-align: middle !important;
    line-height: 1 !important;
    display: inline-block !important;
}

/* 隐藏Quill原生的SVG箭头图标，只保留自定义箭头 */
.ql-toolbar.ql-snow .ql-size svg,
.ql-toolbar.ql-snow .ql-header svg {
    display: none !important;
}

/* 确保选择器内容居中 */
.ql-toolbar.ql-snow .ql-picker-label>* {
    vertical-align: middle !important;
    line-height: 1 !important;
}

/* 专门优化颜色选择器图标 */
.ql-toolbar.ql-snow .ql-color .ql-picker-label,
.ql-toolbar.ql-snow .ql-background .ql-picker-label {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    margin: 0 0.125rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: bold !important;
    line-height: 1 !important;
}

/* 优化所有SVG图标的位置 */
.ql-toolbar.ql-snow svg {
    width: 14px !important;
    height: 14px !important;
    display: block !important;
    margin: auto !important;
}

/* 优化按钮内的伪元素图标 */
.ql-toolbar.ql-snow button::before {
    font-size: 12px !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: auto !important;
}

.ql-container.ql-snow {
    border: 1px solid var(--border-color) !important;
    border-top: none !important;
    border-radius: 0 0 8px 8px !important;
    background: var(--bg-primary) !important;
    font-size: 1.125rem !important;
    line-height: 1.7 !important;
}

/* 夜间模式下的工具栏优化 */
[data-theme="dark"] .ql-toolbar.ql-snow {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .ql-toolbar.ql-snow .ql-stroke {
    stroke: var(--text-primary) !important;
}

[data-theme="dark"] .ql-toolbar.ql-snow .ql-fill {
    fill: var(--text-primary) !important;
}

[data-theme="dark"] .ql-toolbar.ql-snow .ql-picker-label {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .ql-toolbar.ql-snow .ql-picker-options {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* 暗色主题下的对齐和缩进按钮 */
[data-theme="dark"] .ql-toolbar.ql-snow .ql-align .ql-picker-label,
[data-theme="dark"] .ql-toolbar.ql-snow .ql-indent {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .ql-toolbar.ql-snow .ql-align .ql-picker-options {
    background: var(--bg-secondary, #1f2937) !important;
    border: 1px solid var(--border-color, #374151) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .ql-toolbar.ql-snow .ql-align .ql-picker-item {
    color: var(--text-primary, #f9fafb) !important;
    background: transparent !important;
}

[data-theme="dark"] .ql-toolbar.ql-snow .ql-align .ql-picker-item:hover {
    background: var(--bg-tertiary, #374151) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .ql-toolbar.ql-snow .ql-align .ql-picker-item::after {
    color: var(--text-primary, #f9fafb) !important;
}

/* 确保暗色主题下对齐选项也正确显示 */
[data-theme="dark"] .ql-toolbar.ql-snow .ql-align .ql-picker-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

[data-theme="dark"] .ql-toolbar.ql-snow .ql-align .ql-picker-item::before {
    display: none !important;
}

/* 确保暗色主题下对齐按钮的图标正确显示 */
[data-theme="dark"] .ql-toolbar.ql-snow .ql-align .ql-picker-label::before,
[data-theme="dark"] .ql-toolbar.ql-snow .ql-align .ql-picker-item::before {
    color: var(--text-primary, #f9fafb) !important;
}

/* 暗色主题下的所有选择器通用样式 - 确保优先级 */
[data-theme="dark"] .ql-toolbar.ql-snow .ql-picker-options,
[data-theme="dark"] .quill-editor .ql-toolbar .ql-picker-options {
    background: var(--bg-secondary, #1f2937) !important;
    border: 1px solid var(--border-color, #374151) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
    color: var(--text-primary, #f9fafb) !important;
}

/* 排除颜色选择器，避免覆盖颜色块背景 */
[data-theme="dark"] .ql-toolbar.ql-snow .ql-picker-item:not(.ql-color .ql-picker-item):not(.ql-background .ql-picker-item),
[data-theme="dark"] .quill-editor .ql-toolbar .ql-picker-item:not(.ql-color .ql-picker-item):not(.ql-background .ql-picker-item) {
    color: var(--text-primary, #f9fafb) !important;
    background: transparent !important;
}

[data-theme="dark"] .ql-toolbar.ql-snow .ql-picker-item:not(.ql-color .ql-picker-item):not(.ql-background .ql-picker-item):hover,
[data-theme="dark"] .quill-editor .ql-toolbar .ql-picker-item:not(.ql-color .ql-picker-item):not(.ql-background .ql-picker-item):hover {
    background: var(--bg-tertiary, #374151) !important;
    color: #ffffff !important;
}

/* 暗色主题下的工具提示 */
[data-theme="dark"] .ql-toolbar .ql-align::after,
[data-theme="dark"] .ql-toolbar .ql-indent[value="-1"]::after,
[data-theme="dark"] .ql-toolbar .ql-indent[value="+1"]::after {
    background: rgba(30, 30, 30, 0.95) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* 对齐按钮样式优化 */
.ql-toolbar.ql-snow .ql-align .ql-picker-label {
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.ql-toolbar.ql-snow .ql-align .ql-picker-options {
    min-width: 60px !important;
    max-height: 200px !important;
    overflow-y: auto !important;
    padding: 0.25rem 0 0.25rem 0.75rem !important;
}

.ql-toolbar.ql-snow .ql-align .ql-picker-item {
    padding: 0.5rem 0.75rem !important;
    display: block !important;
    min-height: 32px !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
    position: relative !important;
    line-height: 32px !important;
}

/* 移除原有的伪元素样式，避免冲突 */
.ql-toolbar.ql-snow .ql-align .ql-picker-item::before {
    display: none !important;
}

/* 为每个对齐选项添加文本标签 */
.ql-toolbar.ql-snow .ql-align .ql-picker-item::after {
    /* content: "左对齐" !important; */
    font-size: 13px !important;
    color: var(--text-primary, #374151) !important;
    display: block !important;
    width: 100% !important;
    text-align: left !important;
}

/* .ql-toolbar.ql-snow .ql-align .ql-picker-item[data-value="center"]::after {
    content: "居中对齐" !important;
}

.ql-toolbar.ql-snow .ql-align .ql-picker-item[data-value="right"]::after {
    content: "右对齐" !important;
}

.ql-toolbar.ql-snow .ql-align .ql-picker-item[data-value="justify"]::after {
    content: "两端对齐" !important;
} */

/* 确保所有选项都显示 */
.ql-toolbar.ql-snow .ql-align .ql-picker-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 缩进按钮样式优化 */
.ql-toolbar.ql-snow .ql-indent {
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* 确保对齐和缩进按钮在悬浮状态下也正常显示 */
.ql-toolbar.sticky .ql-align,
.ql-toolbar.sticky .ql-indent {
    width: 28px !important;
    height: 28px !important;
}

/* 工具栏按钮提示文本 */
.ql-toolbar .ql-align {
    position: relative;
}

.ql-toolbar .ql-align::after {
    /* content: '对齐'; */
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10000;
}

.ql-toolbar .ql-align:hover::after {
    opacity: 1;
}

.ql-toolbar .ql-indent[value="-1"] {
    position: relative;
}

.ql-toolbar .ql-indent[value="-1"]::after {
    /* content: '减少缩进'; */
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10000;
}

.ql-toolbar .ql-indent[value="-1"]:hover::after {
    opacity: 1;
}

.ql-toolbar .ql-indent[value="+1"] {
    position: relative;
}

.ql-toolbar .ql-indent[value="+1"]::after {
    /* content: '增加缩进'; */
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10000;
}

.ql-toolbar .ql-indent[value="+1"]:hover::after {
    opacity: 1;
}

[data-theme="dark"] .ql-container.ql-snow {
    background: var(--bg-primary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .ql-editor {
    color: var(--text-primary) !important;
}

/* 夜间模式附件列表样式 */
[data-theme="dark"] .attachments-list {
    background: var(--color-surface) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .attachment-item {
    background: var(--color-surface) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .attachment-item:hover {
    background: var(--color-surface-hover) !important;
}

/* 附件上传样式 - v3.2 更新：修复夜间模式样式优先级问题 */
.attachments-upload {
    /* border: 1px solid var(--border-color); */
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-primary);
}

.upload-area {
    padding: 2rem;
    text-align: center;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer !important;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    position: relative;
    z-index: 1;
}

/* 添加调试样式 */
.upload-area:hover {
    background: rgba(59, 130, 246, 0.1) !important;
    border-color: var(--primary-color) !important;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

.upload-area.dragover {
    border-style: solid;
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--text-tertiary);
    transition: color 0.3s ease;
}

.upload-area:hover .upload-icon,
.upload-area.dragover .upload-icon {
    color: var(--primary-color);
}

.upload-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.upload-primary {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.upload-secondary {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.upload-limit {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* 附件列表 - 更新：使用浅灰色分割线 */
.attachments-list {
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    background: var(--bg-primary) !important;
    overflow: hidden;
    padding: 0;
}

.attachments-list:empty {
    display: none;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    background: var(--bg-secondary);
    transition: all 0.2s ease;
}

.attachment-item:last-child {
    border-bottom: none;
}

.attachment-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-hover);
}

.attachment-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: transparent;
}

.attachment-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* 移除原有的文件类型背景色样式 */
.attachment-icon.image,
.attachment-icon.pdf,
.attachment-icon.word,
.attachment-icon.excel,
.attachment-icon.text,
.attachment-icon.archive,
.attachment-icon.other {
    background: transparent;
    color: inherit;
    font-weight: normal;
    font-size: inherit;
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.attachment-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.attachment-size {
    flex-shrink: 0;
}

.attachment-progress {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.attachment-progress-bar {
    height: 100%;
    background: var(--primary-color);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.attachment-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.attachment-remove {
    padding: 0.25rem;
    border: none;
    background: none;
    color: var(--text-tertiary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.attachment-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.attachment-download {
    padding: 0.25rem;
    border: none;
    background: none;
    color: var(--text-tertiary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.attachment-download:hover {
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
}

/* 上传状态 */
.attachment-item.uploading {
    opacity: 0.7;
}

.attachment-item.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.attachment-item.success,
.attachment-item.ready {
    border-color: #e5e7eb;
}

/* 错误提示 */
.upload-error {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    border-left: 3px solid #ef4444;
}

/* 响应式设计 */
@media (max-width: 1023px) {
    .upload-area {
        padding: 1.5rem;
    }

    .upload-icon {
        width: 36px;
        height: 36px;
    }

    .attachment-item {
        padding: 0.5rem;
        gap: 0.75rem;
    }

    .attachment-icon {
        width: 28px;
        height: 28px;
        font-size: 0.625rem;
    }

    .attachment-meta {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 0.5rem;
    }

    .attachment-size {
        text-align: left;
        flex-shrink: 0;
    }
}

/* 专门优化颜色选择器图标 */
.ql-toolbar.ql-snow .ql-color .ql-picker-label,
.ql-toolbar.ql-snow .ql-background .ql-picker-label {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    margin: 0 0.125rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: bold !important;
    line-height: 1 !important;
}

/* 优化所有SVG图标的位置 */
.ql-toolbar.ql-snow svg {
    width: 14px !important;
    height: 14px !important;
    display: block !important;
    margin: auto !important;
}

/* 优化按钮内的伪元素图标 */
.ql-toolbar.ql-snow button::before {
    font-size: 12px !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: auto !important;
}

/* 特别优化字体颜色和背景色按钮内的字符显示 */
.ql-toolbar.ql-snow .ql-color .ql-picker-label::before,
.ql-toolbar.ql-snow .ql-background .ql-picker-label::before {
    content: "A" !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 12px !important;
    font-weight: bold !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    margin: 0 !important;
    vertical-align: middle !important;
}

/* 确保header选择器的文字和图标完美居中 */
.ql-toolbar.ql-snow .ql-header .ql-picker-label {
    display: flex !important;
    align-items: center !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    gap: 0.25rem !important;
}

/* 优化所有picker的默认文字居中 */
.ql-toolbar.ql-snow .ql-picker-label {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    font-size: 11px !important;
    line-height: 1 !important;
    vertical-align: middle !important;
}

/* 确保所有工具栏元素都完美垂直居中 */
.ql-toolbar.ql-snow .ql-formats>* {
    vertical-align: middle !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.ql-toolbar.ql-snow .ql-picker-options {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px !important;
    box-shadow: var(--shadow-md) !important;
}

/* 图片拖拽调整大小样式 */
img[data-drag-resize-enabled] {
    transition: filter 0.2s ease, box-shadow 0.2s ease !important;
}

img[data-drag-resize-enabled]:hover {
    filter: brightness(1.05) !important;
}

img[data-drag-resize-enabled].image-selected {
    filter: brightness(1.1) !important;
}

.resize-handle {
    position: absolute !important;
    width: 10px !important;
    height: 10px !important;
    background: #3b82f6 !important;
    border: 2px solid white !important;
    border-radius: 50% !important;
    z-index: 1000 !important;
    opacity: 0 !important;
    transition: opacity 0.2s ease, transform 0.1s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

.resize-handle:hover {
    transform: scale(1.2) !important;
    background: #2563eb !important;
}

.resize-handle:active {
    transform: scale(1.1) !important;
    background: #1d4ed8 !important;
}

/* 拖拽时的全局样式 */
body.resizing {
    user-select: none !important;
    cursor: inherit !important;
}

body.resizing * {
    pointer-events: none !important;
}

body.resizing .resize-handle {
    pointer-events: auto !important;
}

/* 图片选中状态的视觉反馈 */
img[data-drag-resize-enabled].image-selected {
    box-shadow: 0 0 0 2px #3b82f6, 0 0 8px rgba(59, 130, 246, 0.3) !important;
    filter: brightness(1.1) !important;
}

/* 拖拽时的尺寸信息显示 */
.resize-info {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    padding: 8px 12px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
    z-index: 10000 !important;
    pointer-events: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(4px) !important;
}

/* 拖拽时的光标样式 */
.resize-handle-nw {
    cursor: nw-resize !important;
}

.resize-handle-ne {
    cursor: ne-resize !important;
}

.resize-handle-sw {
    cursor: sw-resize !important;
}

.resize-handle-se {
    cursor: se-resize !important;
}

.resize-handle-n {
    cursor: n-resize !important;
}

.resize-handle-s {
    cursor: s-resize !important;
}

.resize-handle-w {
    cursor: w-resize !important;
}

.resize-handle-e {
    cursor: e-resize !important;
}

/* 选中状态的边框动画 */
img[data-drag-resize-enabled].image-selected {
    animation: shadowPulse 2s infinite !important;
}

@keyframes shadowPulse {

    0%,
    100% {
        box-shadow: 0 0 0 2px #3b82f6, 0 0 8px rgba(59, 130, 246, 0.3);
    }

    50% {
        box-shadow: 0 0 0 2px #60a5fa, 0 0 12px rgba(96, 165, 250, 0.5);
    }
}

/* 响应式调整 */
@media (max-width: 1023px) {
    .resize-handle {
        width: 18px !important;
        height: 18px !important;
        border-width: 3px !important;
        opacity: 0.9 !important;
    }

    .resize-info {
        top: 50px !important;
        right: 10px !important;
        font-size: 14px !important;
        padding: 10px 15px !important;
    }

    /* 移动端图片选择状态更明显 */
    img[data-drag-resize-enabled].image-selected {
        box-shadow: 0 0 0 3px #3b82f6 !important;
    }

    /* 移动端触摸优化 */
    img[data-drag-resize-enabled] {
        touch-action: manipulation;
    }

    /* 移动端调整手柄动画优化 */
    .resize-handle {
        transition: opacity 0.3s ease, transform 0.2s ease;
    }

    .resize-handle:active {
        transform: scale(1.2);
        opacity: 1 !important;
    }
}

/* 夜间模式下的Quill颜色选择器修复 - 基于todo_list成功实现 */
[data-theme="dark"] .ql-toolbar.ql-snow .ql-picker-label,
[data-theme="dark"] .ql-toolbar.ql-snow .ql-picker-options {
    /* background-color: #1f2937 !important; */
    color: #e5e7eb !important;
}

/* 确保工具栏图标在夜间模式下可见 */
[data-theme="dark"] .ql-toolbar.ql-snow .ql-stroke {
    stroke: #e5e7eb !important;
}

[data-theme="dark"] .ql-toolbar.ql-snow .ql-fill {
    fill: #e5e7eb !important;
}

[data-theme="dark"] .ql-toolbar.ql-snow .ql-picker {
    color: #e5e7eb !important;
}

/* 确保颜色选择器的颜色块正确显示 */
[data-theme="dark"] .ql-toolbar.ql-snow .ql-color .ql-picker-item,
[data-theme="dark"] .ql-toolbar.ql-snow .ql-background .ql-picker-item {
    /* 不设置背景色，让Quill自己处理颜色块 */
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 2px !important;
    width: 16px !important;
    height: 16px !important;
    margin: 2px !important;
    display: inline-block !important;
}

[data-theme="dark"] .ql-toolbar.ql-snow .ql-color .ql-picker-item:hover,
[data-theme="dark"] .ql-toolbar.ql-snow .ql-background .ql-picker-item:hover {
    border-color: rgba(255, 255, 255, 0.5) !important;
    transform: scale(1.1) !important;
}



/* 编辑器中代码块基础样式 - 统一使用夜间模式样式 */
.quill-editor .ql-editor .ql-code-block,
.ql-editor .ql-code-block,
.editor-code-block,
.editor-content-code-block {
    /* 移除min-height避免抖动 */
    box-sizing: border-box !important;
    padding: 0.25rem !important;
    /* 适中的内边距 */
    margin: 0 !important;
    /* 适中的外边距 */
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
    font-size: 0.75rem !important;
    line-height: 1.4 !important;
    /* 稍微紧凑的行高 */
    border-radius: 4px !important;
    background-color: #2d3748 !important;
    /* 统一使用深色背景 */
    color: #c9d1d9 !important;
    /* 统一使用浅色文字 */
    border: none !important;
    /* 移除边框 */
    white-space: pre-wrap !important;
    overflow: visible !important;
    /* 改为visible避免不必要的滚动 */
    /* 确保文本内容可见 */
    opacity: 1 !important;
    visibility: visible !important;
    /* 防止高度抖动 */
    height: auto !important;
    max-height: none !important;
}

/* 编辑器模式下的代码块特殊处理 */
.ql-editor .editor-code-block,
.ql-editor .editor-content-code-block {
    /* 确保编辑器模式下的代码块内容可见且可编辑 */
    display: block !important;
    /* 移除min-height避免抖动 */

    /* 保持文本的可编辑性 */
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;

    /* 确保焦点样式 */
    outline: none !important;

    /* 防止内容被隐藏 */
    overflow: visible !important;
    text-overflow: visible !important;

    /* 保持简洁的尺寸 */
    position: static !important;
}

/* 编辑器中代码块容器样式 - 统一使用夜间模式样式 */
.quill-editor .ql-editor .ql-code-block-container,
.ql-editor .ql-code-block-container {
    /* 移除min-height避免抖动 */
    box-sizing: border-box !important;
    padding: 0.75rem !important;
    /* 容器适中的内边距 */
    margin: 0.25rem 0 !important;
    /* 适中的外边距 */
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
    /* 与代码块保持一致的行高 */
    border-radius: 4px !important;
    background-color: #2d3748 !important;
    /* 统一使用深色背景 */
    color: #c9d1d9 !important;
    /* 统一使用浅色文字 */
    border: none !important;
    /* 移除边框 */
    white-space: pre-wrap !important;
    overflow: visible !important;
    /* 改为visible避免不必要的滚动 */
    /* 防止高度抖动 */
    height: auto !important;
    max-height: none !important;
    /* font-weight: lighter; */
    /* 细体 */
    font-style: italic;
    /* 斜体 */
}

/* 暗色主题下的代码块基础样式 - 现在所有模式都使用统一样式，此处保留以防覆盖 */
[data-theme="dark"] .quill-editor .ql-editor .ql-code-block,
[data-theme="dark"] .quill-editor .ql-editor .ql-code-block-container,
[data-theme="dark"] .ql-editor .ql-code-block,
[data-theme="dark"] .ql-editor .ql-code-block-container {
    background-color: #2d3748 !important;
    /* 与基础样式保持一致 */
    color: #c9d1d9 !important;
    /* 与基础样式保持一致 */
}

/* 移动端适配 */
@media (max-width: 1023px) {

    .quill-editor .ql-editor .ql-code-block,
    .ql-editor .ql-code-block,
    .editor-code-block,
    .editor-content-code-block {
        font-size: 0.75rem !important;
        padding: 0.375rem !important;
        /* 移动端稍小的内边距 */
        margin: 0.125rem 0 !important;
        /* 移动端更小的外边距 */
        line-height: 1.3 !important;
        /* 移动端更紧凑的行高 */
    }

    .quill-editor .ql-editor .ql-code-block-container,
    .ql-editor .ql-code-block-container {
        font-size: 0.75rem !important;
        padding: 0.5rem !important;
        /* 移动端容器适中的内边距 */
        margin: 0.125rem 0 !important;
    }
}

/* 强制移除所有blockquote的上下边距 */
.ql-editor blockquote,
.ql-container blockquote,
.quill-editor blockquote,
.knowledge-content blockquote,
blockquote {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* 确保编辑器中的blockquote没有边距 */
.ql-snow .ql-editor blockquote,
.ql-snow.ql-editor blockquote {
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* 编辑器中的blockquote基础样式 - 与知识库详情页面保持一致 */
.ql-editor blockquote,
.quill-editor blockquote {
    padding: 1rem;
    background: rgba(156, 163, 175, 0.05);
    border-left: 3px solid #c4c9d0;
    border-radius: 4px;
    color: var(--text-secondary, #6b7280);
    font-style: italic;
    font-size: 0.875rem;
    line-height: 1.6;
    position: relative;
}

/* 编辑器中的blockquote合并样式 - 与知识库详情页面保持一致 */

/* 连续的引用块合并样式 */
.ql-editor blockquote+blockquote,
.quill-editor blockquote+blockquote {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    padding-top: 0.2rem;
}

/* 浏览器支持:has()的情况 */
@supports selector(:has(+ *)) {

    .ql-editor blockquote:has(+ blockquote),
    .quill-editor blockquote:has(+ blockquote) {
        margin-bottom: 0;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        padding-bottom: 0.2rem;
    }
}

/* 浏览器不支持:has()的情况，使用JS类名控制 */
.ql-editor .blockquote-group,
.quill-editor .blockquote-group {
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    background: rgba(156, 163, 175, 0.1);
    border-left: 3px solid var(--primary-color, #3b82f6);
    border-radius: 4px;
    overflow: hidden;
}

.ql-editor .blockquote-group blockquote,
.quill-editor .blockquote-group blockquote {
    margin: 0;
    border: none;
    background: transparent;
    border-radius: 0;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.ql-editor .blockquote-group blockquote+blockquote,
.quill-editor .blockquote-group blockquote+blockquote {
    margin-top: 0;
    padding-top: 0.75rem;
}

/* 编辑器中blockquote的暗色主题支持 */
[data-theme="dark"] .ql-editor blockquote,
[data-theme="dark"] .quill-editor blockquote {
    background: rgba(75, 85, 99, 0.2);
}

[data-theme="dark"] .ql-editor .blockquote-group,
[data-theme="dark"] .quill-editor .blockquote-group {
    background: rgba(75, 85, 99, 0.2);
    border-left-color: var(--primary-color, #3b82f6);
}

/* 编辑器标题元素创建新的计数器作用域 */
.ql-editor h1,
.ql-editor h2,
.ql-editor h3,
.ql-editor h4,
.ql-editor h5,
.ql-editor h6 {
    counter-reset: level1;
}

/* 编辑器重置所有列表样式 */
.ql-editor ol,
.ql-editor ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 编辑器一级有序列表 - 重置所有下级计数器 */
.ql-editor li[data-list="ordered"]:not(.ql-indent-1):not(.ql-indent-2):not(.ql-indent-3):not(.ql-indent-4):not(.ql-indent-5) {
    counter-increment: level1;
    counter-reset: level2 level3 level4 level5 level6;
    /* 每个一级项都重置所有下级计数器 */
    display: list-item !important;
    list-style: none !important;
    margin-left: 2em !important;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.ql-editor li[data-list="ordered"]:not(.ql-indent-1):not(.ql-indent-2):not(.ql-indent-3):not(.ql-indent-4):not(.ql-indent-5)::before {
    content: counter(level1) ". ";
    font-weight: inherit;
    margin-left: -1.5em;
    display: inline-block;
    width: 1.5em;
}

/* 编辑器二级有序列表 - 重置所有下级计数器 */
.ql-editor li[data-list="ordered"].ql-indent-1 {
    counter-increment: level2 !important;
    counter-reset: level3 level4 level5 level6 !important;
    /* 每个二级项都重置所有下级计数器 */
    display: list-item !important;
    list-style: none !important;
    margin-left: 1em !important;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.ql-editor li[data-list="ordered"].ql-indent-1::before {
    content: counter(level2, lower-alpha) ". ";
    font-weight: inherit;
    margin-left: -2em;
    display: inline-block;
    width: 2em;
}

/* 编辑器三级有序列表 - 重置所有下级计数器 */
.ql-editor li[data-list="ordered"].ql-indent-2 {
    counter-increment: level3 !important;
    counter-reset: level4 level5 level6 !important;
    /* 每个三级项都重置所有下级计数器 */
    display: list-item !important;
    list-style: none !important;
    margin-left: 0em !important;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.ql-editor li[data-list="ordered"].ql-indent-2::before {
    content: counter(level3, lower-roman) ". ";
    font-weight: inherit;
    margin-left: -2em;
    display: inline-block;
    width: 2em;
}

/* 编辑器四级有序列表 - 重置所有下级计数器 */
.ql-editor li[data-list="ordered"].ql-indent-3 {
    counter-increment: level4 !important;
    counter-reset: level5 level6 !important;
    /* 每个四级项都重置所有下级计数器 */
    display: list-item !important;
    list-style: none !important;
    margin-left: 8em !important;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.ql-editor li[data-list="ordered"].ql-indent-3::before {
    content: counter(level4, upper-alpha) ". ";
    font-weight: inherit;
    margin-left: -2em;
    display: inline-block;
    width: 2em;
}

/* 关键修复：强制覆盖浏览器默认的ol计数器重置行为 */
.ql-editor ol {
    counter-reset: none !important;
}

/* 只有第一个ol才初始化计数器（无h标签场景） */
.ql-editor ol:first-of-type {
    counter-reset: level1 !important;
}

/* h标签后的ol重置计数器（有h标签场景） */
.ql-editor h1+ol,
.ql-editor h2+ol,
.ql-editor h3+ol,
.ql-editor h4+ol,
.ql-editor h5+ol,
.ql-editor h6+ol,
.ql-editor h1+*+ol,
.ql-editor h2+*+ol,
.ql-editor h3+*+ol,
.ql-editor h4+*+ol,
.ql-editor h5+*+ol,
.ql-editor h6+*+ol {
    counter-reset: level1 !important;
}

/* 重置所有 Quill 默认的 .ql-ui:before 样式，防止与自定义样式冲突 */
.ql-editor li[data-list="ordered"]>.ql-ui:before {
    content: none !important;
}

/* 重置所有 Quill 默认的无序列表 .ql-ui:before 样式，防止重复显示 */
.ql-editor li[data-list="bullet"]>.ql-ui:before {
    content: none !important;
}

/* 编辑器无序列表样式 - 与有序列表保持完全一致的对齐 */
.ql-editor li[data-list="bullet"] {
    display: list-item !important;
    list-style: none !important;
    list-style-type: none !important;
    list-style-position: outside !important;
    margin-left: 2em !important;
    margin-bottom: 0.5rem;
    line-height: 1.6;
    position: relative;
}

/* 确保移除所有可能的默认项目符号和Quill的默认样式 */
.ql-editor li[data-list="bullet"] * {
    list-style: none !important;
}

/* 移除可能的Quill默认伪元素 */
.ql-editor li[data-list="bullet"] .ql-ui {
    display: none !important;
}

.ql-editor li[data-list="bullet"]::before {
    content: "•";
    font-weight: inherit;
    margin-left: -1.5em;
    display: inline-block;
    width: 1.5em;
}

.ql-editor li[data-list="bullet"].ql-indent-1 {
    margin-left: 1em !important;
}

.ql-editor li[data-list="bullet"].ql-indent-1::before {
    content: "◦";
    font-weight: inherit;
    margin-left: -2em;
    display: inline-block;
    width: 2em;
}

.ql-editor li[data-list="bullet"].ql-indent-2 {
    margin-left: 0em !important;
}

.ql-editor li[data-list="bullet"].ql-indent-2::before {
    content: "▪";
    font-weight: inherit;
    margin-left: -2em;
    display: inline-block;
    width: 2em;
}

.ql-editor li[data-list="bullet"].ql-indent-3 {
    margin-left: 8em !important;
}

.ql-editor li[data-list="bullet"].ql-indent-3::before {
    content: "•";
    font-weight: inherit;
    margin-left: -2em;
    display: inline-block;
    width: 2em;
}

/* 删除编辑器中列表的下边距 */
.ql-editor ol,
.ql-editor ul,
.quill-editor ol,
.quill-editor ul {
    margin-bottom: 0 !important;
}

/* 移动端响应式样式 */
@media (max-width: 1023px) {

    .ql-editor blockquote,
    .quill-editor blockquote {
        padding: 0.75rem;
        font-size: 0.875rem;
    }

    .ql-editor .blockquote-group blockquote,
    .quill-editor .blockquote-group blockquote {
        padding: 0.75rem 1rem;
    }

    /* 移动端有序列表样式优化 */
    .ql-editor li[data-list="ordered"]:not(.ql-indent-1):not(.ql-indent-2):not(.ql-indent-3):not(.ql-indent-4):not(.ql-indent-5) {
        margin-left: 1.5em !important;
    }

    .ql-editor li[data-list="ordered"]:not(.ql-indent-1):not(.ql-indent-2):not(.ql-indent-3):not(.ql-indent-4):not(.ql-indent-5)::before {
        margin-left: -1.5em;
        width: 1.5em;
    }

    .ql-editor li[data-list="ordered"].ql-indent-1 {
        margin-left: 3em !important;
    }

    .ql-editor li[data-list="ordered"].ql-indent-1::before {
        margin-left: -1.5em;
        width: 1.5em;
    }

    .ql-editor li[data-list="ordered"].ql-indent-2 {
        margin-left: 1.5em !important;
    }

    .ql-editor li[data-list="ordered"].ql-indent-2::before {
        margin-left: -1.5em;
        width: 1.5em;
    }

    .ql-editor li[data-list="ordered"].ql-indent-3 {
        margin-left: 6em !important;
    }

    .ql-editor li[data-list="ordered"].ql-indent-3::before {
        margin-left: -1.5em;
        width: 1.5em;
    }

    /* 移动端无序列表样式优化 - 与有序列表保持一致对齐 */
    .ql-editor li[data-list="bullet"] {
        margin-left: 1.5em !important;
    }

    .ql-editor li[data-list="bullet"]::before {
        margin-left: -1.5em;
        width: 1.5em;
    }

    .ql-editor li[data-list="bullet"].ql-indent-1 {
        margin-left: 3em !important;
    }

    .ql-editor li[data-list="bullet"].ql-indent-1::before {
        margin-left: -1.5em;
        width: 1.5em;
    }

    .ql-editor li[data-list="bullet"].ql-indent-2 {
        margin-left: 1.5em !important;
    }

    .ql-editor li[data-list="bullet"].ql-indent-2::before {
        margin-left: -1.5em;
        width: 1.5em;
    }

    .ql-editor li[data-list="bullet"].ql-indent-3 {
        margin-left: 6em !important;
    }

    .ql-editor li[data-list="bullet"].ql-indent-3::before {
        margin-left: -1.5em;
        width: 1.5em;
    }
}

[data-theme="dark"] .quill-editor .ql-container {
    background: var(--bg-primary) !important;
    border-color: var(--border-color) !important;
}

/* 自定义工具栏按钮样式 - 撤销/重做/Markdown转换 */
.ql-toolbar.ql-snow .ql-custom-buttons {
    margin-right: 0.75rem !important;
    padding-right: 0.75rem !important;
    border-right: 1px solid var(--border-color) !important;
}

.ql-toolbar.ql-snow .ql-undo,
.ql-toolbar.ql-snow .ql-redo,
.ql-toolbar.ql-snow .ql-markdown {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    margin: 0 0.125rem !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease, opacity 0.2s ease !important;
}

.ql-toolbar.ql-snow .ql-undo i,
.ql-toolbar.ql-snow .ql-redo i,
.ql-toolbar.ql-snow .ql-markdown i {
    font-size: 16px !important;
    color: var(--text-primary) !important;
    line-height: 1 !important;
}

.ql-toolbar.ql-snow .ql-undo:hover,
.ql-toolbar.ql-snow .ql-redo:hover,
.ql-toolbar.ql-snow .ql-markdown:hover {
    background: var(--bg-tertiary) !important;
}

.ql-toolbar.ql-snow .ql-undo:active,
.ql-toolbar.ql-snow .ql-redo:active,
.ql-toolbar.ql-snow .ql-markdown:active {
    background: var(--primary-color) !important;
}

.ql-toolbar.ql-snow .ql-undo:active i,
.ql-toolbar.ql-snow .ql-redo:active i,
.ql-toolbar.ql-snow .ql-markdown:active i {
    color: white !important;
}

/* 禁用状态样式 */
.ql-toolbar.ql-snow .ql-undo.ql-disabled,
.ql-toolbar.ql-snow .ql-redo.ql-disabled,
.ql-toolbar.ql-snow .ql-undo[disabled],
.ql-toolbar.ql-snow .ql-redo[disabled] {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

.ql-toolbar.ql-snow .ql-undo.ql-disabled i,
.ql-toolbar.ql-snow .ql-redo.ql-disabled i,
.ql-toolbar.ql-snow .ql-undo[disabled] i,
.ql-toolbar.ql-snow .ql-redo[disabled] i {
    color: var(--text-tertiary) !important;
}

/* 暗色主题适配 */
[data-theme="dark"] .ql-toolbar.ql-snow .ql-custom-buttons {
    border-right-color: rgba(255, 255, 255, 0.2) !important;
}

[data-theme="dark"] .ql-toolbar.ql-snow .ql-undo i,
[data-theme="dark"] .ql-toolbar.ql-snow .ql-redo i,
[data-theme="dark"] .ql-toolbar.ql-snow .ql-markdown i {
    color: var(--text-primary, #f9fafb) !important;
}

/* 粘性工具栏中的自定义按钮样式 */
.ql-toolbar.sticky .ql-custom-buttons {
    border-right-color: var(--border-color) !important;
}

.ql-toolbar.sticky .ql-undo,
.ql-toolbar.sticky .ql-redo,
.ql-toolbar.sticky .ql-markdown {
    background: transparent !important;
}

.ql-toolbar.sticky .ql-undo:hover,
.ql-toolbar.sticky .ql-redo:hover,
.ql-toolbar.sticky .ql-markdown:hover {
    background: var(--bg-tertiary) !important;
}