/* ============================================================
 * 速科会员中心 · 分组折叠侧边栏（独立实现，不依赖其他模板目录的任何资源）
 *
 * 使用位置：public/themes/clientarea/userCenter/includes/sidebar-group.tpl
 * 样式开关：后台「用户中心 → 侧边栏」= 分组折叠侧边栏（style=group）
 * 交互脚本：static/js/hmy-sidebar-group.js
 * 类名前缀：hmyg-（与主题原有 skynav- 体系互不影响）
 *
 * 视觉基准：模板原生侧边栏（速科原生样式）
 *   - 展开态：行高 44px、14px 文字、灰色图标；当前项整行蓝底白字
 *   - 收起态：64px 图标栏，仅留图标，当前项为蓝色圆角块；底部折叠按钮保留
 * ============================================================ */

/* 切换到本样式时隐藏原生底部折叠条（改用本样式自带的折叠按钮） */
.sky-container.hmy-sb-host .sky-sidebar .sky-sidebar-footer {
    display: none !important;
}

/* ---------- 面板 ---------- */
.sky-container .sky-sidebar .skynav-menu-wrapper.hmy-sb-group {
    padding: 8px 0 60px;
    background: #fff;
    height: calc(100% - 48px);
    overflow-y: auto;
    overflow-x: hidden;
}

.hmyg-menu,
.hmyg-menu * {
    box-sizing: border-box;
}

.hmyg-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    -webkit-font-smoothing: antialiased;
}

.hmyg-item {
    position: relative;
    margin: 0;
    padding: 0;
}

