/* 深色模式 */
:root {
    --sidebar-bg-color: #1a1a1a;
}

/* 浅色模式 */
@media (prefers-color-scheme: light) {
    :root {
        --sidebar-bg-color: #f6f4ef;
    }
}

/* 导航栏样式 */
.sidebar {
    background-color: var(--sidebar-bg-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    box-shadow: 2px 0 5px var(--box-shadow-color);
    transition: background-color var(--transition-duration);
    overflow: hidden;
}

.logo-text {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    cursor: pointer;
}

.logo-text a {
    text-decoration: none;
    color: var(--link-color);
    transition: color var(--transition-duration);
}

.logo-text a:hover {
    text-decoration: underline;
    color: var(--link-hover-color);
}

.sidebar-nav {
    list-style-type: none;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sidebar-nav-item {
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: bold;
}

.sidebar-nav-item a {
    text-decoration: none;
    color: var(--link-color);
    display: block;
    padding: 5px 0;
    transition: color var(--transition-duration);
}

.sidebar-nav-item a:hover {
    text-decoration: underline;
    color: var(--link-hover-color);
}

.sidebar-nav-item a.active {
    color: var(--active-link-text-color);
    background-color: var(--active-link-bg-color);
    border-radius: 5px;
}

.footer {
    font-size: 12px;
    text-align: center;
    margin-top: 20px;
    color: var(--text-color);
}

.mobile-footer {
    display: none;
}

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 18px;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    transition: 0.3s;
}

/* 响应式设计 */
@media (min-width: 768px) and (max-width: 1024px) {
    .hamburger {
        display: none;
    }

    nav {
        display: block !important;
    }

    .sidebar-nav {
        flex-direction: column;
    }

    .sidebar-nav-item {
        margin-bottom: 15px;
    }

    .footer {
        margin-top: 20px;
        padding: 0;
    }

    .mobile-footer {
        display: none;
    }
}

@media (max-width: 767px) {
    .sidebar {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        padding: 0 20px;
        position: fixed;
        width: 100%;
        height: 60px;
        top: 0;
        left: 0;
        z-index: 1000;
    }

    .logo-text {
        margin-bottom: 0;
        text-align: left;
        display: block;
    }

    .hamburger {
        display: flex;
    }

    nav {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        background-color: var(--sidebar-bg-color);
        flex-direction: column;
        padding: 20px 0;
        z-index: 999;
        border-bottom: 1px solid var(--box-shadow-color);
    }

    nav.active {
        display: flex;
    }

    /* Hide the original desktop footer on mobile */
    .footer {
        display: none;
    }

    /* Show and style the mobile footer inside nav */
    .mobile-footer {
        display: block;
        padding: 20px 10px;
        background-color: transparent;
        text-align: center;
        margin-top: auto;
        font-size: 12px;
        color: var(--text-color);
    }

    .sidebar-nav {
        flex-direction: column;
        align-items: stretch;
        padding: 0 20px;
        box-sizing: border-box;
    }

    .sidebar-nav-item {
        margin-bottom: 0;
        text-align: center;
        border-bottom: 1px dashed var(--text-color);
        padding: 15px 0;
    }

    .sidebar-nav-item:last-child {
        border-bottom: 1px dashed var(--text-color);
    }

    .sidebar-nav-item a.active {
        background-color: black;
        color: white;
        padding: 10px 20px;
        border-radius: 0;
        display: inline-block;
    }
}

/* Desktop-only active style for Logo */
@media (min-width: 768px) {
    .logo-text a.active {
        color: var(--active-link-text-color);
        background-color: var(--active-link-bg-color);
        border-radius: 5px;
        padding: 5px 10px;
        display: inline-block;
    }
}
