/* ============================================================
   公共侧栏样式（单一来源）
   以首页 ai-chat.html 毛玻璃渐变侧栏为唯一基准。
   所有 PC 页面（首页 / AI 助手 / 数字人 / 即梦等）统一引入本文件。
   依赖：页面 :root 需定义 --primary 变量。
   ============================================================ */

/* ===== 侧栏容器：毛玻璃 + 渐变光晕 84px ===== */
.side-rail {
    position: relative; z-index: 100; display: flex; flex-direction: column; align-items: center;
    flex: 0 0 auto; width: 84px; height: 100%;
    min-height: 0; overflow: hidden;
    padding: 12px 9px 12px; border-right: 1px solid rgba(46,108,236,.08);
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
}
/* 侧栏渐变光晕层 */
.side-rail::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(120% 40% at 20% 0%, rgba(74,130,240,.16), transparent 60%),
        radial-gradient(120% 40% at 80% 100%, rgba(138,92,246,.14), transparent 60%);
    filter: blur(4px);
}
/* ===== 菜单项 ===== */
.rail-home, .side-rail .menu-item {
    width: 68px; min-width: 0; flex: 0 0 auto; display: flex; flex-direction: column;
    align-items: center; gap: 6px; margin: 0 0 5px; padding: 10px 4px;
    border: 0; border-radius: 12px; color: #3A3D45; background: transparent;
    box-shadow: none; cursor: pointer; transition: .16s ease;
}
.rail-home:hover, .side-rail .menu-item:hover {
    color: var(--primary); background: rgba(74,130,240,.10);
    border: 0; box-shadow: none; transform: translateY(-1px);
}
.side-rail .menu-item:hover .ic { transform: scale(1.06); }
.side-rail .menu-item .ic { transition: transform .18s ease; }
.side-rail .menu-item:hover .ic { box-shadow: 0 6px 16px rgba(90,100,240,.28); }
/* 选中态：克制的浅色底 + 深色文字，去掉过重的渐变胶囊 */
.rail-home.active, .side-rail .menu-item.active {
    color: var(--primary);
    background: #EEF3FF;
    border: 0;
    box-shadow: 0 0 0 1px rgba(46,108,236,.12);
}
.rail-home i, .side-rail .menu-item .ic { width: 32px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 0; color: inherit; background: transparent; font-size: 22px; }
.side-rail .menu-item .ic img { width: 26px; height: 26px; object-fit: contain; }
.rail-home span, .side-rail .menu-item .info { max-width: 62px; }
.rail-home span, .side-rail .menu-item .info .t { overflow: hidden; color: inherit; font-size: 11px; font-weight: 500; line-height: 1.35; white-space: nowrap; text-overflow: clip; text-align: center; word-break: break-all; }
/* 菜单项显示模型名称，底部按钮仅图标 */
.side-rail .rail-action span { display: none; }
.rail-models { width: 100%; flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; scrollbar-width: none; }
.rail-models::-webkit-scrollbar { display: none; }
/* ===== 分组标题 ===== */
.side-rail .rail-group {
    width: 100%; margin: 10px 0 6px; padding: 0 2px; color: #A0A5B0; font-size: 10px; font-weight: 600;
    letter-spacing: .04em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-rail .rail-group:first-child { margin-top: 0; }

/* ===== 底部按钮 ===== */
.rail-bottom { width: 100%; display: grid; gap: 3px; padding-top: 7px; border-top: 1px solid rgba(46,108,236,.10); }
.rail-action { width: 68px; min-height: 42px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; margin: auto; border-radius: 12px; color: #6D7078; font-size: 10px; cursor: pointer; transition: .18s ease; }
.rail-action:hover { color: var(--primary); background: rgba(74,130,240,.12); box-shadow: 0 0 0 1px rgba(74,130,240,.16), 0 6px 16px rgba(90,100,240,.16); transform: translateY(-1px); }
.rail-action i { font-size: 19px; }
/* 底部只保留「作品」入口（对齐首页 ai-chat.html），积分/登录/充值统一在顶部 topbar */
.rail-works { flex-direction: column; gap: 3px; padding: 9px 4px !important; background: transparent; border: 1px solid transparent; border-radius: 12px; }
.rail-works span { display: block !important; font-size: 10px; font-weight: 500; color: #8A93A3; }
.rail-works i { font-size: 17px !important; margin-bottom: 3px; }

/* ===== 悬浮提示：深色气泡 ===== */
.side-rail .menu-item { position: relative; }
.side-rail .menu-item .rail-tip {
    position: absolute; left: calc(100% + 14px); top: 50%; z-index: 200;
    transform: translateY(-50%) translateX(-6px);
    display: flex; flex-direction: column; gap: 3px;
    min-width: 150px; max-width: 220px; padding: 9px 12px;
    border-radius: 10px; color: #fff; background: rgba(23,25,35,.94);
    box-shadow: 0 10px 28px rgba(0,0,0,.18);
    opacity: 0; pointer-events: none; transition: .16s ease;
    white-space: normal;
}
.side-rail .menu-item .rail-tip strong { font-size: 13px; font-weight: 650; line-height: 1.3; }
.side-rail .menu-item .rail-tip span { font-size: 11px; color: rgba(255,255,255,.72); line-height: 1.4; }
.side-rail .menu-item .rail-tip::before {
    content: ""; position: absolute; left: -6px; top: 50%; transform: translateY(-50%);
    border: 6px solid transparent; border-right-color: rgba(23,25,35,.94);
}
.side-rail .menu-item:hover .rail-tip { opacity: 1; transform: translateY(-50%) translateX(0); }

/* ===== 用户下拉菜单 ===== */
#aiUserMenu {
    position: fixed; z-index: 10030; display: none;
    width: 232px; background: #ffffff; border-radius: 14px;
    box-shadow: 0 16px 48px rgba(15,23,42,.16), 0 0 0 1px rgba(15,23,42,.06);
    overflow: hidden; animation: aiAuthUp .18s cubic-bezier(.22,.8,.32,1);
}
#aiUserMenu.show { display: block; }
@keyframes aiAuthUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.ai-um-head { display: flex; align-items: center; gap: 11px; padding: 16px 16px 13px; border-bottom: 1px solid #f0f1f4; }
.ai-um-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; color: #fff; font-size: 17px; font-weight: 700; background: linear-gradient(135deg,#4F6BFF,#7C5CFF); overflow: hidden; }
.ai-um-avatar img, .ai-um-avatar span { width: 100%; height: 100%; display: grid; place-items: center; object-fit: cover; }
.ai-um-avatar span { color: #fff; font-weight: 700; }
.ai-um-info { flex: 1; min-width: 0; }
.ai-um-name { font-size: 14px; font-weight: 600; color: #1f2329; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-um-link { font-size: 12px; color: #8a93a3; margin-top: 2px; cursor: pointer; }
.ai-um-link:hover { color: #2E6CEC; }
.ai-um-body { padding: 6px; }
.ai-um-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; color: #3a3f47; transition: background .15s; }
.ai-um-item i { font-size: 17px; color: #6b7480; width: 18px; text-align: center; }
.ai-um-item span { flex: 1; }
.ai-um-item .ai-um-arrow { font-size: 15px; color: #b6bcc6; }
.ai-um-item:hover { background: #f5f6fa; }
.ai-um-item:hover i { color: #2E6CEC; }
.ai-um-item.danger { color: #ef4444; }
.ai-um-item.danger i { color: #ef4444; }
.ai-um-foot { padding: 6px; border-top: 1px solid #f0f1f4; }
/* 隐藏 tenant.js 老版下拉菜单 */
#userBtn .user-dropdown-menu { display: none !important; }

/* ===== 兼容：使用 fixed 侧栏避让布局的页面（如即梦页） =====
   此类页面用 body.has-sidebar-component 让内容区避让左侧 84px 侧栏。
   关键：body 需 position:relative，这样 absolute inset:0 的内容区（.center-scroll）
   才会相对 body 的 padding box 定位，padding-left 才能生效。 */
body.has-sidebar-component { position: relative; padding-left: 84px; }
body.has-sidebar-component #tenantSidebar,
body.has-sidebar-component .sidebar-component-wrap {
    position: fixed; left: 0; top: 0; bottom: 0; width: 84px; z-index: 100;
}
body.has-sidebar-component .sidebar-component-wrap .side-rail { height: 100%; }

/* ===== 菜单标签角标（对齐首页 ai-chat.html，支持热门/新品/爆款/免费/限时/30秒） ===== */
.side-rail .menu-item .menu-tag {
    position: absolute; top: 3px; right: 3px; z-index: 2;
    padding: 1px 5px; border-radius: 999px;
    color: #fff; font-size: 9px; font-weight: 700; line-height: 1.5;
    white-space: nowrap; pointer-events: none;
}
.side-rail .menu-item .menu-tag.hot  { background: linear-gradient(135deg, #FF6A4D, #F04A3D); }
.side-rail .menu-item .menu-tag.new  { background: linear-gradient(135deg, #34C759, #16A34A); }
.side-rail .menu-item .menu-tag.fire { background: linear-gradient(135deg, #FF8A00, #F59E0B); }
.side-rail .menu-item .menu-tag.free { background: linear-gradient(135deg, #3B82F6, #2563EB); }
.side-rail .menu-item .menu-tag.limit { background: linear-gradient(135deg, #A855F7, #7C3AED); }
.side-rail .menu-item .menu-tag.v30  { background: linear-gradient(135deg, #06B6D4, #0891B2); }
