/* 自定义导航样式 - 鼠标悬停右侧展开子菜单 */

/* 隐藏左侧导航栏的二级菜单（子菜单） */
.sidebar-menu .treeview-menu {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* 左侧导航栏的 pull-right-container 正常显示 */
/* .sidebar-menu .pull-right-container {
    display: none !important;
    visibility: hidden !important;
} */

/* 一级菜单项样式 */
.sidebar-menu > li {
    position: relative;
    margin: 0 !important;
}

.sidebar-menu > li > a {
    position: relative;
    cursor: pointer;
    color: #ffffff !important;
}

/* 左侧导航颜色改为 #00a3c4 */
.sidebar-menu > li:hover > a,
.sidebar-menu > li.active > a,
.sidebar-menu > li.treeview-open > a {
    background-color: #00a3c4 !important;
    color: #ffffff !important;
    border-left-color: #00a3c4 !important;
}

.sidebar-menu > li.active,
.sidebar-menu > li.treeview-open,
.sidebar-menu > li:hover {
    border-left-color: #00a3c4 !important;
}

/* 所有皮肤主题默认使用 #03b8cc 作为左侧导航背景色 */
.wrapper,
.main-sidebar,
.left-side {
    background-color: #03b8cc !important;
}

/* 所有皮肤主题下的菜单项悬停和激活状态 */
.sidebar-menu > li:hover > a,
.sidebar-menu > li.active > a,
.sidebar-menu > li.treeview-open > a {
    background-color: #ffffff !important;
    color: #03b8cc !important;
    border-left-color: #03b8cc !important;
}

.sidebar-menu > li.active,
.sidebar-menu > li.treeview-open,
.sidebar-menu > li:hover {
    border-left-color: #03b8cc !important;
}

/* skin-black-blue 主题下的左侧导航样式（保持特定主题样式，覆盖默认） */
.skin-black-blue .wrapper,
.skin-black-blue .main-sidebar,
.skin-black-blue .left-side {
    background-color: #03b8cc !important;
}

.skin-black-blue .sidebar-menu > li:hover > a,
.skin-black-blue .sidebar-menu > li.active > a,
.skin-black-blue .sidebar-menu > li.treeview-open > a {
    background-color: #ffffff !important;
    color: #03b8cc !important;
    border-left-color: #03b8cc !important;
}

.skin-black-blue .sidebar-menu > li.active,
.skin-black-blue .sidebar-menu > li.treeview-open,
.skin-black-blue .sidebar-menu > li:hover {
    border-left-color: #03b8cc !important;
}

/* 其他皮肤主题也使用相同的样式 */
.skin-black-purple .wrapper,
.skin-black-purple .main-sidebar,
.skin-black-purple .left-side,
.skin-black-green .wrapper,
.skin-black-green .main-sidebar,
.skin-black-green .left-side,
.skin-black-red .wrapper,
.skin-black-red .main-sidebar,
.skin-black-red .left-side,
.skin-black-yellow .wrapper,
.skin-black-yellow .main-sidebar,
.skin-black-yellow .left-side,
.skin-black-pink .wrapper,
.skin-black-pink .main-sidebar,
.skin-black-pink .left-side,
.skin-black .wrapper,
.skin-black .main-sidebar,
.skin-black .left-side {
    background-color: #03b8cc !important;
}

.skin-black-purple .sidebar-menu > li:hover > a,
.skin-black-purple .sidebar-menu > li.active > a,
.skin-black-purple .sidebar-menu > li.treeview-open > a,
.skin-black-green .sidebar-menu > li:hover > a,
.skin-black-green .sidebar-menu > li.active > a,
.skin-black-green .sidebar-menu > li.treeview-open > a,
.skin-black-red .sidebar-menu > li:hover > a,
.skin-black-red .sidebar-menu > li.active > a,
.skin-black-red .sidebar-menu > li.treeview-open > a,
.skin-black-yellow .sidebar-menu > li:hover > a,
.skin-black-yellow .sidebar-menu > li.active > a,
.skin-black-yellow .sidebar-menu > li.treeview-open > a,
.skin-black-pink .sidebar-menu > li:hover > a,
.skin-black-pink .sidebar-menu > li.active > a,
.skin-black-pink .sidebar-menu > li.treeview-open > a,
.skin-black .sidebar-menu > li:hover > a,
.skin-black .sidebar-menu > li.active > a,
.skin-black .sidebar-menu > li.treeview-open > a {
    background-color: #ffffff !important;
    color: #03b8cc !important;
    border-left-color: #03b8cc !important;
}

.skin-black-purple .sidebar-menu > li.active,
.skin-black-purple .sidebar-menu > li.treeview-open,
.skin-black-purple .sidebar-menu > li:hover,
.skin-black-green .sidebar-menu > li.active,
.skin-black-green .sidebar-menu > li.treeview-open,
.skin-black-green .sidebar-menu > li:hover,
.skin-black-red .sidebar-menu > li.active,
.skin-black-red .sidebar-menu > li.treeview-open,
.skin-black-red .sidebar-menu > li:hover,
.skin-black-yellow .sidebar-menu > li.active,
.skin-black-yellow .sidebar-menu > li.treeview-open,
.skin-black-yellow .sidebar-menu > li:hover,
.skin-black-pink .sidebar-menu > li.active,
.skin-black-pink .sidebar-menu > li.treeview-open,
.skin-black-pink .sidebar-menu > li:hover,
.skin-black .sidebar-menu > li.active,
.skin-black .sidebar-menu > li.treeview-open,
.skin-black .sidebar-menu > li:hover {
    border-left-color: #03b8cc !important;
}

/* skin-black-purple 主题下的头部样式 */
.skin-black-purple .main-header {
    background-color: #03b8cc !important;
}

.skin-black-purple .main-header .logo {
    background-color: #03b8cc !important;
    border-right-color: #03b8cc !important;
}

/* 右侧子菜单面板容器 */
#sidebar-submenu-panel {
    position: fixed;
    top: 50px; /* 头部高度 */
    left: 230px; /* 侧边栏宽度，JavaScript会动态更新 */
    width: auto; /* 宽度根据内容自适应 */
    max-width: calc(100vw - 250px); /* 最大宽度不超过视口减去侧边栏 */
    height: auto; /* 高度根据内容自适应 */
    max-height: calc(100vh - 50px); /* 最大高度不超过视口减去头部 */
    background-color: #03b8cc;
    z-index: 998; /* 低于header，高于内容区 */
    display: none;
    overflow-y: auto; /* 垂直方向允许滚动 */
    overflow-x: hidden; /* 水平方向隐藏溢出 */
    padding: 0; /* 顶部和左右无间距，让灰色标题栏紧贴 */
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.2s ease;
    transition: left 0.3s ease, width 0.2s ease, height 0.2s ease;
}

