/**
 * LoliMeow Theme - 移动端侧边栏菜单样式
 * 全新的移动端菜单体验：
 * - 从右侧滑出，全高显示
 * - 子菜单以标签形式展示
 * - 所有子菜单默认展开，无需用户点击
 * - 父级菜单可点击跳转
 */

/* ========== 遮罩层 ========== */
.mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 900;  /* 低于导航栏 (1000) */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========== 侧边栏容器 ========== */
.mobile-sidebar-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    background: linear-gradient(180deg, #0B161F 0%, #1a2332 100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    z-index: 950;  /* 高于遮罩层 (900)，但低于导航栏 (1000) */
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: 70px;  /* 为固定的导航栏留出空间 */
}

.mobile-sidebar-menu.open {
    transform: translateX(0);
}

/* ========== 侧边栏头部 ========== */
/* 不再需要头部，因为导航栏已经有 logo 和关闭按钮 */
.mobile-sidebar-header {
    display: none;
}

/* ========== 侧边栏内容区域 ========== */
.mobile-sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0;
    -webkit-overflow-scrolling: touch;
}

/* 自定义滚动条 */
.mobile-sidebar-content::-webkit-scrollbar {
    width: 4px;
}

.mobile-sidebar-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.mobile-sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(53, 235, 144, 0.3);
    border-radius: 2px;
}

.mobile-sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(53, 235, 144, 0.5);
}

/* ========== 菜单导航 ========== */
.mobile-sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-sidebar-nav > li {
    margin: 0;
    padding: 0;
}

/* ========== 普通菜单项 ========== */
.mobile-sidebar-nav > li > .nav-link {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.mobile-sidebar-nav > li > .nav-link:hover,
.mobile-sidebar-nav > li > .nav-link.active {
    color: var(--theme-primary);
}

.mobile-sidebar-nav > li > .nav-link i {
    margin-right: 10px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    color: inherit;
}

/* ========== 带子菜单的菜单项 ========== */
.mobile-menu-item-with-children {
    margin: 0;
}

/* 所有带子菜单的项目始终展开，无需用户点击 */
.mobile-menu-item-with-children.always-expanded {
    /* 子菜单始终可见 */
}

.mobile-parent-item {
    display: flex;
    flex-direction: column;
}

/* 父级链接 - 可点击跳转的 a 标签（不再有展开/收起功能） */
/* 移除左侧边框和背景色，只在选中时改变文字颜色 */
.mobile-parent-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.mobile-parent-link:hover,
.mobile-parent-link.active {
    color: var(--theme-primary);
}

.mobile-parent-text {
    flex: 1;
}

/* ========== 子菜单标签容器 ========== */
.mobile-submenu-tags {
    display: grid;
    grid-template-columns: 1fr 1fr;  /* 两列平分宽度 */
    gap: 10px;
    padding: 12px 20px 16px;
    background: transparent;  /* 移除背景色 */
    border-left: none;  /* 移除左侧边框 */
    /* 始终显示，无需展开/收起 */
    max-height: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* 确保所有子菜单始终可见 */
.mobile-submenu-tags.always-expanded {
    display: grid !important;
}

/* ========== 子菜单标签 ========== */
.mobile-submenu-tag {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);  /* 淡色半透明背景 */
    border: 1px solid rgba(255, 255, 255, 0.1);  /* 淡色边框 */
    border-radius: 6px;  /* 小圆角，不是完全圆形 */
    color: rgba(255, 255, 255, 0.75);  /* 默认淡白色文字 */
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 400;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-submenu-tag:hover {
    background: rgba(53, 235, 144, 0.15);  /* 悬停时主题色半透明背景 */
    border-color: rgba(53, 235, 144, 0.4);  /* 悬停时主题色边框 */
    color: var(--theme-primary);  /* 悬停时主题色文字 */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(53, 235, 144, 0.2);
}

/* 激活状态 - 当前页面 */
.mobile-submenu-tag.active {
    background: rgba(53, 235, 144, 0.2);  /* 主题色背景 */
    border-color: var(--theme-primary);  /* 主题色边框 */
    color: var(--theme-primary);  /* 主题色文字 */
    font-weight: 500;
}

/* 移除图标相关样式，因为不再显示图标 */

/* ========== 用户登录/注册区域 ========== */
/* 登录/注册按钮已移至导航栏，不再在侧边栏显示 */

/* ========== 响应式适配 ========== */

/* 只在移动端显示 */
@media (min-width: 992px) {
    .mobile-sidebar-menu,
    .mobile-sidebar-overlay {
        display: none !important;
    }
}

/* 小屏手机优化 */
@media (max-width: 480px) {
    .mobile-sidebar-menu {
        width: 280px;
        padding-top: 60px;  /* 小屏手机导航栏较小 */
    }
    
    .mobile-sidebar-content {
        padding: 16px 0;
    }
    
    .mobile-sidebar-nav > li > .nav-link,
    .mobile-parent-link {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    
    .mobile-submenu-tags {
        padding: 10px 16px 14px;
        gap: 6px;
    }
    
    .mobile-submenu-tag {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .mobile-sidebar-user {
        padding: 16px;
    }
    
    .mobile-sidebar-user .nav-link {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* ========== 动画效果 ========== */

/* 菜单项进入动画 */
.mobile-sidebar-menu.open .mobile-sidebar-nav > li {
    animation: slideInRight 0.4s ease forwards;
    opacity: 0;
}

.mobile-sidebar-menu.open .mobile-sidebar-nav > li:nth-child(1) { animation-delay: 0.05s; }
.mobile-sidebar-menu.open .mobile-sidebar-nav > li:nth-child(2) { animation-delay: 0.1s; }
.mobile-sidebar-menu.open .mobile-sidebar-nav > li:nth-child(3) { animation-delay: 0.15s; }
.mobile-sidebar-menu.open .mobile-sidebar-nav > li:nth-child(4) { animation-delay: 0.2s; }
.mobile-sidebar-menu.open .mobile-sidebar-nav > li:nth-child(5) { animation-delay: 0.25s; }
.mobile-sidebar-menu.open .mobile-sidebar-nav > li:nth-child(6) { animation-delay: 0.3s; }
.mobile-sidebar-menu.open .mobile-sidebar-nav > li:nth-child(7) { animation-delay: 0.35s; }
.mobile-sidebar-menu.open .mobile-sidebar-nav > li:nth-child(8) { animation-delay: 0.4s; }

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
