* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    color: #333;
    background-color: #f0f2f5;
    line-height: 1.7;
}

html {
    scroll-behavior: smooth;
}

.menu-bar {
    background-color: #243342;
    padding: 10px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.menu-bar a {
    color: #ecf0f1;
    text-decoration: none;
    padding: 6px 14px;
    font-size: 0.9em;
    transition: background-color 0.3s;
}

.menu-bar a:hover {
    background-color: #e74c3c;
}

.menu-bar a.active {
    background-color: #e74c3c;
    font-weight: bold;
}

.slide {
    max-width: 1200px;
    margin: 30px auto;
    background: #f9f9f9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    background-color: #364d63;
    color: white;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.slide-number {
    background-color: #e74c3c;
    padding: 4px 14px;
    font-weight: bold;
    font-size: 0.95em;
    white-space: nowrap;
}

.slide-title {
    font-size: 1.15em;
    font-weight: 600;
    border-bottom: 2px solid #e74c3c;
    padding-bottom: 4px;
}

.slide .content {
    display: flex;
    flex-wrap: wrap;
    padding: 24px;
    gap: 24px;
}

.text {
    flex: 3;
    min-width: 300px;
    max-width: 100%;
}

.illustration {
    flex: 2;
    min-width: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.illustration img {
    max-width: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    max-width: 400px;
}

h2 {
    color: #2c3e50;
    margin-bottom: 12px;
    font-size: 1.15em;
}

h3 {
    color: #2c3e50;
    margin-bottom: 12px;
    font-size: 1.15em;
}

p {
    margin-bottom: 10px;
    text-align: justify;
}

ul, ol {
    margin: 10px 0 10px 20px;
}

li {
    margin-bottom: 6px;
}

pre.cli {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 16px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.92em;
    line-height: 1.6;
    margin: 12px 0;
    border-left: 5px solid #e74c3c;
}

.cmd {
    color: #569cd6;
}

.def {
    color: #dcdcaa;
}

.str {
    color: #ce9178;
}

.comment, .com {
    color: #6a9955;
    font-style: italic;
}

.num {
    color: #b5cea8;
}

.attr {
    color: #9cdcfe;
}

.note {
    background-color: #fff3cd;
    border-left: 5px solid #ffc107;
    padding: 15px;
    margin: 12px 0;
}

.extended {
    background-color: #eef5fa;
    padding: 24px 24px;
    padding-right: 20%;
    border-top: 2px solid #2c3e50;
    display: none;
}

.extended p {
    margin-bottom: 8px;
    font-size: 0.95em;
}

.extended.hidden {
    display: block;
}

.ext-btn {
    margin-left: auto;
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 0.9em;
}

.illustration-placeholder {
    background: #e8eef3;
    border: 2px dashed #2c3e50;
    padding: 40px 20px;
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    font-size: 0.95em;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.slide .illustration {
    flex: 2;
    min-width: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

table th {
    background-color: #2c3e50;
    color: white;
    padding: 8px;
    border: 1px solid #ddd;
    font-size: 0.9em;
}

table td {
    padding: 8px;
    border: 1px solid #ddd;
    font-size: 0.88em;
}

table tr:nth-child(even) {
    background-color: #f0f2f5;
}

code {
    color: #ee0000;
}

.str_img {
    display: flex;
    justify-content: center;
    align-items: center;
}

.str_img img {
    width: 300px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .slide .content {
        flex-direction: column;
    }

    .slide .illustration {
        order: -1;
    }
}

pre {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 16px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.92em;
    line-height: 1.6;
    margin: 12px 0;
    border-left: 5px solid #e74c3c;
}

pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    color: inherit;
    font-weight: inherit;
}

.important-box {
    background-color: #fff3cd;
    border-left: 5px solid #ffc107;
    padding: 15px;
    margin: 12px 0;
}

.illustration-placeholder img {
    max-width: 100%;
    max-height: 100%;
}

.illustration-placeholder .diagram {
    font-family: 'Courier New', monospace; white-space: pre;
    font-size: 12px; line-height: 1.4; color: #333; text-align: left; overflow-x: auto;
    width: 100%;
}

.code-block {
    background: #1e1e1e; border-radius: 6px; margin: 8px 0;
    overflow-x: auto; font-family: 'Consolas', 'Courier New', monospace; font-size: 13px;
}
.code-block .bar {
    background: #2d2d44; padding: 4px 12px; font-size: 11px; color: #888; border-radius: 6px 6px 0 0;
}
.code-block pre { margin: 0; padding: 10px 14px; overflow-x: auto; }
.code-block code { color: #e6e6e6; white-space: pre; }

.separator { border: none; height: 2px; background: linear-gradient(to right, transparent, #e74c3c, transparent); margin: 24px 0; }

/* === SIDEBAR LAYOUT (index, search, ndx) === */
body.sidebar-layout {
    background-color: #f4f7f6;
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 400px;
    background-color: #1a1a2e;
    color: white;
    padding: 25px 20px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    top: 0;
    left: 0;
}

.sidebar h1 {
    font-size: 20px;
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 1px solid #0f3460;
    padding-bottom: 15px;
    color: #e94560;
}

.sidebar .subtitle {
    font-size: 12px;
    text-align: center;
    color: #888;
    margin-bottom: 20px;
}

.sidebar .section-title {
    font-size: 13px;
    text-align: left;
    color: #e94560;
    margin-top: 18px;
    margin-bottom: 8px;
    font-weight: bold;
    border-bottom: 1px solid #0f3460;
    padding-bottom: 4px;
}

.menu { list-style: none; padding: 0; margin: 0; }
.menu li { margin-bottom: 6px; }
.menu a {
    display: block;
    padding: 10px 14px;
    color: #ecf0f1;
    text-decoration: none;
    background-color: #243342;
    transition: background-color 0.3s;
    font-size: 0.85em;
}
.menu a:hover, .menu a.active { background-color: #e94560; }

.content-area {
    flex: 1;
    padding: 40px;
    margin-left: 400px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.welcome-box {
    background-color: white;
    padding: 40px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 100%;
}
.welcome-box h1 { color: #1a1a2e; margin-bottom: 8px; }
.welcome-box h2 {
    color: #0f3460;
    margin-top: 0;
    margin-bottom: 10px;
    font-weight: normal;
    border-bottom: 2px solid #e94560;
    padding-bottom: 10px;
}
.welcome-box h3 { color: #e94560; margin-bottom: 20px; font-weight: normal; font-size: 1em; }
.welcome-box p { font-size: 16px; line-height: 1.8; color: #555; margin-bottom: 14px; }

.sidebar .footer {
    margin-top: auto;
    text-align: center;
    padding-top: 20px;
    font-size: 0.85em;
    color: #7f8c8d;
    border-top: 1px solid #0f3460;
    padding-bottom: 20px;
    margin-bottom: 25px;
}
.sidebar .footer a { color: #7f8c8d; text-decoration: none; }

@media (max-width: 768px) {
    .sidebar { width: 100%; position: relative; height: auto; }
    .content-area { margin-left: 0; padding: 20px; }
}
