/* ==========================================================================
   企飞科技 (Qifei Tech) · 全站统一设计系统与全局导航壳 (QF Unified App Shell v3.0)
   核心特性：
   - PC 端：64px 三区悬浮毛玻璃顶栏
   - 移动端：严丝合缝双行原生 App 顶栏（第一行品牌+工具+积分胶囊不换行，第二行 5 等分网格切换器零截断）
   ========================================================================== */

:root {
  --qf-blue: #2563eb;
  --qf-indigo: #4f46e5;
  --qf-cyan: #06b6d4;
  --qf-grad: linear-gradient(135deg, #2563eb 0%, #4f46e5 50%, #06b6d4 100%);
  --qf-grad-hover: linear-gradient(135deg, #1d4ed8 0%, #4338ca 50%, #0891b2 100%);
  --qf-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* 防止任何子页面因宽表格/长文本撑破移动端视口 */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 全局统一顶栏容器 ---------- */
.qf-navbar {
  position: sticky;
  top: 0;
  z-index: 950;
  width: 100%;
  height: 64px;
  display: flex;
  align-items: center;
  font-family: var(--qf-font);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  box-sizing: border-box;
}
.qf-navbar *, .qf-navbar *::before, .qf-navbar *::after {
  box-sizing: border-box;
}

/* 浅色主题（门户 / 个人中心 / 充值中心 / 登录页 / 协议页） */
.qf-navbar.qf-theme-light {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.92);
  box-shadow: 0 4px 20px -4px rgba(15, 23, 42, 0.05);
  color: #0f172a;
}

/* 深色沉浸式创作台主题（AI数字人 / AI生图大师） */
.qf-navbar.qf-theme-dark {
  background: rgba(8, 12, 22, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.5);
  color: #f8fafc;
}

.qf-navbar-inner {
  max-width: 1640px;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.qf-navbar-inner.qf-narrow {
  max-width: 1120px;
}

/* ---------- 左区：统一品牌标识 (Sparkles + 企飞科技 + 子模块徽章) ---------- */
.qf-brand-group {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  min-width: 0;
}

.qf-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none !important;
  color: inherit !important;
  cursor: pointer;
  flex-shrink: 0;
}

.qf-brand-icon {
  width: 35px;
  height: 35px;
  border-radius: 10px;
  background: var(--qf-grad);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.32);
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.qf-brand-link:hover .qf-brand-icon {
  transform: scale(1.05);
}

.qf-brand-icon svg {
  width: 19px;
  height: 19px;
  stroke: #ffffff;
  stroke-width: 2.2;
  fill: none;
}

.qf-brand-title {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}

.qf-theme-light .qf-brand-title { color: #0f172a; }
.qf-theme-dark .qf-brand-title { color: #f8fafc; }

.qf-brand-sep {
  font-size: 15px;
  font-weight: 300;
  opacity: 0.35;
  margin: 0 1px;
  user-select: none;
}

.qf-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 3.5px 9px;
  border-radius: 7px;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.qf-theme-light .qf-brand-badge {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.09), rgba(6, 182, 212, 0.08));
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.18);
}

.qf-theme-dark .qf-brand-badge {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.22), rgba(6, 182, 212, 0.16));
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.28);
}

/* ---------- 中区：全站产品矩阵切换器 (Global App Switcher) ---------- */
.qf-app-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
}

.qf-theme-light .qf-app-switcher {
  background: rgba(241, 245, 249, 0.9);
  border: 1px solid rgba(226, 232, 240, 0.95);
}

.qf-theme-dark .qf-app-switcher {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.085);
}

.qf-app-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none !important;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  position: relative;
}

.qf-app-link .qf-nav-ic {
  font-size: 14px;
  line-height: 1;
}
.qf-lbl-mb {
  display: none;
}

.qf-theme-light .qf-app-link { color: #475569; }
.qf-theme-light .qf-app-link:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
}
.qf-theme-light .qf-app-link.active {
  background: var(--qf-grad);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28);
}

.qf-theme-dark .qf-app-link { color: #94a3b8; }
.qf-theme-dark .qf-app-link:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
}
.qf-theme-dark .qf-app-link.active {
  background: var(--qf-grad);
  color: #ffffff;
  box-shadow: 0 3px 12px rgba(37, 99, 235, 0.38);
}

/* ---------- 右区：工具动作槽 + 全站统一用户与积分胶囊 ---------- */
.qf-nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.qf-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none !important;
  flex-shrink: 0;
}

.qf-theme-dark .qf-tool-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.13);
  color: #e2e8f0;
}
.qf-theme-dark .qf-tool-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(56, 189, 248, 0.45);
  color: #ffffff;
}

.qf-theme-light .qf-tool-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
}

.qf-tool-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--qf-grad);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 800;
}

/* ---------- 统一用户胶囊与下拉菜单 (User & Points Pill + Dropdown) ---------- */
.qf-user-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.qf-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px 0 4px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none !important;
  transition: all 0.2s ease;
  user-select: none;
  flex-shrink: 0;
}

