*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --bg-color: #fff;
    --text-color: #333;
    --border-color: #e0e0e0;
    --sidebar-bg: #f7f7f7;
    --active-bg: #e6f7ff;
    --active-text: #1890ff;
    --header-bg: #fff;
    --danger-bg: #fffbe6;
    --danger-border: #ffe58f;
    --info-bg: #e6f7ff;
    --info-border: #91d5ff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 64px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--header-bg);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-left .logo {
    font-size: 24px;
    margin-right: 16px;
}

.header-left h1 {
    font-size: 18px;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
}

.header-link {
    margin-right: 20px;
    text-decoration: none;
    color: var(--text-color);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
}

.wrapper {
    display: flex;
    flex: 1;
    position: relative;
}

.sidebar-toggle {
    display: none;
}

.sidebar {
    width: 305px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
    transition: transform 0.3s ease;
    position: fixed;
    left: 0;
    top: 64px;
    bottom: 0;
    z-index: 100;
}

.menu-section {
    margin-bottom: 15px;
}

.menu-title {
    font-size: 14px;
    font-weight: bold;
    color: #555;
    margin: 0 0 10px 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-title::after {
    content: 'v';
    font-size: 12px;
    transform: rotate(0deg);
    transition: transform 0.2s;
}

.menu-title.collapsed::after {
    transform: rotate(-90deg);
}

.menu-list {
    list-style-type: none;
    padding-left: 10px;
    margin: 0;
}

.menu-list li a {
    display: block;
    color: var(--text-color);
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
}

.menu-list li a.active {
    background-color: var(--active-bg);
    color: var(--active-text);
    font-weight: 500;
}

.main-content {
    flex: 1;
    padding: 30px;
    margin-left: 300px;
    margin-right: 300px;
    overflow-y: auto;
}

.breadcrumb {
    margin-bottom: 16px;
    color: #888;
}

.breadcrumb a {
    text-decoration: none;
    color: #888;
}

.content-header h1 {
    font-size: 32px;
    margin-bottom: 24px;
}

.info-box {
    padding: 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid;
}

.info-box.danger {
    background-color: var(--danger-bg);
    border-color: var(--danger-border);
}

.info-box.info {
    background-color: var(--info-bg);
    border-color: var(--info-border);
}

.main-article h2 {
    font-size: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-top: 32px;
}

.main-article img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px 0;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.right-toc {
    width: 280px;
    padding: 24px;
    font-size: 14px;
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    position: fixed;
    right: 0;
    top: 64px;
    bottom: 0;
    z-index: 100;
    background-color: var(--bg-color);
}

.right-toc nav ul {
    list-style: none;
    padding: 0;
}

.right-toc nav ul li a {
    color: #555;
    text-decoration: none;
    display: block;
    padding: 4px 0;
}

.footer {
    background-color: var(--sidebar-bg);
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer-container {
    display: flex;
    justify-content: space-around;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-col h3 {
    font-size: 16px;
    margin-bottom: 10px;
}

.footer-col ul {
    list-style: none;
    padding: 0;
}

.footer-col ul li a {
    text-decoration: none;
    color: var(--text-color);
}

.copyright {
    margin-top: 20px;
    font-size: 14px;
}

body.dark-theme {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --border-color: #333;
    --sidebar-bg: #222;
    --active-bg: #003366;
    --active-text: #87cefa;
    --header-bg: #1a1a1a;
    --danger-bg: #4d0000;
    --danger-border: #990000;
    --info-bg: #003366;
    --info-border: #0066cc;
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        margin-right: 0;
    }

    .sidebar {
        transform: translateX(-100%);
        z-index: 1100;
        background-color: var(--bg-color);
    }

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

    .sidebar-toggle {
        display: block;
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 1200;
        background: none;
        border: none;
        font-size: 24px;
    }

    .right-toc {
        display: none;
    }

    .main-content {
        padding: 16px;
    }

    .footer-container {
        flex-direction: column;
    }

    .footer-col {
        margin-bottom: 20px;
    }
}