/* ========================================
   Post Editor - CSDN-style full page editor
   ======================================== */
.post-editor-page {
    min-height: 100vh;
    background: #fff;
    display: flex;
    flex-direction: column;
}

/* --- Top Navigation Bar --- */
.editor-navbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e5e6eb;
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.editor-navbar .nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.editor-navbar .nav-back {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #4e5969;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all .2s;
}

.editor-navbar .nav-back:hover {
    color: #1e80ff;
    background: #f2f3f5;
}

.editor-navbar .nav-type {
    font-size: 14px;
    color: #1d2129;
    display: flex;
    align-items: center;
    gap: 4px;
}

.editor-navbar .nav-type .el-dropdown-link {
    cursor: pointer;
    color: #1d2129;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.editor-navbar .nav-type .el-dropdown-link:hover {
    color: #1e80ff;
}

.editor-navbar .nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.editor-navbar .title-input {
    width: 100%;
    max-width: 640px;
    border: none;
    outline: none;
    font-size: 24px;
    font-weight: 600;
    color: #1d2129;
    text-align: center;
    background: transparent;
}

.editor-navbar .title-input::placeholder {
    color: #c9cdd4;
    font-weight: 400;
}

.editor-navbar .nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-navbar .char-count {
    font-size: 12px;
    color: #86909c;
}

.editor-navbar .draft-status {
    font-size: 12px;
    color: #86909c;
    display: flex;
    align-items: center;
    gap: 4px;
}

.editor-navbar .draft-status.saving {
    color: #ff7d00;
}

.editor-navbar .draft-status.saved {
    color: #00b42a;
}

.editor-navbar .btn-draft {
    padding: 6px 16px;
    border: 1px solid #e5e6eb;
    background: #fff;
    color: #4e5969;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
}

.editor-navbar .btn-draft:hover {
    border-color: #1e80ff;
    color: #1e80ff;
}

.editor-navbar .btn-publish {
    padding: 6px 20px;
    border: none;
    background: #1e80ff;
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
}

.editor-navbar .btn-publish:hover {
    background: #1171ee;
}

.editor-navbar .btn-publish:disabled {
    background: #94bfff;
    cursor: not-allowed;
}

/* --- Settings Bar (board select etc.) --- */
.editor-settings-bar {
    height: 44px;
    background: #fafbfc;
    border-bottom: 1px solid #e5e6eb;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    flex-shrink: 0;
}

.editor-settings-bar .setting-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #4e5969;
}

.editor-settings-bar .setting-item label {
    color: #86909c;
    white-space: nowrap;
}

/* --- Markdown Toolbar --- */
.md-toolbar {
    height: 40px;
    background: #fafbfc;
    border-bottom: 1px solid #e5e6eb;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 2px;
    flex-shrink: 0;
    overflow-x: auto;
}

.md-toolbar .tb-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #4e5969;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all .15s;
    flex-shrink: 0;
}

.md-toolbar .tb-btn:hover {
    background: #e8f3ff;
    color: #1e80ff;
}

.md-toolbar .tb-btn.active {
    background: #e8f3ff;
    color: #1e80ff;
}

.md-toolbar .tb-divider {
    width: 1px;
    height: 20px;
    background: #e5e6eb;
    margin: 0 6px;
    flex-shrink: 0;
}

.md-toolbar .tb-label {
    font-size: 12px;
    color: #86909c;
    padding: 0 8px;
    white-space: nowrap;
}

/* --- Main Editor Area --- */
.editor-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Markdown split mode */
.editor-main.mode-markdown {
    display: flex;
}

.editor-main .edit-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e5e6eb;
    min-width: 0;
    position: relative;
}

.editor-main .preview-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
}

.editor-main .pane-header {
    height: 36px;
    background: #fafbfc;
    border-bottom: 1px solid #f2f3f5;
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 12px;
    color: #86909c;
    flex-shrink: 0;
}

.editor-main .pane-header .pane-title {
    font-weight: 500;
}

/* Markdown textarea */
.editor-main .md-editor-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.editor-main .md-textarea {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 24px 32px;
    font-size: 15px;
    line-height: 1.8;
    color: #1d2129;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Menlo', 'Consolas', monospace;
    background: #fff;
    tab-size: 4;
}

