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

:root {
    --sidebar-width: 300px;
    --header-height: 60px;
    --primary-color: #2980b9;
    --sidebar-bg: #343131;
    --sidebar-text: #b3b3b3;
    --sidebar-hover: #4e4a4a;
    --sidebar-active: #2980b9;
    --content-bg: #fcfcfc;
    --text-color: #404040;
    --border-color: #e1e4e5;
}

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--content-bg);
}

/* Header */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #2980b9;
    color: white;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 20px;
    gap: 20px;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    flex-direction: column;
    gap: 4px;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
}

.site-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.header-search {
    flex: 1;
    max-width: 400px;
    margin-left: auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 0.9rem;
}

.search-input::placeholder {
    color: rgba(255,255,255,0.7);
}

.search-input:focus {
    outline: none;
    background: rgba(255,255,255,0.3);
}

.search-results {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #2c2c2c;
    border: 1px solid #444;
    border-radius: 4px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
}

.search-result-item {
    display: block;
    padding: 12px 16px;
    color: #e0e0e0;
    text-decoration: none;
    border-bottom: 1px solid #444;
    transition: background 0.15s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #3a3a3a;
}

.search-result-title {
    font-weight: 500;
    font-size: 0.95rem;
    display: block;
}

.search-result-page {
    font-size: 0.8rem;
    color: #999;
    margin-top: 4px;
    display: block;
}

.search-result-title mark {
    background: var(--primary-color);
    color: white;
    padding: 2px 4px;
    border-radius: 2px;
}

.search-no-results {
    padding: 16px;
    color: #999;
    text-align: center;
    font-size: 0.9rem;
}

/* Layout Container */
.layout-container {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 50;
}

.sidebar-content {
    padding: 20px 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-section {
    padding: 0 15px;
}

.nav-section-title {
    font-size: 0.85rem;
    font-weight: bold;
    color: #999;
    text-transform: uppercase;
    margin: 15px 0 10px 0;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    background: var(--sidebar-active);
    color: white;
}

.nav-folder {
    margin: 5px 0;
}

.nav-folder-header {
    display: flex;
    align-items: stretch;
    border-radius: 4px;
    overflow: hidden;
}

.nav-folder-link {
    flex: 1;
    padding: 10px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.nav-folder-link:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-folder-link.active {
    background: var(--sidebar-active);
    color: white;
}

.folder-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    min-width: 40px;
    align-self: stretch;
}

.folder-toggle:hover {
    background: var(--sidebar-hover);
    color: white;
}

.folder-toggle svg {
    transition: transform 0.3s ease;
    display: block;
}

.nav-folder.expanded .folder-toggle svg {
    transform: rotate(180deg);
}

.nav-folder-items {
    list-style: none;
    margin: 0;
    padding: 0;
    margin-left: 15px;
    margin-top: 3px;
    margin-bottom: 5px;
    display: none;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
}

.nav-folder.expanded .nav-folder-items {
    display: block;
}

.nav-folder-items li {
    margin: 0;
}

.nav-folder-items .nav-item {
    padding: 6px 12px;
    margin-left: 10px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    background: white;
    min-height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    flex: 1;
    max-width: 900px;
    padding: 40px;
}

/* Document Content */
.doc-content {
    padding-bottom: 40px;
}

.doc-title {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 20px;
    line-height: 1.2;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.doc-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    font-size: 0.9rem;
    color: #777;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.doc-body {
    font-size: 1.05rem;
    line-height: 1.7;
}

/* Markdown Styles */
.markdown h1 {
    font-size: 2rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.markdown h2 {
    font-size: 1.6rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #2c3e50;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.markdown h3 {
    font-size: 1.3rem;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    color: #34495e;
}

.markdown p {
    margin-bottom: 1.2rem;
}

.markdown ul, .markdown ol {
    margin-left: 2rem;
    margin-bottom: 1.2rem;
}

.markdown li {
    margin-bottom: 0.5rem;
}

.markdown a {
    color: var(--primary-color);
    text-decoration: none;
}

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

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.2rem 0;
}

/* Code Blocks */
pre {
    background: #f8f8f8;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-color);
    color: #333;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1.2rem 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

p code, li code {
    background: #f8f8f8;
    color: #e74c3c;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #e1e4e5;
    font-size: 0.9em;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: white;
    border: 1px solid var(--border-color);
}

th, td {
    padding: 12px;
    text-align: left;
    border: 1px solid var(--border-color);
}

th {
    background: #f8f8f8;
    font-weight: 600;
    color: #2c3e50;
}

tr:nth-child(even) {
    background: #fafafa;
}

/* Document List */
.doc-list {
    margin-top: 30px;
}

.doc-list-item {
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 15px;
    background: #fafafa;
    transition: box-shadow 0.2s;
}

.doc-list-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.doc-list-item h3 {
    margin: 0 0 8px 0;
}

.doc-list-item h3 a {
    color: var(--primary-color);
    text-decoration: none;
}

.doc-list-item h3 a:hover {
    text-decoration: underline;
}

.doc-date {
    font-size: 0.9rem;
    color: #777;
}

.doc-summary {
    margin-top: 10px;
    color: #666;
}

/* Document Navigation */
.doc-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.doc-nav-prev, .doc-nav-next {
    padding: 10px 15px;
    background: #f8f8f8;
    border-radius: 4px;
    color: var(--primary-color);
    text-decoration: none;
    transition: background 0.2s;
}

.doc-nav-prev:hover, .doc-nav-next:hover {
    background: #e8e8e8;
}

/* Footer */
.site-footer {
    background: #f8f8f8;
    color: #666;
    padding: 20px 40px;
    text-align: center;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

.site-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

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

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .content-wrapper {
        padding: 20px;
    }

    .doc-title {
        font-size: 1.8rem;
    }

    .header-search {
        display: none;
    }

    .doc-navigation {
        flex-direction: column;
        gap: 10px;
    }
}

/* Scrollbar Styling for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #2c2929;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #666;
}
