/**
 * 前端文章编辑器样式
 * 
 * @package QiMeng
 * @since 1.0.0
 */

/* 编辑器容器 */
.qm-post-editor {
    width: 100%;
    max-width: var(--qm-site-max-width, 1200px);
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
    position: relative;
    z-index: 1;
}

.qm-editor-container {
    width: 100%;
    max-width: var(--qm-site-max-width, 1200px);
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
}

.qm-editor-page-main {
    min-height: 100vh;
    background: transparent;
    position: relative;
    z-index: 10;
    padding-bottom: 2rem;
    overflow-x: hidden;
}

/* 桌面端需要上边距，和其他页面保持一致 */
@media (min-width: 992px) {
    .qm-editor-page-main {
        padding-top: 140px !important;
    }
}

@media (max-width: 991.98px) {
    .qm-editor-page-main {
        padding-top: 0 !important;
    }
}

.qm-post-editor-wrapper {
    margin: 0;
    align-items: flex-start;
}

/* 编辑器主区域 */
.qm-editor-main {
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0.75rem;
    margin: 0;
    min-width: 0;
}

/* 编辑器头部 */
.qm-editor-header {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

.qm-editor-header-main {
    position: relative;
}

.qm-post-title-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 1.5rem;
    font-weight: 600;
    padding: 0.5rem 0;
    background: transparent;
    color: #1a1a1a;
}

.qm-post-title-input::placeholder {
    color: #999;
}

.qm-title-counter {
    position: absolute;
    right: 0;
    top: 0.5rem;
    font-size: 0.875rem;
    color: #666;
}

.qm-title-count {
    color: #2563eb;
    font-weight: 600;
}

/* 编辑器内容区 */
.qm-editor-content {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: visible;
    position: relative;
    z-index: 1;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

.qm-import-progress {
    position: fixed;
    top: 20px;
    right: 20px;
    width: min(360px, calc(100vw - 32px));
    padding: 14px 16px 15px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.14), 0 6px 18px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 100000;
    opacity: 0;
    transform: translate3d(0, -12px, 0);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.qm-import-progress.is-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.qm-import-progress__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.qm-import-progress__meta {
    min-width: 0;
    flex: 1;
}

.qm-import-progress__title {
    font-size: 14px;
    line-height: 1.35;
    font-weight: 600;
    color: #0f172a;
}

.qm-import-progress__detail {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.5;
    color: #64748b;
    word-break: break-word;
}

.qm-import-progress__percent {
    flex-shrink: 0;
    min-width: 42px;
    text-align: right;
    font-size: 18px;
    line-height: 1;
    font-weight: 700;
    color: #2563eb;
}

.qm-import-progress__bar {
    margin-top: 12px;
    position: relative;
    width: 100%;
    height: 7px;
    border-radius: 999px;
    overflow: hidden;
    background: #e2e8f0;
}

.qm-import-progress__bar-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb 0%, #7c3aed 100%);
    transition: width 0.22s ease;
}

.qm-import-progress.is-complete .qm-import-progress__percent {
    color: #059669;
}

.qm-import-progress.is-complete .qm-import-progress__bar-fill {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.qm-import-progress.is-error .qm-import-progress__percent {
    color: #dc2626;
}

.qm-import-progress.is-error .qm-import-progress__bar-fill {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.qm-editor-container {
    display: flex;
    flex-direction: column;
}

/* 工具栏 */
.qm-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
    position: relative;
}

.qm-toolbar-select {
    padding: 0.375rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    font-size: 0.875rem;
    cursor: pointer;
    outline: none;
}

.qm-toolbar-select:hover {
    border-color: #9ca3af;
}

.qm-toolbar-divider {
    width: 1px;
    height: 1.5rem;
    background: #d1d5db;
    margin: 0 0.25rem;
}

.qm-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    background: transparent;
    color: #4b5563;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.qm-toolbar-btn:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.qm-toolbar-btn.active {
    background: #2563eb;
    color: #fff;
}

.qm-toolbar-more {
    display: none;
}

