/* Markdown editor and page management */

.markdown-content {
    color: inherit;
    background: transparent;
    line-height: 1.7;
}

.markdown-content > :first-child {
    margin-top: 0;
}

.markdown-content > :last-child {
    margin-bottom: 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1.35em;
    margin-bottom: 0.45em;
    font-family: inherit;
    line-height: 1.2;
}

.markdown-content h1 {
    font-size: 2rem;
}

.markdown-content h2 {
    font-size: 1.65rem;
}

.markdown-content h3 {
    font-size: 1.35rem;
}

.markdown-content h4 {
    font-size: 1.15rem;
}

.markdown-content p,
.markdown-content ul,
.markdown-content ol,
.markdown-content blockquote,
.markdown-content pre,
.markdown-content table {
    margin-bottom: 1rem;
}

.markdown-content ul,
.markdown-content ol {
    padding-left: 1.5rem;
}

.markdown-content li + li {
    margin-top: 0.25rem;
}

.markdown-content blockquote {
    margin-left: 0;
    padding: 0.75rem 1rem;
    border-left: 3px solid currentColor;
    background: rgba(0, 0, 0, 0.06);
    color: inherit;
}

.markdown-content code {
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
}

.markdown-content pre {
    padding: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.08);
    overflow-x: auto;
}

.markdown-content pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.markdown-content hr {
    border: 0;
    border-top: 1px solid currentColor;
    opacity: 0.2;
    margin: 1.5rem 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
}

.markdown-content th,
.markdown-content td {
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.18);
}

.markdown-content img {
    display: block;
    max-width: 100%;
    height: auto;
}

.markdown-editor-wrapper {
    position: relative;
}

.markdown-editor-wrapper .EasyMDEContainer {
    position: relative;
}

.markdown-editor-wrapper .EasyMDEContainer .CodeMirror {
    color: #000;
    background: #fff;
    border-color: #ced4da;
    font-size: inherit;
    font-family: inherit;
    line-height: 1.7;
}

.markdown-editor-wrapper .EasyMDEContainer .CodeMirror pre,
.markdown-editor-wrapper .EasyMDEContainer .CodeMirror-line,
.markdown-editor-wrapper .EasyMDEContainer .CodeMirror-line-like {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

.markdown-editor-wrapper .EasyMDEContainer .editor-toolbar {
    border-color: #ced4da;
}

.markdown-editor-wrapper .EasyMDEContainer .CodeMirror-cursor {
    border-left-color: #000;
}

.markdown-editor-wrapper .EasyMDEContainer .CodeMirror-gutters {
    border-right-color: #ddd;
    background: #f7f7f7;
}

.markdown-editor-wrapper .EasyMDEContainer .CodeMirror-linenumber {
    color: #999;
    opacity: 1;
}

.markdown-editor-wrapper .editor-preview.markdown-content,
.markdown-editor-wrapper .editor-preview-side.markdown-content {
    padding: 1.25rem;
    background: #fafafa;
    color: #2c3e50;
    font-family: inherit;
    line-height: 1.7;
}

.markdown-editor-wrapper .editor-preview.markdown-content h1,
.markdown-editor-wrapper .editor-preview.markdown-content h2,
.markdown-editor-wrapper .editor-preview.markdown-content h3,
.markdown-editor-wrapper .editor-preview.markdown-content h4,
.markdown-editor-wrapper .editor-preview.markdown-content h5,
.markdown-editor-wrapper .editor-preview.markdown-content h6,
.markdown-editor-wrapper .editor-preview-side.markdown-content h1,
.markdown-editor-wrapper .editor-preview-side.markdown-content h2,
.markdown-editor-wrapper .editor-preview-side.markdown-content h3,
.markdown-editor-wrapper .editor-preview-side.markdown-content h4,
.markdown-editor-wrapper .editor-preview-side.markdown-content h5,
.markdown-editor-wrapper .editor-preview-side.markdown-content h6 {
    color: inherit;
}

.markdown-editor-wrapper .editor-preview.markdown-content a,
.markdown-editor-wrapper .editor-preview-side.markdown-content a {
    color: #4183c4;
}

.markdown-editor-wrapper .editor-preview.markdown-content blockquote,
.markdown-editor-wrapper .editor-preview-side.markdown-content blockquote {
    border-left-color: rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.03);
}

.markdown-editor-wrapper .editor-preview.markdown-content code,
.markdown-editor-wrapper .editor-preview-side.markdown-content code {
    background: rgba(27, 31, 35, 0.05);
}

