/**
 * 抽屉菜单样式
 * Drawer Menu Styles
 * Version: 4.5.0
 * 更新: 返回按钮SVG使用主题图标变量，与透明页头图标样式一致
 */

/* ==================== 触发按钮 ==================== */
.drawer-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    color: #000; /* 默认黑色 */
}

/* 首页透明页头：白色图标 */
[data-transparent-row="yes"] .drawer-menu-trigger {
    color: #fff;
}

/* 首页滚动后（页头固定变白）：黑色图标 */
[data-transparent-row="yes"][data-sticky].sticky .drawer-menu-trigger,
[data-transparent-row="yes"] .ct-sticky-container[data-sticky="yes"] .drawer-menu-trigger,
.ct-sticky-container[data-sticky="yes"] .drawer-menu-trigger {
    color: #000;
}

.drawer-menu-trigger:hover {
    opacity: 0.7;
}

.drawer-menu-icon {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 24px;
}

.drawer-menu-icon span {
    display: block;
    width: 100%;
    height: 3px;
    background: currentColor;
    border-radius: 1px;
    transition: all 0.3s ease;
}

/* 隐藏菜单文字 */
.drawer-menu-text {
    display: none;
}

.drawer-menu-trigger.active .drawer-menu-icon span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.drawer-menu-trigger.active .drawer-menu-icon span:nth-child(2) {
    opacity: 0;
}

.drawer-menu-trigger.active .drawer-menu-icon span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ==================== 遮罩层 ==================== */
.drawer-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9998;
}

.drawer-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==================== 抽屉容器 ==================== */
.drawer-menu-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 450px;
    max-width: 85vw;
    background: #1c1c1c !important;
    background-color: #1c1c1c !important;
    box-shadow: none !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: column;
    overflow: visible;
    visibility: visible !important;
    opacity: 1 !important;
}

.drawer-menu-container.active {
    transform: translateX(0) !important;
}

/* ==================== 抽屉头部 ==================== */
.drawer-menu-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    height: 76px;
    padding: 0 30px;
    background: #1c1c1c !important;
    flex-shrink: 0;
}

.drawer-menu-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    order: 2;
    flex: 1;
    text-align: center;
    margin-right: 36px;
}

.drawer-menu-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #fff;
    order: 1;
}

.drawer-menu-close svg {
    width: 20px;
    height: 20px;
    fill: #979797;
    transition: fill 0.2s ease;
}

.drawer-menu-close:hover svg {
    fill: #ffffff;
}

/* ==================== 菜单内容区 ==================== */
.drawer-menu-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 44px 30px 30px 30px;
    position: relative;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: #1c1c1c !important;
}

/* 菜单导航容器 */
.drawer-menu-nav {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: transparent !important;
}

/* 菜单面板容器 */
.drawer-menu-panels {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
}

/* 单个菜单面板 */
.drawer-menu-panel {
    min-width: 100%;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30px;
}

.drawer-menu-panel::-webkit-scrollbar {
    width: 6px;
}

.drawer-menu-panel::-webkit-scrollbar-track {
    background: #2e2e2e;
}

.drawer-menu-panel::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

.drawer-menu-panel::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* ==================== 菜单列表 ==================== */
.drawer-menu-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: transparent !important;
}

.drawer-menu-list li {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    list-style: none !important;
}

.drawer-menu-list > li {
    position: relative;
}

.drawer-menu-list > li:not(:last-child):after {
    content: '';
    display: block;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0;
}

/* 返回按钮 */
.drawer-menu-back {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 0;
    margin-bottom: 10px;
    color: #ffffffa6;
    background: transparent;
    border: none;
    border-bottom: 0;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    transition: all 0.2s ease;
}

.drawer-menu-back:hover {
    color: #ffffff;
}

.drawer-menu-back svg {
    width: var(--theme-icon-size, 15px);
    height: var(--theme-icon-size, 15px);
    flex-shrink: 0;
    fill: #ffffff;
    transition: var(--theme-icon-transition, fill 0.12s cubic-bezier(0.455, 0.03, 0.515, 0.955));
    display: block;
    vertical-align: middle;
}

.drawer-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    color: #ffffffa6;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 15px;
    border-left: 0;
}

.drawer-menu-link:hover {
    color: #ffffff;
}

.menu-item-text {
    flex: 1;
    font-weight: 500;
    text-transform: uppercase;
}

/* ==================== 子菜单切换图标 ==================== */
.submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    flex-shrink: 0;
    color: inherit; /* 继承父元素颜色 */
}

.submenu-toggle svg {
    width: 100%;
    height: 100%;
    fill: currentColor; /* 使用当前文字颜色 */
    transition: fill 0.2s ease;
}

/* 悬停时颜色跟随链接悬停色 */
.drawer-menu-link:hover .submenu-toggle svg {
    fill: currentColor;
}

/* 隐藏默认子菜单（使用面板方式） */
.drawer-menu-container .drawer-submenu {
    display: none !important;
}

/* 但在子菜单面板中要显示 */
.drawer-submenu-panel .drawer-submenu {
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
    background: transparent !important;
    padding: 0 !important;
}