.qm-vip-discount-hint {
    display: block;
    margin-bottom: 10px;
}

.qm-vip-discount-box {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 4px;
    margin-top: 10px;
    border: 1px solid #e5e7eb;
}

.qm-vip-discount-title {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    color: #111827;
}

.qm-vip-discount-title.qm-vip-discount-title-sm {
    margin-bottom: 8px;
}

.qm-vip-discount-row {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.qm-vip-discount-label {
    min-width: 80px;
    font-size: 13px;
    color: #111827;
}

.qm-vip-discount-suffix {
    color: #666;
    font-size: 12px;
}

.qm-settings-desc.qm-vip-discount-desc {
    display: block;
    margin-top: 8px;
    color: #666;
}

.qm-vip-discount-levels {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #ddd;
}

html.dark .qm-vip-discount-box,
.dark .qm-vip-discount-box {
    background: #111827;
    border-color: #374151;
}

html.dark .qm-vip-discount-title,
.dark .qm-vip-discount-title,
html.dark .qm-vip-discount-label,
.dark .qm-vip-discount-label {
    color: #e5e7eb;
}

html.dark .qm-vip-discount-suffix,
.dark .qm-vip-discount-suffix,
html.dark .qm-settings-desc.qm-vip-discount-desc,
.dark .qm-settings-desc.qm-vip-discount-desc {
    color: #9ca3af;
}

html.dark .qm-vip-discount-levels,
.dark .qm-vip-discount-levels {
    border-top-color: #374151;
}

@media (max-width: 767.98px) {
    .qm-editor-toolbar {
        flex-wrap: wrap;
        overflow-x: visible;
        gap: 0.25rem;
        padding: 0.375rem 0.5rem;
    }

    .qm-toolbar-divider {
        flex: 0 0 auto;
        margin: 0 0.125rem;
    }

    .qm-toolbar-select {
        flex: 0 0 auto;
        padding: 0.25rem 0.5rem;
        font-size: 0.8125rem;
    }

    .qm-toolbar-btn {
        flex: 0 0 auto;
        width: 1.875rem;
        height: 1.875rem;
    }

    .qm-toolbar-more {
        display: none;
    }
}

.qm-toolbar-more-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    z-index: 1000;
    margin-top: 0.25rem;
}

.qm-toolbar-more-menu.show {
    display: block;
}

.qm-toolbar-more-menu .qm-toolbar-btn {
    width: 100%;
    height: auto;
    padding: 0.5rem;
    justify-content: flex-start;
    gap: 0.5rem;
}

.qm-toolbar-more-menu .qm-toolbar-btn span {
    font-size: 0.875rem;
}

/* 编辑器主体 */
.qm-editor-body {
    min-height: 400px;
    padding: 0.75rem;
    outline: none;
    font-size: 1rem;
    line-height: 1.75;
    color: #1a1a1a;
    background: #fff;
    min-width: 0;
    overflow-x: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.qm-editor-body > * {
    max-width: 100%;
}

.qm-editor-body p,
.qm-editor-body div,
.qm-editor-body h1,
.qm-editor-body h2,
.qm-editor-body h3,
.qm-editor-body h4,
.qm-editor-body h5,
.qm-editor-body h6,
.qm-editor-body blockquote,
.qm-editor-body ul,
.qm-editor-body ol,
.qm-editor-body li {
    max-width: 100%;
    box-sizing: border-box;
}

.qm-editor-body p,
.qm-editor-body li {
    text-indent: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.qm-editor-body:empty:before {
    content: attr(data-placeholder);
    color: #9ca3af;
    pointer-events: none;
}

.qm-editor-body:focus {
    outline: none;
}

.qm-editor-body.qm-drag-over {
    background: #f0f4ff;
    border: 2px dashed #2563eb;
}

/* 上传占位符 */
.qm-upload-placeholder {
    display: inline-block;
    margin: 0.5rem 0;
    padding: 1rem;
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 4px;
    min-width: 200px;
}

.qm-upload-placeholder-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.qm-upload-placeholder-content i {
    font-size: 1.25rem;
    color: #2563eb;
}

.qm-editor-body img {
    display: block;
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    max-height: min(68vh, 820px);
    object-fit: contain;
    border-radius: 4px;
    margin: 1rem auto;
}

.qm-editor-body figure,
.qm-editor-body .wp-caption,
.qm-editor-body .wp-block-image {
    max-width: 100% !important;
    margin-left: auto;
    margin-right: auto;
}

.qm-editor-body .qm-image-wrapper,
.qm-editor-body .qm-attachment-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 1rem auto;
    box-sizing: border-box;
}

.qm-editor-body .qm-image-wrapper img {
    margin: 0;
}

.qm-editor-body .qm-image-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
    border-radius: 12px;
}

