:root {

    --sidebar-width: 200px;

    --sidebar-width-large: 220px;

    --sidebar-width-mobile: 70px;

}



.sidebar {

    width: var(--sidebar-width);

    height: 100vh;

    min-height: 100vh;

    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);

    display: flex;

    flex-direction: column;

    align-items: flex-start;

    padding: 20px 0 14px;

    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.06);

    position: fixed;

    left: 0;

    top: 0;

    z-index: 100;

    border-right: 1px solid rgba(0, 0, 0, 0.04);

    box-sizing: border-box;

}



.sidebar .logo {

    margin-bottom: 24px;

    width: 100%;

    display: flex;

    justify-content: center;
    position: relative;

}



.sidebar .nav-menu {

    display: flex;

    flex-direction: column;

    gap: 8px;

    width: 100%;

    padding: 0 12px;

    align-items: flex-start;

    flex: 1;

    /* flex 子项默认 min-height:auto 会撑破固定高度，必须归零才能触发滚动 */
    min-height: 0;

    position: relative;

    overflow-y: auto;
    /* 细滚动条：平时淡灰，hover 加深 */
    scrollbar-width: thin;
    scrollbar-color: #dcdee3 transparent;
    -ms-overflow-style: none;


}
.sidebar .nav-menu::-webkit-scrollbar { width: 5px; height: 5px; }
.sidebar .nav-menu::-webkit-scrollbar-track { background: transparent; }
.sidebar .nav-menu::-webkit-scrollbar-thumb {
    background: #dcdee3;
    border-radius: 4px;
}
.sidebar .nav-menu::-webkit-scrollbar-thumb:hover { background: #c3c6cd; }



/* 分组标题（图2样式）：小号灰字，与菜单文字左对齐 */
.sidebar .nav-group-title {
    font-size: 12px;
    font-weight: 600;
    color: #9aa0a8;
    letter-spacing: 1px;
    padding: 0 14px;
    margin-top: 10px;
    user-select: none;
}

/* 第一个标题贴顶，不额外加间距 */
.sidebar .nav-group-title:first-child { margin-top: 0; }



.sidebar .nav-item {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: none !important;
    padding: 10px 12px !important;
    color: #3a3d43 !important;
    text-decoration: none !important;
    /* 图2样式：平时透明底，hover/选中才显示灰色胶囊 */
    background: transparent !important;
    border: none !important;
    border-radius: 12px !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    justify-content: flex-start !important;
}



.sidebar .nav-item:hover {

    /* 悬停时才突出显示胶囊 */
    background: #ececf0 !important;

    color: #1f2329 !important;

}



.sidebar .nav-item.active {

    /* 图2样式：选中项加深一档灰，不用红色高亮 */
    background: #e9e9ee !important;

    color: #111318 !important;

    font-weight: 600 !important;

}



.sidebar .nav-item svg {width: 19px;height: 19px;flex-shrink: 0;color: #55585f;}
.sidebar .nav-item.active svg,
.sidebar .nav-item:hover svg {color: #1f2329;}

/* ===== 子页上下文导航（sidebar-sub-nav.js 渲染）：图标图片 + 标签角标 ===== */

/* 侧栏窄（200px）：菜单名最多两行，超出再省略（对静态短菜单名无影响） */
.sidebar .nav-item {
    white-space: normal;
}
.sidebar .nav-item .nav-text-wrap {
    /* 宽度贴合文字本身：原来 flex:1 会撑满整行，
       角标 absolute 定位到行尾后就变成"所有角标都在同一个位置"，
       与菜单名长短无关（超能作图 / 产品套图详情页 的角标右边完全对齐） */
    flex: 0 1 auto;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    line-height: 1.4;
    padding-right: 0;
}
.sidebar .nav-item .nav-text {
    /* 两行截断：长标题折行显示，超过两行才出现省略号；
       完整名称仍可通过 hover 的 title 提示查看（JS 渲染时已带 title 属性） */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
    vertical-align: bottom;
}

/* 后台配置的菜单图标（图片），与 svg 图标同尺寸 */
.sidebar .nav-item .nav-icon-img {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 4px;
}

/* 标签徽章：紧贴菜单名最后一个字的右上角（参考图2），配色与顶部下拉 sub-tag 一致。
   参与正常排版（不再 absolute 到行尾），因此角标位置随菜单名长短变化；
   名字过长时文字先省略号截断，角标始终跟在最后一个可见字符后 */
.sidebar .nav-item .nav-tag {
    flex: 0 0 auto;
    align-self: flex-start;
    margin-left: 3px;
    margin-top: -5px;
    z-index: 2;
    font-style: normal;
    font-size: 9px;
    font-weight: 600;
    line-height: 1.4;
    padding: 1px 4px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.sidebar .nav-tag.t-hot { background: #ff5722; color: #ffffff; }
.sidebar .nav-tag.t-rec { background: #e53935; color: #ffffff; }
.sidebar .nav-tag.t-new { background: #1e88e5; color: #ffffff; }
.sidebar .nav-tag.t-free { background: #43a047; color: #ffffff; }

/* ===== 卡片式菜单：图标在上、文字在下，角标贴图标右上角（参考新设计稿） =====
   仅桌面端生效；移动端折叠栏（≤768px）保持"纯图标行式"布局不受影响 */
@media (min-width: 769px) {
    .sidebar .nav-item {
        flex-direction: column !important;
        justify-content: center;
        gap: 7px !important;
        position: relative;
        padding: 14px 6px 11px !important;
        text-align: center;
    }
    .sidebar .nav-item .nav-text-wrap {
        display: block;
        flex: none;
        width: 100%;
    }
    .sidebar .nav-item .nav-text {
        margin: 0 auto;
        font-size: 13px;
        line-height: 1.3;
        text-align: center;
    }
    /* 角标不再参与排版：绝对定位到图标右侧一点点、偏上的位置 */
    .sidebar .nav-item .nav-tag {
        position: absolute;
        top: 5px;
        left: calc(50% + 11px);
        margin: 0;
        align-self: auto;
    }
    /* 图标放大一点，贴近设计稿的视觉比重 */
    .sidebar .nav-item svg,
    .sidebar .nav-item .nav-icon-img {
        width: 26px;
        height: 26px;
    }
}
.sidebar .nav-tag.t-todo { background: #e0e0e0; color: #666666; }
.sidebar .nav-tag.t-gray { background: #f5f5f5; color: #999999; }
.sidebar .nav-tag.t-default { background: #ffebee; color: #e53935; }



.sidebar .nav-divider {

    height: 1px;

    background: #e5e7eb;

    margin: 12px 0;

    width: 100%;

}



.sidebar .user-section {

    /* 文档流内贴底（侧栏为 flex column）：菜单滚动区底边紧挨用户登录块，
       滚动菜单时用户区依旧不动（滚动发生在 .nav-menu 内部） */
    position: static;
    left: auto;
    bottom: auto;
    margin: 0;

    padding: 12px 14px 0;

    box-sizing: border-box;

    background: transparent;

    border: none;

    border-radius: 0;

    width: 100%;

    max-width: none;

    box-shadow: none;

    /* 改为 visible：竖三点账户菜单（.user-menu）需向右侧栏外弹出 */
    overflow: visible;

    /* 防止侧边栏高度不足(顶部导航让位后变矮)时被 flex 压缩，
       导致登录/退出按钮只显示一半 */
    flex-shrink: 0;

}

.sidebar .user-section::before {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f75444 0%, #ff9a78 100%);
}

.sidebar .user-card-main {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    cursor: pointer;
    /* 图2样式：用户行与菜单项同款浅灰胶囊 */
    background: #f6f6f8;
    border-radius: 12px;
    /* 左右内边距 12→10：给"登录享更多权益"整行文字让出空间，避免省略号 */
    padding: 9px 10px;
    box-sizing: border-box;
    transition: background .2s ease;
}

.sidebar .user-card-main:hover {
    background: #efeff3;
}

/* 用户行右侧竖三点（可点击，展开账户菜单） */
.sidebar .user-more {
    margin-left: auto;
    color: #6b7078;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
    padding: 4px;
    margin-right: -4px;
    border-radius: 8px;
    transition: background .2s ease, color .2s ease;
}

.sidebar .user-more:hover {
    background: #e8e8ee;
    color: #333;
}

/* 竖三点账户菜单：贴着用户行向右弹出 */
.sidebar .user-section {
    position: relative;
}

.sidebar .user-menu {
    position: absolute;
    left: calc(100% + 10px);
    bottom: 0;
    min-width: 140px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.14);
    border: 1px solid #f0f0f2;
    padding: 6px;
    display: none;
    z-index: 3000;
}

.sidebar .user-menu.show {
    display: block;
    animation: userMenuIn .16s ease;
}

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

.sidebar .user-menu a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #333;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease;
}

.sidebar .user-menu a:hover {
    background: #f6f6f8;
    color: #f75444;
}



.sidebar .user-avatar {

    margin: 0;

    display: flex;

    justify-content: center;

}



.sidebar .avatar {

    width: 38px;

    height: 38px;

    border-radius: 50%;

    background: linear-gradient(135deg, #f75444 0%, #ff7875 100%);

    display: flex;

    align-items: center;

    justify-content: center;

    color: #ffffff;

    font-size: 17px;

    font-weight: 600;

    border: 2px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 2px 7px rgba(247, 84, 68, 0.25);

}



.sidebar .avatar.guest {

    background: linear-gradient(135deg, #9ca3af 0%, #d1d5db 100%);

}



.sidebar .user-info {

    min-height: 0;

    display: flex;

    flex-direction: column;

    align-items: flex-start;

    justify-content: center;

    text-align: left;

    /* 占满剩余宽度且允许收缩，让内部文字省略号生效 */
    flex: 1 1 auto;

    min-width: 0;

}



.sidebar .user-name {

    font-size: 14px;

    font-weight: 600;

    color: #252a31;

    margin-bottom: 4px;

    max-width: 160px;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

}



.sidebar .user-role {

    /* 压缩到一行显示：字号缩小 + 超出省略，避免"益"字折行 */
    font-size: 11px;

    color: #4b9b70;

    background: transparent;

    border-radius: 10px;

    padding: 0;

    line-height: 15px;

    max-width: 100%;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

}



.sidebar .login-btn {

    clear: both;

    width: 100%;

    padding: 11px 12px;

    /* 图2样式：底部 CTA 用彩虹渐变胶囊 */
    background: linear-gradient(90deg, #6ec1f2 0%, #a29af5 32%, #ee9fc0 66%, #f6b48e 100%);

    border: none;

    border-radius: 12px;

    color: #ffffff;

    cursor: pointer;

    font-size: 14px;

    font-weight: 600;

    margin-top: 13px;

    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);

    transition: all 0.3s ease;

}



.sidebar .login-btn:hover {

    transform: translateY(-2px);

    box-shadow: 0 4px 12px rgba(247, 84, 68, 0.4);

}



.sidebar .logout-btn {clear: both;width: 100%;padding: 11px 12px;

    /* 图2样式：底部 CTA 用彩虹渐变胶囊 */background: linear-gradient(90deg, #6ec1f2 0%, #f12f2d 32%, #ee9fc0 66%, #f6b48e 100%);border: none;border-radius: 12px;color: #ffffff;cursor: pointer;font-size: 14px;font-weight: 600;margin-top: 13px;text-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);transition: all 0.3s ease;}



.sidebar .logout-btn:hover {

    filter: brightness(1.06);

    box-shadow: 0 4px 14px rgba(162, 154, 245, 0.35);

}



.sidebar .recharge-link {

    display: flex;

    align-items: center;

    gap: 14px;

    padding: 14px 16px;

    background: transparent;

    border-radius: 12px;

    color: #6b7280;

    text-decoration: none;

    transition: all 0.3s ease;

    margin: 4px 0;

    cursor: pointer;

    box-sizing: border-box;

    width: calc(100% - 16px);

    max-width: 220px;

}

.sidebar .recharge-link:hover {

    background: #f3f4f6;

    color: #374151;

}

.sidebar .recharge-link svg {

    width: 20px;

    height: 20px;

    flex-shrink: 0;

}

.sidebar .recharge-link span {

    font-size: 15px;

    font-weight: 500;

}



@media (min-width: 1920px) and (max-width: 2559px) {

    .sidebar {

        width: var(--sidebar-width-large);

        padding: 24px 0 14px;

    }





    .sidebar .nav-item {

        padding: 12px 14px;

        font-size: 15px;

        max-width: none !important;

    }



    .sidebar .nav-item svg {

        width: 20px;

        height: 20px;

    }



    .sidebar .avatar {

        width: 52px;

        height: 52px;

        font-size: 20px;

    }



    .sidebar .user-section {

        max-width: none;

        padding: 20px 16px 0;

    }



    .sidebar .recharge-link {

        padding: 14px 16px;

        max-width: none;

    }



    .sidebar .recharge-link svg {

        width: 20px;

        height: 20px;

    }



    .sidebar .recharge-link span {

        font-size: 15px;

    }

}



@media (min-width: 2560px) {

    .sidebar {

        width: calc(var(--sidebar-width) * 1.3);

        padding: 28px 0 14px;

    }





    .sidebar .nav-item {

        padding: 14px 16px;

        font-size: 16px;

        max-width: none !important;

        gap: 14px;

    }



    .sidebar .nav-item svg {

        width: 22px;

        height: 22px;

    }



    .sidebar .avatar {

        width: 56px;

        height: 56px;

        font-size: 22px;

    }



    .sidebar .user-section {

        max-width: none;

        padding: 24px 18px 0;

    }



    .sidebar .user-name {

        font-size: 15px;

    }



    .sidebar .user-role {

        font-size: 13px;

    }



    .sidebar .login-btn,

    .sidebar .logout-btn {

        padding: 12px;

        font-size: 15px;

    }



    .sidebar .recharge-link {

        padding: 16px 18px;

        max-width: none;

        gap: 14px;

    }



    .sidebar .recharge-link svg {

        width: 22px;

        height: 22px;

    }



    .sidebar .recharge-link span {

        font-size: 16px;

    }

}



@media (max-width: 768px) {

    .sidebar {

        width: var(--sidebar-width-mobile);

        padding: 20px 0 14px;

    }



    .sidebar .nav-item span {

        display: none;

    }



    .sidebar .recharge-link span {

        display: none;

    }



    .sidebar .user-section {

        display: none;

    }



    .sidebar .nav-item {

        justify-content: center;

        max-width: 48px;

    }



    .sidebar .recharge-link {

        justify-content: center;

        max-width: 48px;

    }

}

/* ===== 通用弹窗 / 表单样式（从 index.css 迁移，多页面共用） ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    overflow: auto;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #ffffff;
    border-radius: 20px;
    width: 90%;
    max-width: 420px;
    padding: 32px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    margin: auto;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    box-sizing: border-box;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #6b7280;
}

.modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: #ffffff;
    color: #f75444;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.modal-content .tab-content {
    display: none !important;
    padding-top: 16px;
    min-height: 200px;
}

.modal-content .tab-content.active,
.modal-overlay.active .modal-content #loginTab.active,
.modal-overlay.active .modal-content #registerTab.active {
    display: block !important;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    border-color: #f75444;
    box-shadow: 0 0 0 3px rgba(247, 84, 68, 0.1);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    color: #6b7280;
    font-size: 14px;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
}

.forgot-link {
    color: #f75444;
    text-decoration: none;
    font-size: 14px;
}

.forgot-link:hover {
    text-decoration: underline;
}

.submit-btn-full {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #f75444 0%, #ff7875 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(247, 84, 68, 0.3);
}

.submit-btn-full:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(247, 84, 68, 0.4);
}

.social-login {
    margin-top: 24px;
    text-align: center;
}

.social-login span {
    display: block;
    color: #9ca3af;
    font-size: 14px;
    margin-bottom: 16px;
}

.social-buttons {
    display: flex;
    gap: 12px;
}

.social-btn {
    flex: 1;
    padding: 12px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.social-btn:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.social-btn.wechat {
    color: #07c160;
}

.social-btn.weibo {
    color: #e6162d;
}

.social-btn.qq {
    color: #12b7f5;
}

@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        padding: 24px;
    }
}