.qf-theme-light .qf-user-pill,
.qf-user-menu-wrap.qf-pill-light .qf-user-pill {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}
.qf-theme-light .qf-user-pill:hover,
.qf-user-menu-wrap.qf-pill-light .qf-user-pill:hover {
  background: #ffffff;
  border-color: #60a5fa;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

.qf-theme-dark .qf-user-pill,
.qf-user-menu-wrap.qf-pill-dark .qf-user-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f8fafc;
}
.qf-theme-dark .qf-user-pill:hover,
.qf-user-menu-wrap.qf-pill-dark .qf-user-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.22);
}

.qf-user-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--qf-grad);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qf-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.18;
  text-align: left;
}

.qf-user-nm {
  font-size: 12px;
  font-weight: 800;
  max-width: 82px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qf-user-bl {
  font-size: 10.5px;
  font-weight: 800;
  color: #2563eb;
  white-space: nowrap;
}

.qf-theme-dark .qf-user-bl,
.qf-user-menu-wrap.qf-pill-dark .qf-user-bl {
  color: #38bdf8;
}

.qf-user-caret {
  font-size: 10px;
  opacity: 0.55;
  margin-left: 1px;
  transition: transform 0.2s ease;
}

.qf-user-menu-wrap:hover .qf-user-caret,
.qf-user-menu-wrap.open .qf-user-caret {
  transform: rotate(180deg);
}

/* 未登录双按钮组（独立「登录」+ 渐变「免费注册」，告别低端斜杠分割） */
.qf-auth-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.qf-btn-login,
.qf-btn-reg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 15px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.qf-reg-mb {
  display: none;
}

/* 浅色主题下的登录与注册按钮 */
.qf-theme-light .qf-btn-login,
.qf-user-menu-wrap.qf-pill-light .qf-btn-login {
  background: #ffffff;
  color: #1e293b;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.qf-theme-light .qf-btn-login:hover,
.qf-user-menu-wrap.qf-pill-light .qf-btn-login:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #f8fafc;
  transform: translateY(-1px);
}

/* 深色主题下的登录按钮 */
.qf-theme-dark .qf-btn-login,
.qf-user-menu-wrap.qf-pill-dark .qf-btn-login {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.qf-theme-dark .qf-btn-login:hover,
.qf-user-menu-wrap.qf-pill-dark .qf-btn-login:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(56, 189, 248, 0.5);
  color: #ffffff;
  transform: translateY(-1px);
}

/* 皇家蓝青渐变注册按钮（深浅主题通用高转化主视觉） */
.qf-btn-reg {
  background: var(--qf-grad);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}
.qf-btn-reg:hover {
  background: var(--qf-grad-hover);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.38);
  transform: translateY(-1px);
}

/* 下拉面板（极简高奢悬浮名片设计，零冗余导航堆砌） */
.qf-user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 244px;
  border-radius: 18px;
  padding: 14px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.98);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  pointer-events: none;
}

/* 桥接透明热区，防止鼠标移向浮层时意外关闭 */
.qf-user-dropdown::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
}

.qf-user-menu-wrap:hover .qf-user-dropdown,
.qf-user-menu-wrap.open .qf-user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.qf-theme-light .qf-user-dropdown,
.qf-user-menu-wrap.qf-pill-light .qf-user-dropdown {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.14), 0 4px 12px -2px rgba(15, 23, 42, 0.05);
  color: #0f172a;
}

.qf-theme-dark .qf-user-dropdown,
.qf-user-menu-wrap.qf-pill-dark .qf-user-dropdown {
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 22px 50px -10px rgba(0, 0, 0, 0.65);
  color: #f8fafc;
}

/* 顶部身份区 */
.qf-dd-profile {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 4px 12px;
}

.qf-dd-av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--qf-grad);
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.qf-dd-info {
  min-width: 0;
  flex: 1;
}

.qf-dd-name {
  font-size: 14.5px;
  font-weight: 900;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qf-dd-role {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  margin-top: 2px;
}
.qf-theme-dark .qf-dd-role,
.qf-user-menu-wrap.qf-pill-dark .qf-dd-role {
  color: #94a3b8;
}

/* 中部精炼积分资产栏 */
.qf-dd-asset {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 13px;
  margin-bottom: 8px;
}

.qf-theme-light .qf-dd-asset,
.qf-user-menu-wrap.qf-pill-light .qf-dd-asset {
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border: 1px solid #dbeafe;
}

.qf-theme-dark .qf-dd-asset,
.qf-user-menu-wrap.qf-pill-dark .qf-dd-asset {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.qf-dd-asset-lbl {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}
.qf-theme-dark .qf-dd-asset-lbl,
.qf-user-menu-wrap.qf-pill-dark .qf-dd-asset-lbl {
  color: #94a3b8;
}

.qf-dd-asset-val {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-top: 2px;
  color: #2563eb;
}
.qf-theme-dark .qf-dd-asset-val,
.qf-user-menu-wrap.qf-pill-dark .qf-dd-asset-val {
  color: #38bdf8;
}

.qf-dd-recharge-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--qf-grad);
  color: #ffffff !important;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: all 0.18s ease;
  white-space: nowrap;
}
.qf-dd-recharge-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