.qm-editor-body .qm-attachment-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

/* 视频容器样式 */
.qm-editor-body .qm-video-wrapper,
.qm-editor-body .qm-table-wrapper,
.qm-editor-body .qm-info-box,
.qm-editor-body .qm-warning-box,
.qm-editor-body .qm-collapse-block,
.qm-editor-body .qm-paid-content,
.qm-editor-body .qm-hr-wrapper,
.qm-editor-body blockquote,
.qm-editor-body figure,
.qm-editor-body .wp-caption,
.qm-editor-body .wp-block-image {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0;
    box-sizing: border-box;
}

.qm-editor-body .qm-video-wrapper video {
    max-width: 100% !important;
    width: 100% !important;
    height: auto;
    max-height: 500px;
    border-radius: 12px;
    display: block;
}

.qm-editor-body .qm-video-wrapper iframe {
    max-width: 100% !important;
    width: 100% !important;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    border: none;
    display: block;
}

.qm-editor-body .qm-video-wrapper,
.qm-editor-body .qm-table-wrapper {
    overflow: hidden;
    border-radius: 12px;
}

.qm-editor-body .qm-video-wrapper > :not(.qm-block-remove) {
    max-width: 100% !important;
    box-sizing: border-box;
}

.qm-editor-body .qm-video-wrapper embed,
.qm-editor-body .qm-video-wrapper object {
    max-width: 100% !important;
    width: 100% !important;
    display: block;
}

/* 视频删除按钮 */
.qm-editor-body .qm-block-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
    z-index: 10;
}

.qm-editor-body .qm-video-wrapper:hover .qm-block-remove,
.qm-editor-body .qm-image-wrapper:hover .qm-block-remove,
.qm-editor-body .qm-table-wrapper:hover .qm-block-remove,
.qm-editor-body .qm-attachment-wrapper:hover .qm-block-remove,
.qm-editor-body .qm-info-box:hover .qm-block-remove,
.qm-editor-body .qm-warning-box:hover .qm-block-remove,
.qm-editor-body .qm-collapse-block:hover .qm-block-remove,
.qm-editor-body .qm-paid-content:hover .qm-block-remove,
.qm-editor-body .qm-hr-wrapper:hover .qm-block-remove,
.qm-editor-body blockquote:hover .qm-block-remove,
.qm-editor-body figure:hover .qm-block-remove,
.qm-editor-body .wp-caption:hover .qm-block-remove,
.qm-editor-body .wp-block-image:hover .qm-block-remove {
    opacity: 1;
}

.qm-editor-body .qm-block-remove:hover {
    background: rgba(239, 68, 68, 0.9);
    transform: scale(1.1);
}

.qm-editor-body .qm-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    color: #374151;
    text-decoration: none;
}

/* 编辑器内表格样式 */
.qm-editor-body table,
.qm-editor-body .qm-content-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    border: 1px solid #d1d5db;
}

.qm-editor-body .qm-table-wrapper table,
.qm-editor-body .qm-content-table {
    margin: 0;
}

