/* 子页面公共左侧导航优化 */

.sidebar {
    width: 260px;
    padding: 0 12px 18px;
    border-right: 1px solid rgba(15, 23, 42, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 250, 248, 0.98) 100%);
    box-shadow: 10px 0 30px rgba(15, 23, 42, 0.05);
}

.content {
    left: 260px;
    margin: 14px 14px 14px 0;
    padding: 10px 12px 14px;
    border: 1px solid rgba(31, 157, 116, 0.12);
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(244, 251, 248, 0.82) 0%, rgba(236, 246, 252, 0.78) 100%);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.05);
    backdrop-filter: blur(8px);
}

.sidebar-toggle {
    position: fixed;
    top: auto;
    right: auto;
    bottom: 22px;
    left: 18px;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    overflow: visible;
    z-index: 1003;
    opacity: 0.42;
    transition: opacity 0.2s ease;
}

.sidebar-toggle-button {
    width: 52px;
    height: 52px;
    margin: 0;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    background: linear-gradient(135deg, rgba(66, 185, 131, 0.98), rgba(34, 139, 96, 0.94));
    box-shadow: 0 14px 30px rgba(34, 139, 96, 0.28);
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
    opacity: 1;
}

.sidebar-toggle:hover .sidebar-toggle-button {
    opacity: 1;
    background: linear-gradient(135deg, rgba(66, 185, 131, 1), rgba(29, 122, 84, 0.96));
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 18px 34px rgba(34, 139, 96, 0.34);
}

.sidebar-toggle span {
    width: 16px;
    height: 2px;
    margin-bottom: 0;
    border-radius: 999px;
    background: #fff;
}

.search {
    position: sticky;
    top: 0;
    z-index: 3;
    margin: 0 -12px 14px;
    padding: 6px 12px 10px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    background: rgba(var(--bs-sidebar-bg-rgb), 0.94);
    backdrop-filter: blur(12px);
}

.search .input-wrap {
    border: 0;
    border-radius: 14px;
    background: transparent;
    box-shadow: none;
    transition: box-shadow 0.2s ease;
    min-height: 38px;
}

.search .input-wrap:focus-within {
    box-shadow: 0 0 0 4px rgba(66, 185, 131, 0.12);
}

.search input {
    padding: 0 10px 0 12px;
    line-height: 38px;
    font-size: 14px;
    border: 0 !important;
    border-radius: 14px;
    background: transparent !important;
}

.search input:focus {
    border: 0 !important;
    box-shadow: none;
}

.search .clear-button {
    width: 40px;
    text-align: center;
}

.search .results-panel {
    margin-top: 10px;
    padding: 6px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.1);
}

.search .matching-post {
    border-bottom-color: rgba(15, 23, 42, 0.06);
}

.search .results-panel,
.search .results-panel a,
.search .results-panel .matching-post a,
.search .results-panel h2,
.search .results-panel p,
.search .results-panel span,
.search .results-panel .empty {
    color: var(--theme-color) !important;
}

.search .results-panel a:hover,
.search .results-panel .matching-post a:hover {
    color: #2a9f72 !important;
}

.search .results-panel .search-keyword,
.search .results-panel .mark {
    color: #228b60 !important;
}

.search h2 {
    margin: 8px 4px;
    color: var(--bs-title-color);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.search p {
    margin-bottom: 0;
    color: var(--bs-sidebar-link-color);
}

.app-name {
    margin: 0 4px 16px;
    padding: 0 4px;
}

.app-name-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    width: 100%;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(66, 185, 131, 0.12), rgba(66, 185, 131, 0.04));
    color: var(--bs-title-color) !important;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: inset 0 0 0 1px rgba(66, 185, 131, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.app-name-link:hover {
    color: var(--theme-color) !important;
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(66, 185, 131, 0.2), 0 10px 20px rgba(66, 185, 131, 0.1);
}

.sidebar .sidebar-nav {
    padding-bottom: 94px;
}

.sidebar ul {
    margin: 0;
}

#menu > li {
    margin: 0 0 10px;
}

#menu > li > a {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.84);
    color: var(--bs-title-color) !important;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

#menu > li > a:hover {
    color: var(--theme-color) !important;
    text-decoration: none;
    transform: translateY(-1px);
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(66, 185, 131, 0.18), 0 10px 18px rgba(15, 23, 42, 0.06);
}

#menu > li > a[href="#"]::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(80, 93, 107, 0.7);
    border-bottom: 2px solid rgba(80, 93, 107, 0.7);
    transform: translateY(-60%) rotate(45deg);
    transition: transform 0.18s ease, border-color 0.18s ease;
}

