:root {
    --bg-color: #ffffff;
    --text-color: #212529;
    --code-bg: #f8f9fa;
    --border-color: #dee2e6;
}

[data-bs-theme="dark"] {
    --bg-color: #1e1e1e;
    --text-color: #e0e0e0;
    --code-bg: #2d2d2d;
    --border-color: #333333;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.0rem;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-wrapper {
    display: flex;
    flex: 1;
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
    padding: 0 0.5rem;
}

.main-content {
    flex-grow: 1;
    padding: 0 1rem;
    min-width: 0;
}

@media (max-width: 767.98px) {
    .content-wrapper {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
    }
}

@media (min-width: 992px) {
    .container-fluid {
        padding-left: 0;
        padding-right: 0;
    }
    .main-content {
        padding-left: 0.1rem;
        padding-right: 0.1rem;
    }
    .sidebar {
        width: 220px;
        padding-left: 0;
    }
}

/* XX-Large screens: cap the width */
@media (min-width: 1400px) {
    .content-wrapper {
        max-width: 1320px;
        margin-left: auto;
        margin-right: auto;
    }
}

a {
    text-decoration: none;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.post-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.editor-preview pre,
.editor-preview .codehilite pre {
    background: #1e1e1e !important;
    padding: 1rem;
    border-radius: 0.375rem;
    overflow-x: auto;
}

.editor-preview code,
.editor-preview .codehilite code {
    background: #1e1e1e !important;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

[data-bs-theme="light"] .editor-preview pre,
[data-bs-theme="light"] .editor-preview .codehilite pre {
    background: var(--code-bg) !important;
}

[data-bs-theme="light"] .editor-preview code,
[data-bs-theme="light"] .editor-preview .codehilite code {
    background: var(--code-bg) !important;
}

.post-content pre code {
    background: none;
    padding: 0;
}

.post-content blockquote {
    border-left: 4px solid #0d6efd;
    padding-left: 1rem;
    margin-left: 0;
    color: #6c757d;
}

.post-content table {
    width: 100%;
    margin-bottom: 1rem;
}

.post-content table th,
.post-content table td {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
}

.post-content table th {
    background: var(--code-bg);
}

.post-content img {
    max-width: 100%;
    height: auto;
}

.editor-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 0;
    position: relative;
}

.editor-container.preview-only-mode {
    gap: 0 !important;
}

.editor-pane, .preview-pane {
    width: 100%;
    border: none;
    border-radius: 0.375rem;
    padding: 0;
    background: var(--bg-color);
    overflow: hidden;
}

.editor-pane.preview-only-mode,
.editor-pane.preview-only-mode .CodeMirror,
.editor-pane.preview-only-mode .CodeMirror-sizer,
.editor-pane.preview-only-mode .CodeMirror-scroll {
    min-height: 400px !important;
}

.CodeMirror {
    height: calc(100vh - 550px) !important;
    min-height: 400px !important;
}

.CodeMirror-scroll {
    min-height: 400px !important;
    overflow-y: auto !important;
}

.editor-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    opacity: 1 !important;
}

.form-actions-sticky {
    position: sticky;
    bottom: 0;
    background: var(--bg-color);
    padding: 1rem 0;
    z-index: 10;
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
}

[data-bs-theme="dark"] div.CodeMirror,
[data-bs-theme="dark"] .CodeMirror,
[data-bs-theme="dark"] .editor-toolbar,
[data-bs-theme="dark"] .editor-toolbar *,
[data-bs-theme="dark"] .EasyMDEContainer,
[data-bs-theme="dark"] .editor-toolbar i,
[data-bs-theme="dark"] .editor-toolbar .fa {
    background: #333333 !important;
    color: #ffffff !important;
    border-color: #555555 !important;
}

[data-bs-theme="dark"] .CodeMirror-cursor {
    border-left: 2px solid #00ff00 !important;
}

[data-bs-theme="dark"] .editor-toolbar button {
    border: none !important;
    color: #ffffff !important;
    opacity: 1 !important;
    visibility: visible !important;
}

[data-bs-theme="dark"] .editor-toolbar i,
[data-bs-theme="dark"] .editor-toolbar .fa,
[data-bs-theme="dark"] .editor-toolbar span,
[data-bs-theme="dark"] .editor-toolbar svg {
    color: #ffffff !important;
    fill: #ffffff !important;
    opacity: 1 !important;
    visibility: visible !important;
}

[data-bs-theme="dark"] .editor-toolbar a {
    border: none !important;
    color: #ffffff !important;
    opacity: 1 !important;
}

[data-bs-theme="dark"] .editor-toolbar .fa-list,
[data-bs-theme="dark"] .editor-toolbar .fa-list-ol,
[data-bs-theme="dark"] .editor-toolbar .fa-eye {
    color: #ffffff !important;
    opacity: 1 !important;
}

[data-bs-theme="dark"] .editor-toolbar .preview-toggle {
    background: #333333 !important;
}

[data-bs-theme="dark"] .editor-toolbar .active {
    background: #333333 !important;
}

[data-bs-theme="dark"] .EasyMDEContainer .editor-preview {
    background: #333333 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .editor-preview {
    background: #333333 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] div.editor-preview {
    background: #333333 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .editor-toolbar a,
[data-bs-theme="dark"] .editor-toolbar button,
[data-bs-theme="dark"] .editor-toolbar i,
[data-bs-theme="dark"] .editor-toolbar span,
[data-bs-theme="dark"] .editor-toolbar .fa {
    color: #ffffff !important;
}

.preview-pane {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 1rem;
}

.editor-mode-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.hidden-textarea {
    display: none !important;
}