.qm-editor-body .qm-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.qm-editor-body table th,
.qm-editor-body table td,
.qm-editor-body .qm-content-table th,
.qm-editor-body .qm-content-table td {
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.qm-editor-body table th,
.qm-editor-body .qm-content-table th {
    background: #f9fafb;
    font-weight: 600;
}

.qm-editor-body table tbody tr:nth-child(even),
.qm-editor-body .qm-content-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.qm-editor-body table tbody tr:hover,
.qm-editor-body .qm-content-table tbody tr:hover {
    background: #f3f4f6;
}

.qm-editor-body p {
    margin: 0.75rem 0;
}

.qm-editor-body h1,
.qm-editor-body h2,
.qm-editor-body h3,
.qm-editor-body h4,
.qm-editor-body h5,
.qm-editor-body h6 {
    margin: 1.5rem 0 1rem;
    font-weight: 600;
    line-height: 1.3;
}

.qm-editor-body h1 {
    font-size: 2rem;
}

.qm-editor-body h2 {
    font-size: 1.75rem;
}

.qm-editor-body h3 {
    font-size: 1.5rem;
}

.qm-editor-body ul,
.qm-editor-body ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.qm-editor-body blockquote {
    margin: 1rem 0;
    padding: 1rem 3rem 1rem 1.5rem;
    border-left: 4px solid #2563eb;
    background: #f3f4f6;
    border-radius: 4px;
}

.qm-editor-body .qm-hr-wrapper hr {
    margin: 0;
}

.qm-editor-body code {
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.875em;
    font-family: 'Courier New', monospace;
}

.qm-editor-body pre {
    background: #1f2937;
    color: #fff;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1rem 0;
}

.qm-editor-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

/* 编辑器侧边栏 */
.qm-editor-sidebar-left,
.qm-editor-sidebar-right {
    padding: 0;
    margin: 0;
    min-width: 0;
}

.qm-editor-sidebar {
    background: #fff;
    border-radius: 16px;
    padding: 0.75rem;
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 112px);
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

.qm-editor-sidebar-left {
    border-right: none;
}

.qm-editor-sidebar-right {
    border-left: none;
}

.qm-editor-main {
    border-left: none;
    border-right: none;
}

.qm-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.qm-settings-section {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.qm-settings-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.qm-settings-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: #1a1a1a;
}

.qm-settings-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #374151;
}

.qm-settings-desc {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* 分类列表 */
.qm-category-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 150px;
    overflow-y: auto;
    margin-top: 0.5rem;
}

.qm-category-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.qm-category-item:hover {
    background: #f3f4f6;
}

.qm-category-checkbox {
    margin: 0;
    cursor: pointer;
}

/* 标签输入 */
.qm-tags-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.qm-tags-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.qm-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.qm-tag-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 1rem;
    font-size: 0.875rem;
}

.qm-tag-remove {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: rgba(55, 48, 163, 0.2);
    transition: background 0.2s;
}

.qm-tag-remove:hover {
    background: rgba(55, 48, 163, 0.3);
}

/* 特色图片 */
.qm-featured-image {
    width: 100%;
}

.qm-featured-image-preview {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 2px dashed #d1d5db;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s;
    overflow: hidden;
    background: #f9fafb;
}

.qm-featured-image-preview:hover {
    border-color: #2563eb;
}

.qm-featured-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.qm-featured-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    text-align: center;
    padding: 2rem;
}

.qm-featured-image-placeholder i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.qm-featured-image-placeholder p {
    margin: 0;
    font-size: 0.875rem;
}

/* 付费标签页 */
.qm-paid-tabs-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.qm-paid-tab-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.875rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    margin-bottom: -1px;
}

.qm-paid-tab-btn:hover {
    color: #2563eb;
}

.qm-paid-tab-btn.is-active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.qm-paid-tabs-panels {
    position: relative;
}

.qm-paid-tab-panel {
    display: none;
}

.qm-paid-tab-panel.is-active {
    display: block;
}

/* 复选框标签 */
.qm-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.qm-checkbox-label input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* 编辑器底部 */
.qm-editor-footer {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 0.5rem 0.75rem;
    margin-top: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

.qm-autosave-status {
    font-size: 0.875rem;
    color: #6b7280;
}

.qm-editor-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* 左侧栏中的发布操作按钮布局 */
.qm-settings-actions .qm-editor-actions-vertical {
    flex-direction: column;
}

/* 按钮样式 */
.qm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    gap: 0.5rem;
}