#menu > li > a[href="#"]:hover::after {
    border-color: rgba(66, 185, 131, 0.95);
}

#menu > li > ul,
.sidebar ul li ul {
    margin-top: 8px;
    padding: 8px 0 4px 12px;
    border-left: 1px dashed rgba(66, 185, 131, 0.24);
}

.sidebar ul li ul li {
    margin: 2px 0;
}

.sidebar ul li ul li a {
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 12px;
    color: var(--bs-sidebar-link-color);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.55;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    transition: background-color 0.18s ease, color 0.18s ease, padding-left 0.18s ease;
}

.sidebar ul li ul li a:hover {
    padding-left: 16px;
    color: var(--theme-color);
    background: rgba(66, 185, 131, 0.08);
    text-decoration: none;
}

.sidebar ul li.active > a {
    border-right: 0;
    color: var(--theme-color) !important;
    background: rgba(66, 185, 131, 0.1);
    box-shadow: inset 3px 0 0 rgba(66, 185, 131, 0.95);
}

.app-sub-sidebar li:before {
    content: "";
    width: 6px;
    height: 6px;
    margin: 15px 8px 0 0;
    padding-right: 0;
    float: left;
    border-radius: 999px;
    background: rgba(66, 185, 131, 0.42);
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(80, 93, 107, 0.16);
    border-radius: 999px;
}

.sidebar:hover::-webkit-scrollbar-thumb {
    background: rgba(80, 93, 107, 0.3);
}

body.close .sidebar {
    transform: translateX(-260px);
}

body.close .content {
    left: 0;
}

.content > .markdown-section {
    position: relative;
    z-index: 1;
    min-height: 100%;
    max-width: none;
    padding: 18px 22px 22px;
    border: 1px solid rgba(31, 157, 116, 0.2);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.99) 0%, rgba(234, 247, 241, 0.98) 48%, rgba(232, 241, 252, 0.96) 100%);
    box-shadow:
        0 18px 38px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.content > .markdown-section::before {
    content: none;
}

@media screen and (max-width: 768px) {
    .sidebar {
        width: 286px;
        padding: 0 10px 18px;
    }

    .content {
        left: 0 !important;
        width: 100%;
        max-width: 100vw;
        margin: 8px;
        padding: 8px 8px 10px;
        border-radius: 18px;
        transform: none !important;
    }

    .content > .markdown-section {
        padding: 14px 14px 16px;
        border-radius: 16px;
    }

    .search {
        margin-left: -10px;
        margin-right: -10px;
        margin-bottom: 14px;
        padding: 6px 10px 10px;
    }

    .sidebar-toggle {
        bottom: 18px;
        left: 14px;
        width: 48px !important;
        height: 48px;
        padding: 0 !important;
        border: 0 !important;
        opacity: 0.88;
    }

    .sidebar-toggle-button,
    body.sidebar-mobile .sidebar-toggle .sidebar-toggle-button {
        width: 48px;
        height: 48px;
        box-shadow: 0 12px 28px rgba(34, 139, 96, 0.3);
    }

    body.sidebar-mobile .sidebar-toggle:hover .sidebar-toggle-button,
    body.sidebar-mobile .sidebar-toggle:focus-visible .sidebar-toggle-button {
        transform: translateY(-1px) scale(1.02);
        background: linear-gradient(135deg, rgba(66, 185, 131, 1), rgba(29, 122, 84, 0.96));
    }

    body.sidebar-mobile .sidebar-toggle span {
        width: 16px;
        background: #fff;
    }

    body.sidebar-mobile .sidebar {
        left: 0;
        max-width: calc(100vw - 72px);
        transform: translateX(calc(-100% - 18px));
        z-index: 1002;
        box-shadow: 18px 0 36px rgba(15, 23, 42, 0.16);
    }

    body.sidebar-mobile .sidebar-toggle {
        z-index: 1003;
    }

    body.sidebar-mobile .content {
        transform: none !important;
    }

    body.sidebar-mobile.close .sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-mobile:not(.close) .sidebar {
        transform: translateX(0);
    }

    body.sidebar-mobile.close .sidebar-toggle,
    body.sidebar-mobile:not(.close) .sidebar-toggle {
        width: 48px !important;
        height: 48px;
        padding: 0 !important;
        background: transparent !important;
    }

    body.sidebar-mobile.close .content,
    body.sidebar-mobile:not(.close) .content {
        left: 0 !important;
        transform: none !important;
    }
}
