/*
 * shell.css — 网站风两级导航外壳（顶栏 + 二级侧栏 + 账号下拉 + 平台下拉）
 * 只作用于框架类名，不改动业务页面内部组件样式。
 */

:root {
  --topbar-h: 56px;
  --side-w: 220px;
  --frame-line: rgba(0, 0, 0, 0.08);
  --frame-hover: rgba(0, 0, 0, 0.045);
}

/* ===== 布局骨架：列向，顶栏 + 主体 ===== */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.shell-body {
  flex: 1;
  min-height: 0;
  display: flex;
  margin-top: var(--topbar-h);
}

/* ===== 顶栏 ===== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--frame-line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--text-primary);
}
.brand img { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; }
.brand .brand-cn { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; color: var(--text-primary); }
.brand .brand-name { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; color: var(--text-light); align-self: flex-end; margin-bottom: 3px; }

/* 一级导航 */
.primary-nav { display: flex; align-items: center; gap: 2px; height: 100%; }
.pnav {
  position: relative;
  height: 100%;
  display: flex; align-items: center;
  padding: 0 14px;
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary);
  background: none; border: none; cursor: pointer;
  transition: color .15s ease;
}
.pnav:hover { color: var(--text-primary); }
.pnav.active { color: var(--accent); font-weight: 600; }
.pnav.active::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 0;
  height: 2.5px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}

/* 顶栏右侧操作 */
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 9px;
  background: none; color: var(--text-secondary);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--frame-hover); color: var(--text-primary); }

/* 账号按钮 + 下拉 */
.acc-wrap { position: relative; }
.acc-btn {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 8px 0 6px;
  border: 1px solid var(--frame-line);
  border-radius: 9px;
  background: #fff; cursor: pointer;
  transition: background .15s ease;
}
.acc-btn:hover { background: #f7f7f9; }
.acc-avatar {
  position: relative;
  width: 26px; height: 26px;
  border-radius: 7px; object-fit: cover;
}
.acc-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--success);
  border: 1.5px solid #fff;
}
.acc-dot.off { background: var(--text-light); }
.acc-name-line { font-size: 13px; font-weight: 600; color: var(--text-primary); max-width: 120px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-btn .chev { color: var(--text-light); }

.acc-dropdown {
  position: absolute;
  top: calc(100% + 6px); right: 0;
  width: 248px;
  background: #fff;
  border: 1px solid var(--frame-line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: none;
  z-index: 1100;
}
.acc-dropdown.open { display: block; }
.dd-head { display: flex; gap: 10px; align-items: center; padding: 8px 8px 10px; }
.dd-head img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; }
.dd-head .dd-name { font-size: 14px; font-weight: 700; }
.dd-head .dd-email { font-size: 11px; color: var(--text-light);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.dd-badge { display: inline-block; margin-top: 3px; font-size: 10.5px; font-weight: 600;
  padding: 1px 7px; border-radius: 6px; }
.dd-badge.expired { background: var(--danger-soft); color: var(--danger); }
.dd-badge.pro { background: var(--success-soft); color: var(--success); }
.dd-renew {
  display: flex; align-items: center; justify-content: space-between;
  margin: 2px 0 6px; padding: 9px 10px;
  border-radius: 9px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 600; cursor: pointer; border: none; width: 100%;
}
.dd-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 9px;
  border: none; border-radius: 8px;
  background: none; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  text-align: left;
}
.dd-item:hover { background: var(--frame-hover); }
.dd-item svg { color: var(--text-secondary); flex-shrink: 0; }
.dd-sep { height: 1px; background: var(--frame-line); margin: 6px 4px; }
.dd-item.logout { color: var(--danger); }
.dd-item.logout svg { color: var(--danger); }

/* ===== 二级侧栏 ===== */
.side-nav {
  width: var(--side-w);
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid var(--frame-line);
  padding: 16px 12px;
}
.snav-label {
  font-size: 11px; font-weight: 600; color: var(--text-light);
  letter-spacing: .5px; padding: 0 10px 8px;
}
.snav-group {
  font-size: 11px; font-weight: 600; color: var(--text-light);
  padding: 14px 10px 6px;
}
.snav-group:first-child { padding-top: 2px; }
.snav-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  margin-bottom: 2px;
  border: none; border-radius: 8px;
  background: none; cursor: pointer;
  font-size: 13.5px; font-weight: 500; color: var(--text-secondary);
  text-align: left;
  transition: background .15s ease, color .15s ease;
}
.snav-item:hover { background: var(--frame-hover); color: var(--text-primary); }
.snav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.snav-item { position: relative; }
.snav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.snav-item.active::before {
  content: "";
  position: absolute; left: -1px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 2px 2px 0;
  background: var(--accent);
}
.snav-item.active svg { color: var(--accent); }
.snav-item .soon {
  margin-left: auto;
  font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 5px;
  background: var(--frame-hover); color: var(--text-light);
}

/* ===== 主内容：沿用现有 page 组件，仅调整容器 ===== */
.main-content {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  padding: 16px 20px;
}