/* ---------- 一级条目 ---------- */
.hmyg-link {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 16px;
    color: rgba(0, 0, 0, .88);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    background: transparent;
    transition: background-color .15s ease, color .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.hmyg-link:hover,
.hmyg-link:focus {
    background: #f5f7fb;
    color: #000;
    text-decoration: none;
}

.hmyg-ico {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin-right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: #050505;
    transition: color .15s ease, background-color .15s ease;
}

/* 分组标题 / 首个分组前的独立入口：辅助层级，颜色/字重均低于条目 */
.hmyg-group-head,
.hmyg-sec-link {
    height: 40px;
    margin-top: 4px;
    color: rgba(0, 0, 0, .42);
    font-size: 13px;
    font-weight: 400;
}

.hmyg-group-head:hover,
.hmyg-group-head:focus,
.hmyg-sec-link:hover,
.hmyg-sec-link:focus {
    color: rgba(0, 0, 0, .62);
}

.hmyg-group-head .hmyg-ico,
.hmyg-sec-link .hmyg-ico {
    color: rgba(0, 0, 0, .42);
}

.hmyg-group-head:hover .hmyg-ico,
.hmyg-group-head:focus .hmyg-ico,
.hmyg-sec-link:hover .hmyg-ico,
.hmyg-sec-link:focus .hmyg-ico {
    color: rgba(0, 0, 0, .62);
}

.hmyg-link:hover .hmyg-ico {
    color: #000;
}

.hmyg-txt {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hmyg-caret {
    flex: 0 0 auto;
    margin-left: 8px;
    font-size: 14px;
    color: rgba(0, 0, 0, .72);
    transition: transform .2s ease, color .15s ease;
}

.hmyg-item.open > .hmyg-link > .hmyg-caret {
    transform: rotate(180deg);
}

/* ---------- 当前页：整行蓝底白字（与原生样式一致） ---------- */
.hmyg-link.is-active,
.hmyg-link.is-active:hover,
.hmyg-link.is-active:focus {
    background: var(--primary, #2f6bff);
    color: #fff;
    font-weight: 500;
}

.hmyg-link.is-active .hmyg-ico,
.hmyg-link.is-active .hmyg-caret {
    color: #fff;
}

/* ---------- 二级 / 三级 ---------- */
.hmyg-sub {
    list-style: none;
    margin: 0;
    padding: 0;
    display: none;
}

.hmyg-item.open > .hmyg-sub {
    display: block;
}

.hmyg-sub > .hmyg-item > .hmyg-link {
    height: 44px;
    padding-left: 16px;
    font-size: 14px;
    color: rgba(0, 0, 0, .88);
}

.hmyg-sub > .hmyg-item > .hmyg-link .hmyg-ico {
    font-size: 17px;
}

.hmyg-sub > .hmyg-item > .hmyg-link.is-active,
.hmyg-sub > .hmyg-item > .hmyg-link.is-active:hover {
    color: #fff;
}

.hmyg-sub .hmyg-sub > .hmyg-item > .hmyg-link {
    height: 40px;
    padding-left: 46px;
    font-size: 13px;
    color: rgba(0, 0, 0, .88);
}

/* ---------- 底部折叠按钮 ---------- */
.hmyg-foot {
    position: fixed;
    left: 0;
    bottom: 0;
    width: var(--nav-l-w, 200px);
    height: 48px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #f0f0f0;
    color: #1a1a1a;
    cursor: pointer;
    user-select: none;
    transition: background-color .15s ease;
}

.hmyg-foot:hover {
    background: #e8e8e8;
}

.hmyg-foot:focus-visible {
    outline: 2px solid var(--primary, #2f6bff);
    outline-offset: -2px;
}

.hmyg-foot .hmyg-foot-ico {
    font-size: 18px;
    line-height: 1;
    display: none;
}

.hmyg-foot .hmyg-foot-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* 展开态：显示「菜单」图标（点击收起） */
.sky-sidebar:not(.hmyg-collapsed) .hmyg-foot .hmyg-foot-ico-expand {
    display: inline-block;
}

/* 收起态：只显示向上的箭头（点击展开），隐藏文字 */
.sky-sidebar.hmyg-collapsed .hmyg-foot .hmyg-foot-ico-collapse {
    display: inline-block;
}

.sky-sidebar.hmyg-collapsed .hmyg-foot .hmyg-foot-label {
    display: none;
}

/* ---------- 收起态：64px 图标栏 ---------- */
.sky-container .sky-sidebar.hmyg-collapsed {
    width: 64px;
}

.sky-container .sky-sidebar.hmyg-collapsed .skynav-menu-wrapper.hmy-sb-group {
    padding: 8px 0 60px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sky-container .sky-sidebar.hmyg-collapsed .hmyg-txt,
.sky-container .sky-sidebar.hmyg-collapsed .hmyg-caret,
.sky-container .sky-sidebar.hmyg-collapsed .hmyg-foot-label {
    display: none !important;
}

.sky-container .sky-sidebar.hmyg-collapsed .hmyg-item > .hmyg-sub {
    display: none !important;
}

.sky-container .sky-sidebar.hmyg-collapsed .hmyg-link {
    height: 44px;
    padding: 0;
    justify-content: center;
    background: transparent;
}

.sky-container .sky-sidebar.hmyg-collapsed .hmyg-trail > .hmyg-link .hmyg-ico,
.sky-container .sky-sidebar.hmyg-collapsed .hmyg-link.is-active .hmyg-ico {
    margin-right: 0;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    font-size: 18px;
    color: #050505;
    border-radius: 6px;
}

.sky-container .sky-sidebar.hmyg-collapsed .hmyg-link:hover {
    background: #f5f7fb;
}

/* 收起态：分组标题图标仍弱于条目图标，层级不因状态切换而丢失 */
.sky-container .sky-sidebar.hmyg-collapsed .hmyg-group-head .hmyg-ico,
.sky-container .sky-sidebar.hmyg-collapsed .hmyg-sec-link .hmyg-ico {
    color: rgba(0, 0, 0, .42);
}

/* 收起态当前项：图标外一圈蓝色圆角块 */
.sky-container .sky-sidebar.hmyg-collapsed .hmyg-link.is-active,
.sky-container .sky-sidebar.hmyg-collapsed .hmyg-link.is-active:hover {
    background: transparent;
    color: #2f6bff;
}

.sky-container .sky-sidebar.hmyg-collapsed .hmyg-link.is-active .hmyg-ico {
    background: var(--primary, #2f6bff);
    color: #fff;
}

/* 收起态：当前页所在分组的父级图标也高亮（与原生收起栏一致） */
.sky-container .sky-sidebar.hmyg-collapsed .hmyg-trail > .hmyg-link .hmyg-ico {
    background: var(--primary, #2f6bff);
    color: #fff;
}

/* 收起态悬停提示（原生 title 气泡由脚本写入，无需额外样式） */

/* ---------- 深色主题 ---------- */
.sky-container.darkTheme .sky-sidebar .skynav-menu-wrapper.hmy-sb-group {
    background: #181818;
}

.sky-container.darkTheme .hmyg-link {
    color: rgba(255, 255, 255, .75);
}

.sky-container.darkTheme .hmyg-link:hover,
.sky-container.darkTheme .hmyg-link:focus {
    background: #202020;
    color: #fff;
}

.sky-container.darkTheme .hmyg-ico {
    color: rgba(255, 255, 255, .7);
}

.sky-container.darkTheme .hmyg-caret {
    color: rgba(255, 255, 255, .75);
}

.sky-container.darkTheme .hmyg-group-head,
.sky-container.darkTheme .hmyg-group-head .hmyg-ico,
.sky-container.darkTheme .hmyg-sec-link,
.sky-container.darkTheme .hmyg-sec-link .hmyg-ico {
    color: rgba(255, 255, 255, .45);
}

.sky-container.darkTheme .hmyg-sub > .hmyg-item > .hmyg-link {
    color: rgba(255, 255, 255, .6);
}

.sky-container.darkTheme .hmyg-link.is-active,
.sky-container.darkTheme .hmyg-link.is-active:hover {
    background: var(--primary, #2f6bff);
    color: #fff;
}

.sky-container.darkTheme .hmyg-foot {
    background: #1f1f20;
    color: #e6e6e6;
}

.sky-container.darkTheme .hmyg-foot:hover {
    background: #27272a;
}

.sky-container.darkTheme .hmyg-foot .hmyg-foot-label {
    color: #a6a7ac;
}

/* ---------- 桌面端才启用图标栏，移动端沿用主题 off-canvas ---------- */
@media (max-width: 768px) {
    /* 移动端沿用桌面同款图标栏收起：保证 64px 宽度，文字/子菜单仍由通用收起规则隐藏 */
    .sky-container .sky-sidebar.hmyg-collapsed {
        width: 64px !important;
    }

    .sky-container .sky-sidebar.hmyg-collapsed .hmyg-txt {
        display: none !important;
    }

    /* 底栏与侧边栏同进同出（主题用 isswitch 开合 off-canvas 侧栏） */
    .sky-sidebar .hmyg-foot {
        left: -300px;
        opacity: 0;
        pointer-events: none;
        transition: left .2s ease, opacity .2s ease;
    }

    .sky-sidebar.isswitch .hmyg-foot {
        left: 0;
        opacity: 1;
        pointer-events: auto;
    }
}
/* ---------- 未展开（折叠）分组标题：黑色 + 700，文字/图标/箭头同色 ----------
   仅作用于收起状态的分组标题行；已展开分组的标题与其子条目样式保持不变。
   深色主题下不做覆盖，避免黑字落在深色背景上。 */
.sky-container:not(.darkTheme) .sky-sidebar .hmyg-item:not(.open) > .hmyg-group-head,
.sky-container:not(.darkTheme) .sky-sidebar .hmyg-item:not(.open) > .hmyg-group-head:hover,
.sky-container:not(.darkTheme) .sky-sidebar .hmyg-item:not(.open) > .hmyg-group-head:focus,
.sky-container:not(.darkTheme) .sky-sidebar .hmyg-item:not(.open) > .hmyg-group-head .hmyg-ico,
.sky-container:not(.darkTheme) .sky-sidebar .hmyg-item:not(.open) > .hmyg-group-head:hover .hmyg-ico,
.sky-container:not(.darkTheme) .sky-sidebar .hmyg-item:not(.open) > .hmyg-group-head:focus .hmyg-ico,
.sky-container:not(.darkTheme) .sky-sidebar .hmyg-item:not(.open) > .hmyg-group-head .hmyg-caret {
    color: #000;
}

.sky-container:not(.darkTheme) .sky-sidebar .hmyg-item:not(.open) > .hmyg-group-head {
    font-weight: 700;
}