.qm-btn-primary {
    background: #2563eb;
    color: #fff;
}

.qm-btn-primary:hover {
    background: #1d4ed8;
    color: #fff;
}

.qm-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.qm-btn-secondary:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.qm-submit-btn {
    padding: 0.625rem 1.5rem;
    font-weight: 600;
}

/* 错误页面 */
.qm-editor-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 2rem;
}

.qm-error-icon {
    font-size: 4rem;
    color: #ef4444;
    margin-bottom: 1.5rem;
}

.qm-error-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: #1a1a1a;
}

.qm-error-message {
    font-size: 1rem;
    color: #6b7280;
    margin: 0 0 2rem;
}

/* 响应式设计 */
@media (max-width: 991.98px) {
    .qm-editor-sidebar-left,
    .qm-editor-sidebar-right {
        position: static;
        margin-top: 1.5rem;
    }
    
    .qm-editor-sidebar {
        position: static;
        max-height: none;
        top: auto;
    }
    
    .qm-post-editor-wrapper {
        flex-direction: column;
    }
}

@media (max-width: 575.98px) {
    .qm-editor-header {
        padding: 1rem;
    }
    
    .qm-post-title-input {
        font-size: 1.25rem;
        padding-right: 3rem;
    }
    
    .qm-title-counter {
        font-size: 0.75rem;
    }
    
    .qm-editor-toolbar {
        padding: 0.5rem;
    }
    
    .qm-editor-body {
        padding: 1rem;
        min-height: 300px;
    }
    
    .qm-editor-sidebar {
        padding: 1rem;
    }
    
    .qm-editor-footer {
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
    }
    
    .qm-editor-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .qm-btn {
        width: 100%;
        justify-content: center;
    }
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 间距工具类（替代Tailwind） */
.mb-2 {
    margin-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mt-3 {
    margin-top: 1rem !important;
}

.ms-1 {
    margin-left: 0.25rem !important;
}

.ml-1 {
    margin-left: 0.25rem !important;
}

.mr-2 {
    margin-right: 0.5rem !important;
}

/* 文本大小工具类 */
.text-3xl {
    font-size: 1.875rem !important;
    line-height: 2.25rem !important;
}

/* 编辑器模态框样式 */
.qm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.qm-modal.active {
    opacity: 1;
    visibility: visible;
}

.qm-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    transition: transform 0.2s;
}

.qm-modal.active .qm-modal-content {
    transform: scale(1);
}

.qm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.qm-modal-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1a1a1a;
}

.qm-modal-close {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.qm-modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.qm-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.qm-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

/* 表单组 */
.qm-form-group {
    margin-bottom: 1rem;
}

.qm-form-group:last-child {
    margin-bottom: 0;
}

.qm-form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #374151;
}

.qm-form-group input[type="text"],
.qm-form-group input[type="url"],
.qm-form-group input[type="number"],
.qm-form-group textarea,
.qm-form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.qm-form-group input:focus,
.qm-form-group textarea:focus,
.qm-form-group select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.qm-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* 媒体标签页 */
.qm-media-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.qm-media-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.875rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    margin-bottom: -1px;
}

.qm-media-tab:hover {
    color: #2563eb;
}

.qm-media-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.qm-media-tab-content {
    display: none;
}

.qm-media-tab-content.active {
    display: block;
}

/* 媒体库列表 */
.qm-media-library-toolbar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.qm-media-search {
    flex: 1;
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    outline: none;
}

.qm-media-search:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.qm-media-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.5rem;
    max-height: 320px;
    overflow: auto;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #f9fafb;
}

.qm-media-library-item {
    border: 1px solid transparent;
    background: #fff;
    border-radius: 6px;
    padding: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.qm-media-library-item img {
    width: 100%;
    height: 72px;
    object-fit: cover;
    display: block;
    border-radius: 4px;
}

.qm-media-library-item:hover {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.qm-media-library-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.qm-media-library-status {
    font-size: 0.75rem;
    color: #6b7280;
}

.qm-media-library-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1rem;
    color: #9ca3af;
    font-size: 0.875rem;
}

/* 上传区域 */
.qm-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 4px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #f9fafb;
}