/* ===== 选品模块水平二级导航（顶栏下方） ===== */
.hub-subnav {
  position: fixed; top: var(--topbar-h); left: 0; right: 0;
  height: 46px; z-index: 900;
  display: flex; align-items: stretch; gap: 2px;
  padding: 0 18px;
  background: #fff;
  border-bottom: 1px solid var(--frame-line);
}
.hub-subnav[hidden] { display: none; }
.hub-tab {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 14px;
  border: none; background: none;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; white-space: nowrap;
  transition: color .15s ease;
}
.hub-tab:hover { color: var(--text-primary); }
.hub-tab.active { color: var(--k); font-weight: 600; }
.hub-tab.active::after {
  content: "";
  position: absolute; left: 14px; right: 14px; bottom: 0;
  height: 2.5px; border-radius: 2px 2px 0 0;
  background: var(--k);
}
.hub-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--k); opacity: .38;
  flex-shrink: 0;
  transition: opacity .15s ease;
}
.hub-tab.active .hub-dot { opacity: 1; }
.hub-tab.c1 { --k: #2f7bd1; }
.hub-tab.c2 { --k: #8f6fd0; }
.hub-tab.c3 { --k: #d18a3f; }
.hub-tab.c4 { --k: #4f9e6e; }
.hub-tab.c5 { --k: #c25f86; }

/* 右上角统一店铺筛选器（与水平二级导航同行） */
.hub-filter {
  position: fixed; top: var(--topbar-h); right: 18px;
  height: 46px; z-index: 901;
  display: flex; align-items: center; gap: 8px;
}
.hub-filter[hidden] { display: none; }
.hub-filter .hf-label { font-size: 12px; color: var(--text-light); white-space: nowrap; }
.hub-filter select {
  min-width: 180px; padding: 7px 10px;
  border: 1px solid #d9dfeb; border-radius: 8px; background: #fff;
  font-size: 13px; font-family: inherit; color: #101828; outline: none; cursor: pointer;
}
.hub-filter select:focus { border-color: #2f6bff; box-shadow: 0 0 0 3px rgba(47,107,255,.12); }
/* 筛选器显示时给二级导航右侧留位，避免 tabs 与筛选器重叠 */
body.filter-on .hub-subnav { padding-right: 210px; }
@media (max-width: 900px) { .hub-filter { display: none; } }

/* 水平二级导航显示时（选品页/平台店铺运营页）：内容区与侧栏整体下移让位 */
body.selection-hub .shell-body,
body.hsub-on .shell-body { margin-top: calc(var(--topbar-h) + 46px); }
body.selection-hub .side-nav { display: none; }

/* 移动端汉堡（默认隐藏） */
.menu-btn { display: none; }

/* ===== 响应式 ===== */
@media (max-width: 1080px) {
  .pnav { padding: 0 10px; }
  .acc-name-line { display: none; }
}

@media (max-width: 900px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .menu-btn { display: flex; }
  .primary-nav { display: none; }
  .brand .brand-name { display: none; }
  .hub-subnav { display: none; }
  body.selection-hub .shell-body,
  body.hsub-on .shell-body { margin-top: var(--topbar-h); }
  body.selection-hub .side-nav { display: block; }
  .side-nav {
    position: fixed;
    top: var(--topbar-h); left: 0; bottom: 0;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .side-nav.show { transform: translateX(0); box-shadow: var(--shadow-md); }
  .nav-backdrop {
    position: fixed; inset: var(--topbar-h) 0 0 0;
    background: rgba(0,0,0,.32);
    z-index: 1040;
    display: none;
  }
  .nav-backdrop.show { display: block; }
  .main-content { padding: 18px 16px; }
}

@media (max-width: 560px) {
  .main-content { padding: 16px 14px; }
}

/* ===== 选品侧栏：卡片化菜单（钢琴键式全宽长条） ===== */
.side-nav.cards-mode {
  background: var(--bg-primary);
  padding: 12px 0 16px;
}
.side-nav.cards-mode .snav-label { display: none; }

.snav-item.snav-card {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 12px 16px;
  margin: 0 0 8px;
  gap: 10px;
  position: relative;
  text-align: left;
  transition: background .15s ease, border-color .15s ease;
}
.snav-item.snav-card:hover {
  background: #fbfbfd;
  border-color: var(--border-strong);
}

/* 四个功能主题色（低饱和柔和版）：蓝 / 紫 / 橙 / 绿 */
.snav-card.c1 { --k: #2f7bd1; --k-soft: #f2f7fd; --k-line: rgba(47, 123, 209, .20); }
.snav-card.c2 { --k: #8f6fd0; --k-soft: #f7f3fc; --k-line: rgba(143, 111, 208, .20); }
.snav-card.c3 { --k: #d18a3f; --k-soft: #fdf6ee; --k-line: rgba(209, 138, 63, .20); }
.snav-card.c4 { --k: #4f9e6e; --k-soft: #f0f8f3; --k-line: rgba(79, 158, 110, .20); }

.snav-card .snav-card-tx {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
}
.snav-card .snav-card-name {
  font-size: 13.5px; font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .15s ease;
}
.snav-card .snav-card-desc {
  font-size: 11px; color: var(--text-light);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 选中态：淡主题色底 + 细淡边框 + 名称着淡主题色（无图标、无勾、无彩条） */
.snav-item.snav-card.active {
  background: var(--k-soft);
  border-color: var(--k-line);
}
.snav-item.snav-card.active:hover { background: var(--k-soft); border-color: var(--k-line); }
.snav-item.snav-card.active::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  height: auto;
  width: 3px;
  background: var(--k);
}
.snav-card.active .snav-card-name { color: var(--k); }
.snav-card.active .snav-card-desc { color: var(--text-secondary); }

/* 模块改造中占位（阶段一临时，阶段二随模块重写移除） */
.module-hold {
  display: none;
  margin: 36px 0;
  padding: 32px 24px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--text-secondary);
  text-align: center;
  background: #f7f8fa;
}
#page-gross.module-hold-on .module-hold { display: block; }
#page-gross.module-hold-on .gross-sub { display: none !important; }