.editor-main .md-textarea::placeholder {
    color: #c9cdd4;
}

/* Preview area */
.editor-main .preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

/* Richtext mode */
.editor-main.mode-richtext {
    display: flex;
    flex-direction: column;
}

.editor-main.mode-richtext .richtext-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-main.mode-richtext #richtext-toolbar {
    border-bottom: 1px solid #e5e6eb;
    background: #fafbfc;
}

.editor-main.mode-richtext #richtext-toolbar .w-e-toolbar {
    border: none !important;
    background: transparent !important;
}

.editor-main.mode-richtext #richtext-editor {
    flex: 1;
    overflow-y: auto;
}

.editor-main.mode-richtext .richtext-container .w-e-text-container {
    flex: 1 !important;
    height: auto !important;
    border: none !important;
}

.editor-main.mode-richtext .w-e-text {
    min-height: 400px;
    padding: 24px 32px !important;
}

/* --- Markdown Preview Styles --- */
.md-preview {
    font-size: 16px;
    color: #1d2129;
    line-height: 1.8;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.md-preview h1 { font-size: 28px; font-weight: 700; margin: 28px 0 16px; padding-bottom: 12px; border-bottom: 1px solid #e5e6eb; color: #1d2129; }
.md-preview h2 { font-size: 24px; font-weight: 600; margin: 24px 0 14px; padding-bottom: 8px; border-bottom: 1px solid #f2f3f5; color: #1d2129; }
.md-preview h3 { font-size: 20px; font-weight: 600; margin: 20px 0 12px; color: #1d2129; }
.md-preview h4 { font-size: 17px; font-weight: 600; margin: 16px 0 10px; color: #1d2129; }
.md-preview h5 { font-size: 15px; font-weight: 600; margin: 14px 0 8px; color: #1d2129; }
.md-preview h6 { font-size: 14px; font-weight: 600; margin: 12px 0 6px; color: #86909c; }

.md-preview p { margin: 0 0 16px; }
.md-preview a { color: #1e80ff; text-decoration: none; }
.md-preview a:hover { text-decoration: underline; }

.md-preview strong { font-weight: 600; }
.md-preview em { font-style: italic; }
.md-preview del { text-decoration: line-through; color: #86909c; }

.md-preview blockquote {
    margin: 16px 0;
    padding: 12px 16px;
    border-left: 4px solid #1e80ff;
    background: #f7f8fa;
    color: #4e5969;
    border-radius: 0 4px 4px 0;
}

.md-preview blockquote p:last-child { margin-bottom: 0; }

.md-preview code {
    background: #f2f3f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #d63384;
    font-family: 'SF Mono', 'Fira Code', 'Menlo', 'Consolas', monospace;
}

.md-preview pre {
    margin: 16px 0;
    border-radius: 8px;
    overflow: hidden;
    background: #1e1e2e;
}

.md-preview pre code {
    display: block;
    padding: 20px 24px;
    background: transparent;
    color: #cdd6f4;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: auto;
    border-radius: 0;
}

.md-preview ul, .md-preview ol {
    margin: 12px 0;
    padding-left: 24px;
}

.md-preview li {
    margin: 6px 0;
}

.md-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.md-preview table th {
    background: #f7f8fa;
    font-weight: 600;
    text-align: left;
    padding: 10px 16px;
    border: 1px solid #e5e6eb;
}

.md-preview table td {
    padding: 10px 16px;
    border: 1px solid #e5e6eb;
}

.md-preview table tr:hover { background: #fafbfc; }

.md-preview img {
    max-width: 100%;
    border-radius: 8px;
    margin: 12px 0;
}

.md-preview hr {
    border: none;
    border-top: 1px solid #e5e6eb;
    margin: 24px 0;
}

.md-preview .task-list-item {
    list-style: none;
    margin-left: -24px;
    padding-left: 24px;
}

.md-preview .task-list-item input[type="checkbox"] {
    margin-right: 8px;
}

/* --- TOC Sidebar (in editor preview) --- */
.preview-toc {
    position: fixed;
    right: 20px;
    top: 160px;
    width: 200px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    background: #fff;
    border: 1px solid #f2f3f5;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
    z-index: 50;
    display: none;
}

.preview-toc.visible { display: block; }

.preview-toc .toc-title {
    font-size: 13px;
    font-weight: 600;
    color: #1d2129;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f2f3f5;
}

.preview-toc .toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.preview-toc .toc-item {
    margin: 0;
}

.preview-toc .toc-item a {
    display: block;
    padding: 4px 0;
    font-size: 12px;
    color: #86909c;
    text-decoration: none;
    line-height: 1.5;
    transition: color .2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-toc .toc-item a:hover {
    color: #1e80ff;
}

.preview-toc .toc-item.active a {
    color: #1e80ff;
    font-weight: 500;
}

.preview-toc .toc-item.level-1 { padding-left: 0; }
.preview-toc .toc-item.level-2 { padding-left: 12px; }
.preview-toc .toc-item.level-3 { padding-left: 24px; }
.preview-toc .toc-item.level-4 { padding-left: 36px; }

/* --- Footer Status Bar --- */
.editor-footer {
    height: 32px;
    background: #fafbfc;
    border-top: 1px solid #e5e6eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-size: 12px;
    color: #86909c;
    flex-shrink: 0;
}

.editor-footer .footer-left {
    display: flex;
    gap: 16px;
}

.editor-footer .footer-right {
    display: flex;
    gap: 16px;
}

/* --- Draft Dialog --- */
.draft-list-dialog .draft-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f2f3f5;
    cursor: pointer;
    transition: background .2s;
}

.draft-list-dialog .draft-item:hover {
    background: #f7f8fa;
    margin: 0 -16px;
    padding: 12px 16px;
}

.draft-list-dialog .draft-item:last-child {
    border-bottom: none;
}

.draft-list-dialog .draft-title {
    font-size: 14px;
    color: #1d2129;
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.draft-list-dialog .draft-time {
    font-size: 12px;
    color: #86909c;
    margin-left: 16px;
    flex-shrink: 0;
}

.draft-list-dialog .draft-actions {
    display: flex;
    gap: 8px;
    margin-left: 12px;
    flex-shrink: 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .editor-navbar .nav-center {
        display: none;
    }
    .editor-main .preview-pane {
        display: none;
    }
    .editor-main .edit-pane {
        border-right: none;
    }
    .editor-main .md-textarea {
        padding: 16px;
    }
    .preview-toc {
        display: none !important;
    }
}

/* --- hljs overrides in preview --- */
.md-preview pre code.hljs {
    background: transparent;
    padding: 0;
}

/* --- Preview Dialog --- */
.preview-dialog .el-dialog__body {
    padding: 0 24px 24px;
}
.preview-dialog .md-preview {
    font-size: 15px;
    line-height: 1.8;
    color: #1d2129;
}
.preview-dialog .md-preview img {
    max-width: 100%;
    border-radius: 4px;
}
.preview-dialog .md-preview h1,
.preview-dialog .md-preview h2,
    .preview-dialog .md-preview h3 {
    margin-top: 24px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #1d2129;
}
.preview-dialog .md-preview h1 { font-size: 28px; }
.preview-dialog .md-preview h2 { font-size: 22px; border-bottom: 1px solid #e5e6eb; padding-bottom: 8px; }
.preview-dialog .md-preview h3 { font-size: 18px; }
.preview-dialog .md-preview pre {
    background: #282c34;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
}
.preview-dialog .md-preview code {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 13px;
}
.preview-dialog .md-preview blockquote {
    border-left: 4px solid #1e80ff;
    margin: 16px 0;
    padding: 12px 16px;
    background: #f7f8fa;
    color: #4e5969;
}
.preview-dialog .md-preview table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
}
.preview-dialog .md-preview th,
.preview-dialog .md-preview td {
    border: 1px solid #e5e6eb;
    padding: 8px 12px;
    text-align: left;
}
.preview-dialog .md-preview th {
    background: #f7f8fa;
    font-weight: 600;
}
