body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.sidebar {
    height: 100vh;
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    background-color: #343a40;
    transition: left 0.3s ease;
    z-index: 1050;
    overflow-y: auto;
}

.sidebar.show {
    left: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

.sidebar-overlay.show {
    display: block;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
}

.sidebar .nav-link:hover {
    color: #ffffff;
}

/* CodeMirror JSON Editor */
#jsonPromptEditor .CodeMirror {
    height: 300px;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-size: 14px;
}

#jsonPromptEditor .CodeMirror.cm-invalid {
    border-color: #dc3545;
}

#jsonPromptEditor .CodeMirror-gutters {
    border-right: 1px solid #ddd;
}

#jsonPromptEditor .CodeMirror-linenumber {
    padding: 0 8px 0 5px;
    min-width: 25px;
    color: #999;
}

/* Master JSON Preview */
#masterJsonPreview .CodeMirror {
    height: 400px;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-size: 13px;
}

/* JSON Output Preview in USE MODE */
#jsonOutputPreview .CodeMirror {
    height: 300px;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-size: 13px;
}

/* ===== EDIT MODE - Visual Editor ===== */
.edit-mode-container {
    max-width: 900px;
}

/* JSON Block - Key/Value */
.json-block {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out;
}

.json-block:hover {
    border-color: #adb5bd;
}

.json-block.is-invalid {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.json-block .block-key {
    flex: 0 0 200px;
    font-weight: 500;
}

.json-block .block-type {
    flex: 0 0 100px;
}

.json-block .block-value {
    flex: 1;
}

.json-block .btn-delete {
    flex: 0 0 auto;
    padding: 0.25rem 0.5rem;
    font-size: 1.2rem;
    line-height: 1;
    color: #dc3545;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0.6;
}

.json-block .btn-delete:hover {
    opacity: 1;
}

.json-block .drag-handle,
.json-section .drag-handle {
    cursor: grab;
    padding: 0.25rem 0.5rem;
    color: #6c757d;
    opacity: 0.5;
}

.json-block .drag-handle:hover,
.json-section .drag-handle:hover {
    opacity: 1;
}

.json-block.sortable-ghost,
.json-section.sortable-ghost {
    opacity: 0.4;
    background-color: #e9ecef;
}

.json-block.sortable-chosen,
.json-section.sortable-chosen {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* JSON Section Block */
.json-section {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background-color: #fff;
    border: 2px solid #0d6efd;
    border-radius: 0.5rem;
}

.json-section .section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.json-section .section-name {
    flex: 1;
    font-weight: 600;
    font-size: 1rem;
}

.json-section .section-children {
    padding-left: 1rem;
    border-left: 2px solid #e9ecef;
}

.json-section .section-children .block-actions {
    margin-top: 0.5rem;
}

/* Nested sections - alternating colors */
.json-section .json-section {
    border-color: #6c757d;
}

.json-section .json-section .json-section {
    border-color: #20c997;
}

.json-section .json-section .json-section .json-section {
    border-color: #fd7e14;
}

/* Empty state */
.empty-state {
    color: #6c757d;
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    padding: 2rem;
}

/* Block actions */
.block-actions .btn {
    font-size: 0.875rem;
}

/* Tab styling */
#modeTabs .nav-link {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#modeTabs .nav-link.active {
    font-weight: 600;
}
