/* 1) reset box‑model only — don’t zero out all margins/padding */
* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

/* 1) body as column so header is full‑width at top */
body {
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
    background: #f9f9f9;
    color: #333;
}

/* Header fills the top */
.header {
    width: 100%;
    padding: 1rem;
    background: #2c3e50;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header img {
    cursor: pointer;
}

/* 1) content area flexes to fill remaining height */
.content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    border-right: 1px solid #ddd;
    background: #fff;
    padding: 1rem;
    overflow-y: auto;
}

.section-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.2s;
    font-size: .9em;

}

.section-item:hover {
    background: #f5f5f5;
}

.section-item.active {
    background: #e8f0fe;
}

.section-item.disabled {
    color: #aaa;
}

/* 2) main editor panel */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: #fff;
    overflow-y: auto;
}

/* 2) home panel (when no section is selected) */
.home {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background: #fff;
}

/* theory box */
.theory {
    border: 1px solid #ddd;
    padding: 1rem;
    border-radius: 4px;
    background: #fafafa;
}

/* editor + preview */
.editor-container {
    display: flex;
    margin-top: 1rem;
    position: relative;
}

.example-editor,
.example-preview {
    flex: 1;
    min-height: 200px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.example-editor {
    margin-right: 1rem;
    font-family: monospace;
    resize: vertical;
}

.example-preview {
    background: #fcfcfc;
    overflow-y: auto;
}

/* toggle + save */
.toggle-container {
    margin-top: 1rem;
}

.save-button {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    border: none;
    background: #3498db;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.save-button:hover {
    background: #2980b9;
}

#save-status {
    margin-top: 0.5rem;
    color: #2c7;
}

/* 3) restore list indentation and spacing */
.home ul,
.home ol,
.theory ul,
.theory ol,
.example-preview ul,
.example-preview ol {
    margin: 0 0 1rem 1.5rem;
    padding: 0;
}

.home li,
.theory li,
.example-preview li {
    margin: 0.25rem 0;
}

.home ul {
    list-style: disc;
}

.home ol {
    list-style: decimal;
}

.theory ul {
    list-style: disc;
}

.theory ol {
    list-style: decimal;
}

.example-preview ul {
    list-style: disc;
}

.example-preview ol {
    list-style: decimal;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 9999;
    font-size: 0.9em;
}

.toast.visible {
    opacity: 1;
}


/* Start with both sidebar & editor hidden. keep at the bottom */
#sidebar,
#content {
    display: none;
}