/* ==========================================================================   
   移动端侧边栏导航样式
   ========================================================================== */

/* 基础设置 - 移动优先 */
@media (max-width: 768px) {

    /* 汉堡菜单按钮样式 */
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 30px;
        height: 30px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        margin-left: auto;
        margin-right: 10px;
        z-index: 1001;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .hamburger-line {
        width: 30px;
        height: 3px;
        background-color: #333;
        border-radius: 3px;
        transition: all 0.3s ease-in-out;
    }

    /* 汉堡菜单激活状态 */
    .mobile-menu-toggle.active .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px);
    }

    .mobile-menu-toggle.active .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translate(8px, -8px);
    }

    /* 侧边栏样式 */
    .mobile-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        /* 初始隐藏在屏幕左侧 */
        width: 280px;
        height: 100vh;
        background-color: rgba(255, 255, 255, 0.98);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        transition: left 0.3s ease-in-out;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: none;
        touch-action: pan-y;
    }

    /* 侧边栏激活状态 */
    .mobile-sidebar.active {
        left: 0;
    }

    /* 侧边栏头部 */
    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
        background-color: rgba(227, 227, 227, 0.95);
        border-bottom: 1px solid #ddd;
    }

    .sidebar-header h3 {
        margin: 0;
        font-size: 18px;
        color: #333;
    }

    /* 侧边栏内容区域 */
    .sidebar-content {
        padding: 0;
    }

    .sidebar-navlist {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .sidebar-nav-item {
        border-bottom: 1px solid #eee;
        position: relative;
    }

    .sidebar-nav-item>a {
        display: block;
        padding: 15px 20px;
        color: #333;
        text-decoration: none;
        font-size: 16px;
        transition: background-color 0.2s;
    }

    @media (hover: hover) {
        .sidebar-nav-item>a:hover {
            background-color: rgba(32, 159, 233, 0.1);
        }
    }

    .sidebar-nav-item>a:active {
        background-color: rgba(32, 159, 233, 0.15);
    }

    /* 侧边栏下拉切换按钮 */
    .sidebar-dropdown-toggle {
        position: absolute;
        right: 0;
        top: 0;
        height: 100%;
        width: 50px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 15px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #333;
        transition: transform 0.3s ease;
        z-index: 10;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .sidebar-dropdown-toggle .fa-icon {
        font-size: 14px;
        transition: transform 0.3s ease;
    }

    /* 为菜单项文本添加右侧内边距，避免与箭头重叠 */
    .sidebar-nav-item>a {
        padding-right: 60px;
    }

    .sidebar-nav-item.expanded .sidebar-dropdown-toggle .fa-icon {
        transform: rotate(180deg);
    }

    /* 侧边栏下拉菜单 */
    .sidebar-droplist {
        list-style: none;
        margin: 0;
        padding: 0;
        background-color: rgba(248, 248, 248, 0.95);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
        opacity: 0;
    }

    .sidebar-nav-item.expanded .sidebar-droplist {
        max-height: 500px;
        opacity: 1;
        transition: max-height 0.4s ease-in, opacity 0.3s ease-in;
    }

    .sidebar-droplist li {
        border-bottom: 1px solid #eee;
    }

    .sidebar-droplist li:last-child {
        border-bottom: none;
    }

    .sidebar-droplist li a {
        display: flex;
        align-items: center;
        padding: 12px 20px;
        color: #555;
        text-decoration: none;
        font-size: 14px;
        transition: background-color 0.2s ease, color 0.2s ease;
        position: relative;
    }

    .sidebar-droplist li a::before {
        content: "";
        display: inline-block;
        width: 6px;
        height: 6px;
        border: 2px solid rgb(32, 159, 233);
        border-radius: 50%;
        margin-right: 12px;
        flex-shrink: 0;
        transition: transform 0.2s ease;
    }

    @media (hover: hover) {
        .sidebar-droplist li a:hover {
            background-color: rgba(32, 159, 233, 0.1);
            color: rgb(32, 159, 233);
        }

        .sidebar-droplist li a:hover::before {
            border-color: rgb(32, 159, 233);
            transform: scale(1.1);
        }
    }

    .sidebar-droplist li a:active {
        background-color: rgba(32, 159, 233, 0.15);
    }

    /* 侧边栏遮罩层 */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* 黑暗模式下的侧边栏样式 */
    [data-dark-mode="true"] .mobile-sidebar {
        background-color: rgba(30, 30, 30, 0.98);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }

    [data-dark-mode="true"] .sidebar-header {
        background-color: rgba(45, 45, 45, 0.95);
        border-bottom: 1px solid #404040;
    }

    [data-dark-mode="true"] .sidebar-header h3 {
        color: #e0e0e0;
    }

    [data-dark-mode="true"] .sidebar-nav-item {
        border-bottom: 1px solid #404040;
    }

    [data-dark-mode="true"] .sidebar-nav-item>a {
        color: #e0e0e0;
    }

    @media (hover: hover) {
        [data-dark-mode="true"] .sidebar-nav-item>a:hover {
            background-color: rgba(32, 159, 233, 0.2);
        }
    }

    [data-dark-mode="true"] .sidebar-nav-item>a:active {
        background-color: rgba(32, 159, 233, 0.25);
    }

    [data-dark-mode="true"] .sidebar-dropdown-toggle {
        color: #e0e0e0;
    }

    /* 深色模式下菜单项文本右侧内边距 */
    [data-dark-mode="true"] .sidebar-nav-item>a {
        padding-right: 60px;
    }

    [data-dark-mode="true"] .sidebar-droplist {
        background-color: rgba(40, 40, 40, 0.95);
    }

    [data-dark-mode="true"] .sidebar-droplist li {
        border-bottom: 1px solid #404040;
    }

    [data-dark-mode="true"] .sidebar-droplist li a {
        color: #e0e0e0;
    }

    [data-dark-mode="true"] .sidebar-droplist li a::before {
        border-color: rgb(32, 159, 233);
    }

    @media (hover: hover) {
        [data-dark-mode="true"] .sidebar-droplist li a:hover {
            background-color: rgba(32, 159, 233, 0.2);
            color: rgb(32, 159, 233);
        }

        [data-dark-mode="true"] .sidebar-droplist li a:hover::before {
            border-color: rgb(32, 159, 233);
        }
    }

    [data-dark-mode="true"] .sidebar-droplist li a:active {
        background-color: rgba(32, 159, 233, 0.25);
    }

    [data-dark-mode="true"] .hamburger-line {
        background-color: #e0e0e0;
    }

    /* 小屏幕设备上的进一步优化 */
    @media (max-width: 480px) {
        .mobile-sidebar {
            width: 260px;
            /* 在小屏幕上稍微减小宽度 */
        }

        .sidebar-header {
            padding: 12px 15px;
            /* 减小头部内边距 */
        }

        .sidebar-header h3 {
            font-size: 16px;
            /* 减小标题字体大小 */
        }

        .sidebar-nav-item>a {
            padding: 12px 15px;
            /* 减小链接内边距 */
            font-size: 15px;
            /* 减小字体大小 */
        }

        .sidebar-droplist li a {
            padding: 10px 15px 10px 25px;
            /* 减小下拉菜单链接内边距 */
            font-size: 13px;
            /* 减小字体大小 */
        }
    }

    /* 超小屏幕设备上的优化 */
    @media (max-width: 360px) {
        .mobile-sidebar {
            width: 240px;
            /* 在超小屏幕上进一步减小宽度 */
        }

        .sidebar-header {
            padding: 10px 12px;
            /* 进一步减小头部内边距 */
        }

        .sidebar-header h3 {
            font-size: 15px;
            /* 进一步减小标题字体大小 */
        }

        .sidebar-nav-item>a {
            padding: 10px 12px;
            /* 进一步减小链接内边距 */
            font-size: 14px;
            /* 进一步减小字体大小 */
        }

        .sidebar-droplist li a {
            padding: 8px 12px 8px 22px;
            /* 进一步减小下拉菜单链接内边距 */
            font-size: 12px;
            /* 进一步减小字体大小 */
        }
    }
}

/* 桌面端样式 - 隐藏移动端导航菜单 */
@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none;
    }

    .mobile-sidebar {
        display: none;
    }

    .sidebar-overlay {
        display: none;
    }
}