.markdown-editor-wrapper .editor-preview.markdown-content pre,
.markdown-editor-wrapper .editor-preview-side.markdown-content pre {
    border-color: #ddd;
    background: #eee;
}

.markdown-editor-wrapper .editor-preview.markdown-content th,
.markdown-editor-wrapper .editor-preview.markdown-content td,
.markdown-editor-wrapper .editor-preview-side.markdown-content th,
.markdown-editor-wrapper .editor-preview-side.markdown-content td {
    border-color: #ddd;
}

.markdown-editor-wrapper .cm-s-easymde .cm-header-1,
.markdown-editor-wrapper .cm-s-easymde .cm-header-2,
.markdown-editor-wrapper .cm-s-easymde .cm-header-3,
.markdown-editor-wrapper .cm-s-easymde .cm-header-4,
.markdown-editor-wrapper .cm-s-easymde .cm-header-5,
.markdown-editor-wrapper .cm-s-easymde .cm-header-6 {
    font-family: inherit;
    font-weight: 700;
    line-height: 1.2;
}

.markdown-editor-wrapper .cm-s-easymde .cm-header-1 {
    font-size: 2rem;
}

.markdown-editor-wrapper .cm-s-easymde .cm-header-2 {
    font-size: 1.65rem;
}

.markdown-editor-wrapper .cm-s-easymde .cm-header-3 {
    font-size: 1.35rem;
}

.markdown-editor-wrapper .cm-s-easymde .cm-header-4 {
    font-size: 1.15rem;
}

.markdown-editor-wrapper .cm-s-easymde .cm-header-5 {
    font-size: 1rem;
}

.markdown-editor-wrapper .cm-s-easymde .cm-header-6 {
    font-size: 1rem;
}

.markdown-preview-loading,
.markdown-preview-error {
    margin: 0;
    color: rgba(44, 62, 80, 0.72);
}

.markdown-preview-error {
    color: #f2b3b3;
}

.markdown-editor-wrapper .editor-toolbar {
    position: relative;
    z-index: 11;
    background-color: #f5f5f5;
}

.markdown-editor-wrapper .editor-toolbar button.heading-bigger:after {
    content: "\25B2";
}

.markdown-editor-wrapper .editor-toolbar button.heading-smaller:after {
    content: "\25BC";
}

.markdown-editor-toolbar-sticky {
    position: absolute;
    top: -12px;
    right: -12px;
    z-index: 12;
    display: flex;
    gap: 6px;
}

.markdown-edit-toggle,
.markdown-preview-toggle,
.markdown-publish-toggle,
.markdown-create-toggle,
.markdown-pages-toggle,
.markdown-save-toggle,
.markdown-back-toggle {
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #ff9b00;
    color: #fff;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.markdown-edit-toggle:hover,
.markdown-preview-toggle:hover,
.markdown-publish-toggle:hover,
.markdown-create-toggle:hover,
.markdown-pages-toggle:hover,
.markdown-save-toggle:hover,
.markdown-back-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    color: #fff;
    text-decoration: none;
}

.markdown-preview-toggle {
    background: #232323;
}

.markdown-save-toggle {
    background: #28a745;
}

.markdown-publish-toggle {
    background: #007bff;
}

.markdown-create-toggle {
    background: #343a40;
}

.markdown-back-toggle {
    background: #6c757d;
}

.markdown-edit-toggle svg,
.markdown-preview-toggle svg,
.markdown-publish-toggle svg,
.markdown-create-toggle svg,
.markdown-pages-toggle svg,
.markdown-save-toggle svg,
.markdown-back-toggle svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

.markdown-edit-toggle svg path,
.markdown-preview-toggle svg path,
.markdown-publish-toggle svg path,
.markdown-create-toggle svg path,
.markdown-pages-toggle svg path,
.markdown-save-toggle svg path,
.markdown-back-toggle svg path {
    fill: currentColor;
}

.markdown-toolbar-form,
.markdown-list-form {
    margin: 0;
}

.markdown-pages-toggle {
    background: #232323;
    color: #fff;
}

.markdown-pages-toggle:hover,
.markdown-pages-toggle:focus {
    background: #2c2c2c;
    color: #fff;
}

.markdown-pages-toggle svg,
.markdown-pages-toggle svg path {
    fill: #fff;
    color: #fff;
}

.markdown-page-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.markdown-page-title {
    margin: 0 0 4px;
    color: #ededed;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 0;
}

