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

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: "IBM Plex Mono", "Fira Code", "Consolas", monospace;
    font-size: 1.05rem;
    font-weight: normal;
    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;
}

[data-bs-theme="dark"] .post-content pre,
[data-bs-theme="dark"] .post-content code {
    background-color: #1e1e2e !important; /* Very dark blue */
}

[data-bs-theme="dark"] .post-content pre code {
    background-color: #1e1e2e !important; /* Very dark blue */
    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(--table-header-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;
}

body.editor-fullscreen .form-actions-sticky,
.EasyMDEContainer.fullscreen .form-actions-sticky {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1001 !important;
    padding: 1rem 2rem !important;
    background: var(--bg-color) !important;
    border-top: 1px solid var(--border-color) !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
}

body.editor-fullscreen .CodeMirror,
body.editor-fullscreen .CodeMirror-scroll,
.EasyMDEContainer.fullscreen .CodeMirror,
.EasyMDEContainer.fullscreen .CodeMirror-scroll {
    height: calc(100vh - 120px) !important;
    min-height: auto !important;
}

body.editor-fullscreen,
.EasyMDEContainer.fullscreen {
    overflow: hidden !important;
}

body.editor-fullscreen .editor-toolbar,
.EasyMDEContainer.fullscreen .editor-toolbar {
    position: fixed !important;
    top: 56px !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1100 !important;
}

body.editor-fullscreen .editor-container,
.EasyMDEContainer.fullscreen .editor-container {
    padding-top: 102px;
    padding-bottom: 80px;
    height: 100vh;
    overflow-y: auto;
}

body.editor-fullscreen .navbar,
body.editor-fullscreen nav.navbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1001 !important;
    display: flex !important;
}

body.editor-fullscreen footer,
body.editor-fullscreen .site-footer {
    display: none !important;
}

body.editor-fullscreen .container,
body.editor-fullscreen .container-fluid {
    max-width: 100% !important;
}

.CodeMirror-fullscreen .CodeMirror-lines {
    padding-top: 3em !important;
    padding-bottom: 1em !important;
}

.editor-preview-side {
    padding-top: 3em !important;
    padding-bottom: 3.5em !important;
}

[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;
}

.CodeMirror .cm-link,
.CodeMirror .cm-url {
    color: #0369a1 !important;
}

.CodeMirror .cm-tag,
.CodeMirror .cm-bracket {
    color: #c2410c !important;
}

.CodeMirror .cm-attribute {
    color: #9333ea !important;
}

.CodeMirror .cm-string {
    color: #16a34a !important;
}

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

[data-bs-theme="dark"] .CodeMirror .cm-tag,
[data-bs-theme="dark"] .CodeMirror .cm-bracket {
    color: #7dd3fc !important;
}

[data-bs-theme="dark"] .CodeMirror .cm-attribute {
    color: #fbbf24 !important;
}

[data-bs-theme="dark"] .CodeMirror .cm-string {
    color: #86efac !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 button:empty,
[data-bs-theme="dark"] .editor-toolbar .separator {
    visibility: hidden !important;
}

[data-bs-theme="dark"] .editor-toolbar button:empty::after {
    content: "";
    visibility: hidden;
}

[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,
[data-bs-theme="dark"] .editor-preview,
[data-bs-theme="dark"] div.editor-preview {
    background: #333333 !important;
    color: #ffffff !important;
}

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

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

[data-bs-theme="dark"] .editor-preview-side h1,
[data-bs-theme="dark"] .editor-preview-side h2,
[data-bs-theme="dark"] .editor-preview-side h3,
[data-bs-theme="dark"] .editor-preview-side h4,
[data-bs-theme="dark"] .editor-preview-side h5,
[data-bs-theme="dark"] .editor-preview-side h6 {
    color: #fbbf24 !important;
}

[data-bs-theme="dark"] .editor-preview-side a {
    color: #1dd15e !important;
}

[data-bs-theme="dark"] .editor-preview-side blockquote {
    border-left-color: #555555 !important;
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .editor-preview-side pre,
[data-bs-theme="dark"] .editor-preview-side pre code {
    background: #1e1e2e !important; /* Very dark blue */
    color: #e0e0e0 !important;
    border: 1px solid #555555 !important;
}

[data-bs-theme="dark"] .editor-preview-side code {
    background: #1e1e2e !important; /* Very dark blue */
    color: #e0e0e0 !important;
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

[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;
}

[data-bs-theme="dark"] .preview-pane {
    background: var(--bg-color);
    color: var(--text-color);
}

[data-bs-theme="dark"] .preview-pane h1,
[data-bs-theme="dark"] .preview-pane h2,
[data-bs-theme="dark"] .preview-pane h3,
[data-bs-theme="dark"] .preview-pane h4,
[data-bs-theme="dark"] .preview-pane h5,
[data-bs-theme="dark"] .preview-pane h6 {
    color: #fbbf24;
}

[data-bs-theme="dark"] .preview-pane a {
    color: #1dd15e;
}

[data-bs-theme="dark"] .preview-pane blockquote {
    border-left-color: #555555;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .preview-pane table th,
[data-bs-theme="dark"] .preview-pane table td {
    border-color: #555555;
}

[data-bs-theme="dark"] .preview-pane table thead th {
    background: var(--table-header-bg);
}

[data-bs-theme="dark"] .preview-pane pre,
[data-bs-theme="dark"] .preview-pane pre code {
    background: #2d2d2d !important;
    color: #e0e0e0 !important;
    border: 1px solid #555555 !important;
}

[data-bs-theme="dark"] .preview-pane code {
    background: #2d2d2d !important;
    color: #e0e0e0 !important;
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

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

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

/* Blocked/Readonly input styles */
.form-control[readonly],
.form-control[readonly]:focus {
    caret-color: transparent;
    background-color: #e2e3e5;
}

[data-bs-theme="dark"] .form-control[readonly],
[data-bs-theme="dark"] .form-control[readonly]:focus {
    background-color: #3d3d3d;
}

/* Form Label styles */
.form-label,
.form-title,
.author-name {
    font-weight: bold;
}

.form-label,
.form-title,
.author-name {
    color: #264eb2;
}

[data-bs-theme="dark"] .form-label {
    color: #1dd15e;
}

[data-bs-theme="dark"] .form-title,
[data-bs-theme="dark"] .author-name {
    color: #fbbf24;
}

/* Dark mode headers */
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3 {
    color: #fbbf24;
}