/* ==================== 子菜单面板 ==================== */
.drawer-submenu-panel {
    position: fixed;
    top: 0;
    left: 450px;
    bottom: 0;
    width: 450px;
    max-width: 85vw;
    background: #1c1c1c;
    box-shadow: none !important;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateX(-100%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30px 0px 30px 0px;
}

.drawer-submenu-panel .drawer-menu-header {
    display: none;
}

.drawer-submenu-panel.active {
    transform: translateX(0);
    opacity: 1;
    box-shadow: none !important;
}

.drawer-submenu-panel .drawer-menu-nav {
    padding: 0 !important;
}

.drawer-submenu-panel .drawer-menu-list > li:not(:last-child):after {
    content: '';
    display: block;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0;
}

.drawer-submenu-panel .drawer-menu-list > li:last-child {
    border-bottom: none;
}

/* 子菜单面板滚动条 */
.drawer-submenu-panel::-webkit-scrollbar {
    width: 6px;
}

.drawer-submenu-panel::-webkit-scrollbar-track {
    background: #2e2e2e;
}

.drawer-submenu-panel::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

.drawer-submenu-panel::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* ==================== 当前菜单项 ==================== */
.drawer-menu-list .current-menu-item > a,
.drawer-menu-list .current_page_item > a {
    color: #ffffff;
    font-weight: 600;
}

/* ==================== 移动端专用样式 ==================== */
@media (max-width: 768px) {
    /* 遮罩层 */
    html body .drawer-menu-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.5) !important;
        z-index: 999998 !important;
    }
    
    html body .drawer-menu-overlay.active {
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    /* 抽屉容器 - 移动端 85% 宽度 */
    html body .drawer-menu-container {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        right: auto !important;
        width: 85vw !important;
        max-width: 85vw !important;
        height: 100vh !important;
        background: #1c1c1c !important;
        background-color: #1c1c1c !important;
        background-image: none !important;
        z-index: 999999 !important;
        display: flex !important;
        flex-direction: column !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease !important;
        overflow: hidden !important;
    }
    
    html body .drawer-menu-container.active {
        transform: translateX(0) !important;
    }
    
    /* 头部 */
    html body .drawer-menu-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        min-height: 60px !important;
        padding: 15px 20px !important;
        background: #1c1c1c !important;
        background-color: #1c1c1c !important;
        border-bottom: 1px solid rgba(255,255,255,0.1) !important;
        flex-shrink: 0 !important;
    }
    
    /* 关闭按钮 */
    html body .drawer-menu-close {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 40px !important;
        height: 40px !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        color: #fff !important;
    }
    
    html body .drawer-menu-close svg {
        width: 20px !important;
        height: 25px !important;
        stroke: #fff !important;
    }
    
    /* 内容区 */
    html body .drawer-menu-content {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 20px !important;
        background: #1c1c1c !important;
        background-color: #1c1c1c !important;
    }
    
    /* 导航容器 */
    html body .drawer-menu-nav {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        background: transparent !important;
        padding: 0 !important;
    }
    
    /* 菜单列表 */
    html body .drawer-menu-list {
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        background: transparent !important;
    }
    
    /* 菜单项 */
    html body .drawer-menu-list > li {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    }
    
    /* 菜单链接 */
    html body .drawer-menu-link {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 18px 20px !important;
        color: rgba(255, 255, 255, 0.7) !important;
        text-decoration: none !important;
        font-size: 15px !important;
        font-weight: 500 !important;
        background: transparent !important;
        border: none !important;
        text-transform: uppercase !important;
    }
    
    html body .drawer-menu-link:hover,
    html body .drawer-menu-link:active {
        color: #ffffff !important;
        background: rgba(255,255,255,0.05) !important;
    }
    
    /* 菜单文字 */
    html body .menu-item-text {
        flex: 1 !important;
        display: block !important;
        visibility: visible !important;
        color: inherit !important;
    }
    
    /* 子菜单箭头 */
    html body .submenu-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 20px !important;
        height: 20px !important;
        color: inherit !important;
    }
    
    html body .submenu-toggle svg {
        width: 12px !important;
        height: 12px !important;
        fill: currentColor !important;
    }
    
    /* 隐藏默认子菜单 */
    html body .drawer-submenu {
        display: none !important;
    }
    
    /* 子菜单面板 - 移动端 85% 宽度 */
    html body .drawer-submenu-panel {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 85vw !important;
        max-width: 85vw !important;
        height: 100vh !important;
        background: #1c1c1c !important;
        background-color: #1c1c1c !important;
        z-index: 1000000 !important;
        transform: translateX(100%) !important;
        transition: transform 0.3s ease !important;
        padding: 30px 0px 30px 0px !important;
    }
    
    html body .drawer-submenu-panel.active {
        transform: translateX(0) !important;
    }
}

/* ==================== 动画优化 ==================== */
@media (prefers-reduced-motion: reduce) {
    .drawer-menu-container,
    .drawer-menu-overlay,
    .drawer-menu-link,
    .submenu-toggle,
    .drawer-submenu {
        transition: none;
    }
}

/* ==================== 无菜单时的提示 ==================== */
.drawer-menu-content .no-menu-message {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}