.markdown-page-lead {
    margin: 0;
    max-width: 56ch;
    color: rgba(237, 237, 237, 0.72);
}

.markdown-action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.markdown-action-stack {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.markdown-icon-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #4b4b4b;
    border-radius: 3px;
    background: #232323;
    color: #ededed;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.markdown-icon-btn:hover,
.markdown-icon-btn:focus {
    border-color: #6a6a6a;
    background: #2c2c2c;
    color: #fff;
    text-decoration: none;
}

.markdown-icon-btn:focus {
    outline: 2px solid rgba(255, 155, 0, 0.25);
    outline-offset: 2px;
}

.markdown-icon-btn svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.markdown-icon-btn svg path {
    fill: currentColor;
}

.markdown-icon-btn--subtle {
    border-color: #454545;
    background: transparent;
    color: #d7d7d7;
}

.markdown-icon-btn--subtle:hover,
.markdown-icon-btn--subtle:focus {
    border-color: #666;
    background: #262626;
}

.markdown-icon-btn--accent {
    border-color: #5a5a5a;
    background: #2d2d2d;
}

.markdown-icon-btn--primary {
    border-color: #2e5c8f;
    background: #1f4e82;
    color: #f4f8fc;
}

.markdown-icon-btn--primary:hover,
.markdown-icon-btn--primary:focus {
    border-color: #3a6ea7;
    background: #275c96;
}

.markdown-icon-btn--danger {
    border-color: #7a2d2d;
    background: #4a1f1f;
    color: #f6dddd;
}

.markdown-icon-btn--danger:hover,
.markdown-icon-btn--danger:focus {
    border-color: #9f4040;
    background: #5f2626;
    color: #fff1f1;
}

.markdown-action-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid #4b4b4b;
    border-radius: 3px;
    background: #232323;
    color: #ededed;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    box-shadow: none;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.markdown-action-btn:hover,
.markdown-action-btn:focus {
    color: #fff;
    border-color: #6a6a6a;
    background: #2c2c2c;
    text-decoration: none;
}

.markdown-action-btn:focus {
    outline: 2px solid rgba(255, 155, 0, 0.25);
    outline-offset: 2px;
}

.markdown-action-btn--strong {
    border-color: #8a5a0a;
    background: #ff9b00;
    color: #111;
}

.markdown-action-btn--strong:hover,
.markdown-action-btn--strong:focus {
    border-color: #a36c12;
    background: #ffab2e;
    color: #111;
}

.markdown-action-btn--primary {
    border-color: #2e5c8f;
    background: #1f4e82;
    color: #f4f8fc;
}

.markdown-action-btn--primary:hover,
.markdown-action-btn--primary:focus {
    border-color: #3a6ea7;
    background: #275c96;
    color: #fff;
}

.markdown-action-btn--accent {
    border-color: #5a5a5a;
    background: #2d2d2d;
}

.markdown-action-btn--subtle,
.markdown-action-btn--ghost {
    border-color: #454545;
    background: transparent;
    color: #d7d7d7;
}

.markdown-action-btn--subtle:hover,
.markdown-action-btn--subtle:focus,
.markdown-action-btn--ghost:hover,
.markdown-action-btn--ghost:focus {
    border-color: #666;
    background: #262626;
    color: #fff;
}

.markdown-panel {
    overflow: hidden;
    border: 1px solid #2e2e2e;
    border-radius: 4px;
    background: #171717;
    box-shadow: none;
}

.markdown-table {
    margin-bottom: 0;
}

.markdown-table thead th {
    padding-top: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #2f2f2f;
    color: rgba(237, 237, 237, 0.7);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: none;
}

.markdown-table tbody td {
    padding-top: 16px;
    padding-bottom: 16px;
    border-top-color: #252525;
    vertical-align: middle;
}

.markdown-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.markdown-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
}

.markdown-status--live {
    background: rgba(43, 178, 123, 0.12);
    color: #98dcb9;
}

.markdown-status--draft {
    background: rgba(255, 155, 0, 0.1);
    color: #f2c27d;
}

.markdown-status--muted {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(237, 237, 237, 0.72);
}

@media (max-width: 767px) {
    .markdown-page-header {
        align-items: flex-start;
    }

    .markdown-action-stack {
        justify-content: flex-start;
    }

    .markdown-action-btn {
        width: 100%;
    }

    .markdown-icon-btn {
        width: 38px;
    }
}