/* 美化面板滚动条样式 - Webkit 浏览器 */
#sidebar-submenu-panel::-webkit-scrollbar {
    width: 6px;
}

#sidebar-submenu-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

#sidebar-submenu-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    transition: background 0.2s ease;
}

#sidebar-submenu-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Firefox 浏览器滚动条样式 */
#sidebar-submenu-panel {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 侧边栏折叠时的调整 - JavaScript会动态处理 */

/* 移动端调整 */
@media (max-width: 768px) {
    #sidebar-submenu-panel {
        left: 0;
        top: 100px;
        width: 100% !important;
        max-width: 100% !important;
        height: calc(100vh - 100px) !important;
        max-height: calc(100vh - 100px) !important;
    }
    
    .sidebar-submenu-content {
        flex-wrap: wrap; /* 移动端允许换行 */
    }
}

.sidebar-submenu-panel-active {
    display: block !important;
}

/* 子菜单面板内容 */
.sidebar-submenu-content {
    display: inline-flex; /* 使用 inline-flex 让内容区域紧贴 */
    flex-wrap: nowrap; /* 不换行，保持在一行 */
    gap: 0; /* 无间距，列之间紧贴 */
    width: auto; /* 宽度根据内容自适应 */
    margin: 0;
    position: relative;
}

/* 子菜单列 */
.sidebar-submenu-column {
    flex: 0 0 auto; /* 不扩展，根据内容自适应宽度 */
    width: auto; /* 宽度根据内容自适应 */
    min-width: 180px; /* 最小宽度 */
    max-width: 220px; /* 最大宽度 */
    background-color: transparent;
    border-radius: 0;
    padding: 0; /* 完全无间距，标题栏紧贴顶部和左侧 */
    position: relative;
    max-height: calc(100vh - 50px); /* 限制列的最大高度 */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 列本身不滚动，让内部内容滚动 */
}

/* 列之间添加竖分割线 */
.sidebar-submenu-column:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: rgba(255, 255, 255, 0.3); /* 白色半透明分割线 */
    z-index: 1;
}

/* 子菜单列标题（二级菜单） */
.sidebar-submenu-column-title {
    color: #ffffff;
    font-size: 14px;
    font-weight: normal;
    margin: 0; /* 完全无外边距，紧贴顶部 */
    padding: 8px 10px;
    background-color: #ACACAC; /* 灰色背景 */
    border-radius: 0;
    display: block;
    text-decoration: none; /* 标题默认无下划线 */
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center; /* 文本居中 */
    flex-shrink: 0; /* 标题不收缩 */
}

/* 如果标题是可点击的链接，添加下划线 */
a.sidebar-submenu-column-title {
    text-decoration: underline;
}

.sidebar-submenu-column-title:hover {
    background-color: #b8b8b8;
    color: #ffffff;
    text-decoration: none; /* 标题悬停时无下划线 */
}

/* 可点击的标题悬停时保持下划线 */
a.sidebar-submenu-column-title:hover {
    text-decoration: underline;
}

.sidebar-submenu-column-title.active {
    background-color: #ACACAC;
    padding-left: 10px;
    text-align: center; /* 文本居中 */
}

/* 子菜单项容器 - 用于处理过长数据，允许滚动 */
.sidebar-submenu-column-items {
    flex: 1;
    overflow-y: auto; /* 如果内容过长，允许滚动 */
    overflow-x: hidden;
    padding: 4px 10px 10px 10px; /* 顶部小间距，左右和底部有间距 */
    min-height: 0; /* 允许flex子元素收缩 */
}

