/* ── Markdown Editor ────────────────────────────────────────────
 * Matches Bootstrap 4 + PoSTLiST.uk dark theme
 * Split-pane: toolbar, editor textarea, live preview
 * ─────────────────────────────────────────────────────────────── */

.md-editor-wrapper {
    border: 1px solid #dee2e6;
    border-radius: .25rem;
    overflow: hidden;
    margin-bottom: 1rem;
}

/* ── Toolbar ─────────────────────────────────────────────────── */
.md-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 6px 8px;
    background: #343a40;
    border-bottom: 1px solid #454d55;
    user-select: none;
}

.md-editor-toolbar .md-btn-group {
    display: flex;
    gap: 1px;
}

.md-editor-toolbar .md-btn-sep {
    width: 1px;
    background: #5a6268;
    margin: 2px 6px;
    align-self: stretch;
}

.md-editor-toolbar button {
    background: transparent;
    border: 1px solid transparent;
    color: #ced4da;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 13px;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    line-height: 1.4;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}

.md-editor-toolbar button:hover {
    background: #495057;
    color: #fff;
    border-color: #6c757d;
}

.md-editor-toolbar button:active,
.md-editor-toolbar button.md-active {
    background: #6c757d;
    color: #fff;
}

.md-editor-toolbar button i {
    margin-right: 2px;
}

/* ── Split Pane ──────────────────────────────────────────────── */
.md-editor-panes {
    display: flex;
    min-height: 350px;
    max-height: 600px;
}

.md-editor-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.md-editor-pane + .md-editor-pane {
    border-left: 1px solid #dee2e6;
}

.md-editor-pane-header {
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6c757d;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.md-editor-pane textarea,
.md-editor-preview {
    flex: 1;
    padding: 12px;
    border: none;
    outline: none;
    resize: none;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto;
    min-height: 300px;
}

.md-editor-pane textarea {
    background: #fafafa;
    color: #212529;
    tab-size: 4;
}

.md-editor-pane textarea:focus {
    background: #fff;
}

/* ── Preview Panel ───────────────────────────────────────────── */
.md-editor-preview {
    background: #fff;
    color: #212529;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    word-wrap: break-word;
}

.md-editor-preview h1, .md-editor-preview h2, .md-editor-preview h3,
.md-editor-preview h4, .md-editor-preview h5, .md-editor-preview h6 {
    margin-top: 1em;
    margin-bottom: .5em;
    color: #343a40;
}

.md-editor-preview h1 { font-size: 1.75rem; border-bottom: 2px solid #dee2e6; padding-bottom: .3em; }
.md-editor-preview h2 { font-size: 1.5rem;  border-bottom: 1px solid #dee2e6; padding-bottom: .2em; }
.md-editor-preview h3 { font-size: 1.25rem; }

.md-editor-preview p { margin-bottom: .8em; }
.md-editor-preview a { color: #7a7a7a; }
.md-editor-preview blockquote {
    border-left: 3px solid #343a40;
    padding: .5em 1em;
    color: #6c757d;
    margin: .8em 0;
    background: #f8f9fa;
}
.md-editor-preview code {
    background: #f1f3f5;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: .9em;
    color: #495057;
}
.md-editor-preview pre {
    background: #282a36;
    color: #f8f8f2;
    padding: 1em;
    border-radius: .25rem;
    overflow-x: auto;
}
.md-editor-preview pre code {
    background: none;
    padding: 0;
    color: inherit;
}
.md-editor-preview ul, .md-editor-preview ol {
    padding-left: 1.5em;
    margin-bottom: .8em;
}
.md-editor-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}
.md-editor-preview th, .md-editor-preview td {
    border: 1px solid #dee2e6;
    padding: .5em .75em;
}
.md-editor-preview th {
    background: #343a40;
    color: #fff;
}
.md-editor-preview hr {
    border: none;
    border-top: 2px solid #dee2e6;
    margin: 1.5em 0;
}
.md-editor-preview img {
    max-width: 100%;
    border-radius: .25rem;
}

/* ── Footer: char count + toggle hint ────────────────────────── */
.md-editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    color: #6c757d;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* ── Responsive: stack on small screens ──────────────────────── */
@media (max-width: 768px) {
    .md-editor-panes {
        flex-direction: column;
    }
    .md-editor-pane + .md-editor-pane {
        border-left: none;
        border-top: 1px solid #dee2e6;
    }
    .md-editor-pane textarea,
    .md-editor-preview {
        min-height: 200px;
    }
}