/* 底部纯净操作项 */
.qf-dd-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qf-dd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none !important;
  transition: all 0.15s ease;
  cursor: pointer;
}

.qf-theme-light .qf-dd-item,
.qf-user-menu-wrap.qf-pill-light .qf-dd-item { color: #334155; }
.qf-theme-light .qf-dd-item:hover,
.qf-user-menu-wrap.qf-pill-light .qf-dd-item:hover { background: #f1f5f9; color: #0f172a; }

.qf-theme-dark .qf-dd-item,
.qf-user-menu-wrap.qf-pill-dark .qf-dd-item { color: #cbd5e1; }
.qf-theme-dark .qf-dd-item:hover,
.qf-user-menu-wrap.qf-pill-dark .qf-dd-item:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }

.qf-dd-item-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.qf-dd-arr {
  opacity: 0.45;
  display: flex;
  align-items: center;
}

.qf-dd-logout { color: #ef4444 !important; }
.qf-dd-logout:hover { background: rgba(239, 68, 68, 0.08) !important; color: #dc2626 !important; }

/* 隐藏旧版残留兼容节点 */
#chip, #userChip, .qf-legacy-hidden {
  display: none !important;
  visibility: hidden !important;
  position: fixed !important;
  top: -9999px !important;
  left: -9999px !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ==========================================================================
   移动端原生级丝滑适配 (Mobile Native Experience <= 820px)
   1. 第一行（44px）：左品牌 + 右侧历史按钮与用户积分胶囊，严格单行绝不折行！
   2. 第二行（38px）：5 等分网格切换器（首页 | 数字人 | AI生图 | 充值 | 我的），一屏完整呈现，零截断！
   ========================================================================== */
@media (max-width: 1060px) {
  .qf-brand-sep, .qf-brand-badge {
    display: none;
  }
}

@media (max-width: 820px) {
  .qf-navbar {
    height: auto !important;
    min-height: 0 !important;
    padding: 8px 0 8px !important;
  }
  .qf-navbar-inner {
    padding: 0 12px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px 6px !important;
  }
  /* 第一行左侧：品牌 Logo */
  .qf-brand-group {
    order: 1 !important;
    gap: 7px !important;
  }
  .qf-brand-icon {
    width: 30px !important;
    height: 30px !important;
    border-radius: 8px !important;
  }
  .qf-brand-icon svg {
    width: 16px !important;
    height: 16px !important;
  }
  .qf-brand-title {
    font-size: 16px !important;
  }
  /* 第一行右侧：历史作品按钮 + 用户积分胶囊（严格不换行） */
  .qf-nav-right {
    order: 2 !important;
    margin-left: auto !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
  }
  #qfNavToolsSlot {
    gap: 6px !important;
  }
  .qf-tool-btn {
    height: 32px !important;
    padding: 0 10px !important;
    font-size: 11.5px !important;
    gap: 4px !important;
  }
  .qf-tool-badge {
    min-width: 15px !important;
    height: 15px !important;
    font-size: 10px !important;
    padding: 0 4px !important;
  }
  .qf-user-pill {
    height: 32px !important;
    padding: 0 9px 0 3px !important;
    gap: 6px !important;
  }
  .qf-user-av {
    width: 24px !important;
    height: 24px !important;
    font-size: 11px !important;
  }
  .qf-user-nm {
    font-size: 11px !important;
    max-width: 48px !important;
  }
  .qf-user-bl {
    font-size: 9.5px !important;
  }
  .qf-auth-group {
    gap: 5px !important;
  }
  .qf-btn-login,
  .qf-btn-reg {
    height: 30px !important;
    padding: 0 10px !important;
    font-size: 11.5px !important;
    border-radius: 8px !important;
  }
  .qf-reg-pc {
    display: none !important;
  }
  .qf-reg-mb {
    display: inline !important;
  }

  /* 第二行：5 等分全站矩阵切换栏（零横向滚动、零文字截断） */
  .qf-app-switcher {
    order: 3 !important;
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 3px !important;
    padding: 3px !important;
    border-radius: 10px !important;
    overflow: hidden !important;
  }
  .qf-app-link {
    width: 100% !important;
    min-width: 0 !important;
    padding: 6px 2px !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    gap: 3px !important;
    border-radius: 7px !important;
    justify-content: center !important;
    text-align: center !important;
  }
  .qf-app-link .qf-nav-ic {
    font-size: 12.5px !important;
  }
  .qf-lbl-pc {
    display: none !important;
  }
  .qf-lbl-mb {
    display: inline !important;
  }

  /* 移动端下拉卡片居中靠右浮动，绝不超出视口 */
  .qf-user-dropdown {
    position: fixed !important;
    top: 50px !important;
    right: 12px !important;
    width: 244px !important;
    max-width: calc(100vw - 24px) !important;
  }
}

@media (max-width: 360px) {
  .qf-app-link .qf-nav-ic {
    display: none !important;
  }
  .qf-user-nm {
    display: none !important;
  }
}