/* 美化滚动条样式 - Webkit 浏览器（Chrome、Safari、Edge） */
.sidebar-submenu-column-items::-webkit-scrollbar {
    width: 6px; /* 滚动条宽度 */
}

.sidebar-submenu-column-items::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1); /* 滚动条轨道背景 */
    border-radius: 3px;
}

.sidebar-submenu-column-items::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3); /* 滚动条滑块背景 */
    border-radius: 3px;
    transition: background 0.2s ease;
}

.sidebar-submenu-column-items::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5); /* 悬停时滑块背景 */
}

/* Firefox 浏览器滚动条样式 */
.sidebar-submenu-column-items {
    scrollbar-width: thin; /* 细滚动条 */
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1); /* 滑块颜色 轨道颜色 */
}

/* 子菜单项 */
.sidebar-submenu-item {
    display: block;
    color: #ffffff;
    padding: 8px 10px;
    margin-bottom: 0;
    text-decoration: underline; /* 添加下划线 */
    border-radius: 0;
    transition: all 0.2s ease;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2); /* 白色分割线 */
    text-align: center; /* 文本居中显示 */
    white-space: nowrap; /* 不换行 */
    overflow: hidden;
    text-overflow: ellipsis; /* 过长文本显示省略号 */
}

.sidebar-submenu-item:last-child {
    border-bottom: none; /* 最后一项不需要分割线 */
}

.sidebar-submenu-item:hover {
    background-color: #ffffff; /* 白色背景 */
    color: #03b8cc; /* 青色文字 */
    text-decoration: underline; /* 悬停时也保持下划线 */
    transform: none;
}

/* 面板中的菜单项 active 状态（选中状态） */
.sidebar-submenu-item.active {
    background-color: #ffffff; /* 白色背景 */
    color: #03b8cc; /* 青色文字 */
    text-decoration: underline; /* 保持下划线 */
    font-weight: normal; /* 正常字重 */
}

/* 有子菜单的菜单项 */
.sidebar-submenu-item.has-children {
    position: relative;
    cursor: pointer; /* 鼠标指针变为手型 */
    font-weight: 500;
}

.sidebar-submenu-item.has-children .sidebar-submenu-text {
    display: inline-block;
}

.sidebar-submenu-item.has-children .sidebar-submenu-arrow {
    display: inline-block;
    margin-left: 5px;
    width: auto;
    height: auto;
    padding: 0;
    transition: transform 0.2s ease;
    transform: rotate(0deg); /* 默认向右（收起状态） */
}

/* 展开状态下的箭头旋转（参考 FastAdmin 一级菜单样式） */
.sidebar-submenu-parent.expanded .sidebar-submenu-arrow {
    transform: rotate(-90deg); /* 展开时向下（与一级菜单一致） */
}

/* 有子菜单的项不应该有下划线（因为不可点击） */
.sidebar-submenu-item.has-children[data-has-children="true"] {
    text-decoration: none !important;
    cursor: pointer;
}

.sidebar-submenu-item.has-children[data-has-children="true"]:hover {
    text-decoration: none !important;
}

/* 子菜单容器 */
.sidebar-submenu-children {
    padding-left: 15px; /* 子菜单缩进 */
    overflow: hidden;
}

/* 三级菜单 */
.sidebar-submenu-level3 {
    margin-left: 0;
    margin-top: 4px;
    padding-left: 0;
    border-left: none;
}

.sidebar-submenu-level3 .sidebar-submenu-item {
    font-size: 14px;
    margin-bottom: 0;
}

/* 四级菜单 */
.sidebar-submenu-level4 {
    margin-left: 0;
    margin-top: 4px;
    padding-left: 0;
}

.sidebar-submenu-level4 .sidebar-submenu-item {
    font-size: 13px;
    padding: 8px 10px;
    margin-bottom: 0;
}

/* 五级及更多级菜单 */
.sidebar-submenu-level5,
.sidebar-submenu-level6 {
    margin-left: 20px;
    margin-top: 4px;
    padding-left: 15px;
    border-left: 2px solid rgba(255, 255, 255, 0.2);
}

.sidebar-submenu-level5 .sidebar-submenu-item,
.sidebar-submenu-level6 .sidebar-submenu-item {
    font-size: 12px;
    padding: 6px 12px;
}

/* 确保多级嵌套时样式正确 */
.sidebar-submenu-level3 .sidebar-submenu-level4 {
    margin-left: 10px;
    padding-left: 10px;
}

.sidebar-submenu-level4 .sidebar-submenu-level5 {
    margin-left: 10px;
    padding-left: 10px;
}

/* 三级菜单项下的四级菜单缩进 */
.sidebar-submenu-level3 > .sidebar-submenu-level4 {
    margin-top: 4px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    #sidebar-submenu-panel {
        left: 0;
        top: 100px;
    }
    
    .sidebar-submenu-content {
        flex-direction: column;
    }
}

/* 防止菜单点击时触发默认行为 */
.sidebar-menu > li > a[href="javascript:;"] {
    cursor: pointer;
}