.qm-upload-area:hover {
    border-color: #2563eb;
    background: #f0f4ff;
}

.qm-upload-area.dragover {
    border-color: #2563eb;
    background: #e0e7ff;
}

.qm-upload-area i {
    font-size: 2.5rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
    display: block;
}

.qm-upload-area p {
    margin: 0.5rem 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.qm-upload-hint {
    font-size: 0.75rem !important;
    color: #9ca3af !important;
}

/* 链接输入 */
.qm-link-url-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    outline: none;
}

.qm-link-url-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* =========================
 * 暗色模式适配（前端发布页）
 * ========================= */
.dark .qm-editor-header,
.dark .qm-editor-content,
.dark .qm-editor-footer,
.dark .qm-editor-sidebar,
.dark .qm-toolbar-more-menu {
    background: var(--qm-bg-dark-800);
    border-color: var(--qm-border-dark-600);
    box-shadow: none;
}

.dark .qm-editor-main,
.dark .qm-editor-sidebar-left,
.dark .qm-editor-sidebar-right {
    background: transparent;
    border-color: transparent;
}

.dark .qm-editor-main {
    box-shadow: none;
}

.dark .qm-post-title-input {
    color: #e2e8f0;
}

.dark .qm-post-title-input::placeholder {
    color: #64748b;
}

.dark .qm-title-counter {
    color: #94a3b8;
}

.dark .qm-editor-toolbar {
    border-bottom-color: var(--qm-border-dark-600);
}

.dark .qm-toolbar-select,
.dark .qm-tags-input,
.dark .qm-link-url-input,
.dark .qm-form-group input[type="text"],
.dark .qm-form-group input[type="url"],
.dark .qm-form-group input[type="number"],
.dark .qm-form-group textarea,
.dark .qm-form-group select {
    background: var(--qm-bg-dark);
    border-color: var(--qm-border-dark-600);
    color: #e2e8f0;
}

.dark .qm-toolbar-select:hover,
.dark .qm-tags-input:hover,
.dark .qm-link-url-input:hover {
    border-color: var(--qm-bg-dark-600);
}

.dark .qm-form-group input:focus,
.dark .qm-form-group textarea:focus,
.dark .qm-form-group select:focus,
.dark .qm-link-url-input:focus,
.dark .qm-tags-input:focus,
.dark .qm-toolbar-select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.dark .qm-toolbar-btn {
    color: #cbd5e1;
}

.dark .qm-toolbar-btn:hover {
    background: var(--qm-bg-dark-600);
    color: #e2e8f0;
}

.dark .qm-import-progress {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(100, 116, 139, 0.34);
    box-shadow: 0 24px 44px rgba(2, 8, 23, 0.42);
}

.dark .qm-import-progress__title {
    color: #f8fafc;
}

.dark .qm-import-progress__detail {
    color: #94a3b8;
}

.dark .qm-import-progress__bar {
    background: rgba(71, 85, 105, 0.7);
}

.dark .qm-editor-body {
    background: var(--qm-bg-dark);
    color: var(--qm-text-dark-secondary);
}

.dark .qm-editor-body :is(p, li, blockquote, figcaption, span, em, b, i, u, small, mark) {
    color: inherit !important;
}

.dark .qm-editor-body :is(h1, h2, h3, h4, h5, h6, strong) {
    color: var(--qm-text-dark-primary) !important;
}

.dark .qm-editor-body blockquote {
    color: var(--qm-text-dark-secondary) !important;
}

.dark .qm-editor-body .qm-video-wrapper,
.dark .qm-editor-body .qm-table-wrapper,
.dark .qm-editor-body .qm-image-wrapper {
    background: rgba(15, 23, 42, 0.28);
}

.dark .qm-editor-body:empty:before {
    color: #64748b;
}

