/* === Base Styles === */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

a {
    color: #0066cc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* === Layout === */
.layout {
    display: flex;
    min-height: 100vh;
}

/* === Mobile Menu Toggle === */
.menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    line-height: 1;
}

.menu-overlay {
    display: none;
}

/* === Sidebar Menu === */
.markdown-menu {
    width: 280px;
    min-width: 280px;
    background: #fff;
    border-right: 1px solid #e1e4e8;
    padding: 20px;
    overflow-y: auto;
    max-height: 100vh;
    position: sticky;
    top: 0;
}

.markdown-menu ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.markdown-menu ul ul {
    padding-left: 16px;
    display: none;
    margin-top: 4px;
}

.markdown-menu ul ul.expanded {
    display: block;
}

.markdown-menu li {
    cursor: pointer;
    position: relative;
    padding: 6px 8px;
    border-radius: 4px;
    margin: 2px 0;
    font-size: 14px;
}

.markdown-menu li:hover {
    background-color: #f0f4f8;
}

.markdown-menu li.has-children::before {
    content: '\25B6';
    display: inline-block;
    margin-right: 8px;
    font-size: 10px;
    transition: transform 0.2s ease;
    color: #666;
}

.markdown-menu li.has-children.expanded::before {
    transform: rotate(90deg);
}

.markdown-menu a {
    color: #444;
    display: inline;
}

.markdown-menu a:hover {
    color: #0066cc;
    text-decoration: none;
}

.markdown-menu a.active {
    font-weight: 600;
    color: #0066cc;
    background-color: #e7f1ff;
    padding: 4px 8px;
    margin: -4px -8px;
    border-radius: 4px;
}

/* === Main Content === */
.markdown-content {
    flex: 1;
    padding: 40px 60px;
    max-width: 900px;
    background: #fff;
    min-height: 100vh;
}

/* === Breadcrumb === */
.breadcrumb {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.breadcrumb a {
    color: #0066cc;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb-sep {
    margin: 0 6px;
    color: #bbb;
}

.breadcrumb-current {
    color: #333;
    font-weight: 500;
}

/* === Typography === */
.markdown-content h1 {
    font-size: 2.2em;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 24px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e1e4e8;
}

.markdown-content h2 {
    font-size: 1.6em;
    font-weight: 600;
    color: #1a1a1a;
    margin: 32px 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e1e4e8;
}

.markdown-content h3 {
    font-size: 1.3em;
    font-weight: 600;
    color: #1a1a1a;
    margin: 24px 0 12px 0;
}

.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin: 20px 0 10px 0;
}

.markdown-content p {
    margin: 0 0 16px 0;
}

.markdown-content ul,
.markdown-content ol {
    margin: 0 0 16px 0;
    padding-left: 28px;
    list-style: disc;
}

.markdown-content ol {
    list-style: decimal;
}

.markdown-content li {
    margin: 6px 0;
}

.markdown-content li > ul,
.markdown-content li > ol {
    margin: 6px 0;
}

/* === Links === */
.markdown-content a {
    color: #0066cc;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.markdown-content a:hover {
    border-bottom-color: #0066cc;
    text-decoration: none;
}

/* === Code === */
.markdown-content code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
    background: #f4f6f8;
    padding: 2px 6px;
    border-radius: 4px;
    color: #d63384;
}

.markdown-content pre {
    background: #282c34;
    color: #abb2bf;
    padding: 16px 20px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: 0.875em;
}

/* === Blockquote === */
.markdown-content blockquote {
    margin: 0 0 16px 0;
    padding: 12px 20px;
    border-left: 4px solid #0066cc;
    background: #f4f8fc;
    color: #555;
}

.markdown-content blockquote p:last-child {
    margin-bottom: 0;
}

/* === Tables === */
.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 16px 0;
}

.markdown-content th,
.markdown-content td {
    padding: 10px 14px;
    border: 1px solid #e1e4e8;
    text-align: left;
}

.markdown-content th {
    background: #f4f6f8;
    font-weight: 600;
}

.markdown-content tr:nth-child(even) {
    background: #fafbfc;
}

/* === Horizontal Rule === */
.markdown-content hr {
    border: none;
    border-top: 1px solid #e1e4e8;
    margin: 32px 0;
}

/* === Images === */
.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 16px 0;
}

/* === Directory Listing === */
.directory-listing ul {
    list-style: none;
    padding-left: 0;
}

.directory-listing li {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}

.directory-listing li:last-child {
    border-bottom: none;
}

.directory-listing li:hover {
    background: #f8f9fa;
}

/* === Responsive === */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .menu-overlay.open {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
    }

    .markdown-menu {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
    }

    .markdown-menu.open {
        transform: translateX(0);
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
    }

    .markdown-content {
        padding: 60px 20px 20px;
        max-width: 100%;
        min-height: 100vh;
    }

    .markdown-content h1 {
        font-size: 1.6em;
    }

    .markdown-content h2 {
        font-size: 1.3em;
    }

    .markdown-content pre {
        padding: 12px;
        font-size: 0.8em;
    }

    .markdown-content table {
        display: block;
        overflow-x: auto;
    }
}