.dark .qm-editor-body.qm-drag-over {
    background: rgba(37, 99, 235, 0.12);
    border-color: #60a5fa;
}

.dark .qm-settings-section {
    border-bottom-color: var(--qm-border-dark-600);
}

.dark .qm-settings-title {
    color: #e2e8f0;
}

.dark .qm-settings-label {
    color: #cbd5e1;
}

.dark .qm-settings-desc {
    color: #94a3b8;
}

.dark .qm-category-item:hover {
    background: var(--qm-bg-dark-600);
}

.dark .qm-tag-item {
    background: rgba(37, 99, 235, 0.18);
    color: #93c5fd;
}

.dark .qm-tag-remove {
    background: rgba(147, 197, 253, 0.18);
}

.dark .qm-tag-remove:hover {
    background: rgba(147, 197, 253, 0.28);
}

.dark .qm-featured-image-preview {
    background: var(--qm-bg-dark);
    border-color: var(--qm-border-dark-600);
}

.dark .qm-featured-image-preview:hover {
    border-color: #60a5fa;
}

.dark .qm-featured-image-placeholder {
    color: #94a3b8;
}

.dark .qm-autosave-status {
    color: #94a3b8;
}

.dark .qm-btn-secondary {
    background: var(--qm-bg-dark-600);
    color: #e2e8f0;
}

.dark .qm-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.dark .qm-media-library-grid {
    background: var(--qm-bg-dark);
    border-color: var(--qm-border-dark-600);
}

.dark .qm-media-library-item {
    background: var(--qm-bg-dark-800);
}

.dark .qm-media-search {
    background: var(--qm-bg-dark);
    border-color: var(--qm-border-dark-600);
    color: #e2e8f0;
}

.dark .qm-media-library-status,
.dark .qm-media-library-empty {
    color: #94a3b8;
}

.dark .qm-modal-content {
    background: var(--qm-bg-dark-800);
}

.dark .qm-modal-header {
    border-bottom-color: var(--qm-border-dark-600);
}

.dark .qm-modal-title {
    color: #e2e8f0;
}

.dark .qm-modal-close {
    color: #94a3b8;
}

.dark .qm-modal-close:hover {
    background: var(--qm-bg-dark-600);
    color: #e2e8f0;
}

.dark .qm-modal-footer {
    background: var(--qm-bg-dark);
    border-top-color: var(--qm-border-dark-600);
}

.dark .qm-form-group label {
    color: #cbd5e1;
}

.dark .qm-media-tabs {
    border-bottom-color: var(--qm-border-dark-600);
}

.dark .qm-media-tab {
    color: #94a3b8;
}

.dark .qm-media-tab:hover {
    color: #60a5fa;
}

.dark .qm-media-tab.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

.dark .qm-upload-placeholder {
    background: var(--qm-bg-dark);
    border-color: var(--qm-border-dark-600);
}

.dark .qm-upload-placeholder-content {
    color: #94a3b8;
}

.dark .qm-upload-placeholder-content i {
    color: #60a5fa;
}

.dark .qm-upload-area {
    border-color: var(--qm-border-dark-600);
    background: var(--qm-bg-dark);
}

.dark .qm-upload-area:hover {
    border-color: #60a5fa;
    background: rgba(37, 99, 235, 0.12);
}

.dark .qm-upload-area.dragover {
    border-color: #60a5fa;
    background: rgba(37, 99, 235, 0.18);
}

.dark .qm-upload-area i {
    color: #64748b;
}

.dark .qm-upload-area p {
    color: #94a3b8;
}

.dark .qm-upload-hint {
    color: #64748b !important;
}

@media (max-width: 640px) {
    .qm-import-progress {
        top: auto;
        right: 10px;
        left: 10px;
        bottom: 20px;
        width: auto;
        padding: 12px 13px 13px;
    }

    .qm-import-progress__title {
        font-size: 13px;
    }

    .qm-import-progress__detail {
        font-size: 11px;
    }

    .qm-import-progress__percent {
        min-width: 38px;
        font-size: 16px;
    }

    .qm-import-progress__bar {
        height: 6px;
    }
}
