/* ============================================================
   时间银行 · PC 桌面模式 (pc-mode) — 方案 D（Discord / Slack 风）
   作用域隔离：所有规则以 html.pc-mode 前缀，关闭即 100% 还原手机端。
   布局：最左 74px 深色图标栏 + 旁边 250px 上下文面板（跟随当前模块）
        + 主区双列卡片网格。强「桌面原生 App」感。
   ============================================================ */
:root {
  --pc-icon: 74px;
  --pc-ctx: 250px;
  --pc-rail-bg: #0b2540;   /* 图标栏深色背景 */
}

/* 根容器放开移动端 480 框，左侧让出「图标栏 + 上下文面板」空间 */
html.pc-mode body {
  max-width: none;
  margin: 0;
  padding-left: calc(var(--pc-icon) + var(--pc-ctx));
  padding-right: 0;
  overflow-x: hidden;
}

/* 顶部栏：在内容带内铺满，加轻微阴影区分 */
html.pc-mode .app-header {
  margin: 0;
  box-shadow: var(--shadow-sm);
}

/* ===================== 图标栏（复用 .bottom-nav） ===================== */
html.pc-mode .bottom-nav {
  left: 0;
  top: 0;
  bottom: 0;
  transform: none;
  width: var(--pc-icon);
  max-width: var(--pc-icon);
  height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 14px 0;
  background: var(--pc-rail-bg);
  border-top: none;
  border-right: 1px solid rgba(255, 255, 255, .06);
  box-shadow: none;
  z-index: 300;
  overflow-y: auto;
  overflow-x: hidden;
}
/* 图标栏顶部品牌块（🕰） */
html.pc-mode .bottom-nav::before {
  content: "\1F570";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
  margin-bottom: 12px;
  flex: none;
}
/* 导航项：图标 + 极小文字标签，竖向排列 */
html.pc-mode .bottom-nav .nav-group {
  position: relative;
  flex: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0;
  width: 54px;
  height: 54px;
  margin: 4px 0;
  padding: 0;
  border-radius: 14px;
  background: transparent;
  color: #cbd5e1;
  font-size: 10px;
}
html.pc-mode .bottom-nav .nav-group:active { transform: none; }
html.pc-mode .bottom-nav .nav-group.active {
  background: rgba(255, 255, 255, .14);
  color: #fff;
}
/* Discord 风：激活项左侧高亮条 */
html.pc-mode .bottom-nav .nav-group.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 28px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}
html.pc-mode .bottom-nav .nav-icon { width: 24px; height: 24px; }
html.pc-mode .bottom-nav .nav-label {
  font-size: 10px;
  margin-top: 3px;
  color: inherit;
  font-weight: 600;
}

/* 图标栏底部头像（JS 注入 .pc-me） */
html.pc-mode .pc-me {
  margin-top: auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #1e3a5f;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  flex: none;
}
html.pc-mode .pc-me:hover { filter: brightness(1.12); }

/* ===================== 上下文面板（JS 注入 <aside id="pc-ctx">） ===================== */
#pc-ctx {
  display: none;
  position: fixed;
  top: 0;
  left: var(--pc-icon);
  bottom: 0;
  width: var(--pc-ctx);
  padding: calc(var(--header-height) + 18px) 14px 18px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 290;
}
html.pc-mode #pc-ctx { display: block; }
#pc-ctx .ctx-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  margin: 2px 8px 10px;
}
#pc-ctx .ctx-sub {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .5px;
  margin: 14px 8px 6px;
}
#pc-ctx .ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--text-2);
  font-weight: 600;
  margin: 2px 0;
  cursor: pointer;
}
#pc-ctx .ctx-item:hover { background: var(--surface-2); }
#pc-ctx .ctx-item.on { background: var(--primary-soft); color: var(--primary); }
#pc-ctx .ctx-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: .45;
  flex: none;
}
#pc-ctx .ctx-actions {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
#pc-ctx .ctx-act {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
#pc-ctx .ctx-act:last-child { margin-bottom: 0; }
#pc-ctx .ctx-act.secondary { background: var(--surface-2); color: var(--text); }
#pc-ctx .ctx-act:hover { filter: brightness(.97); }

/* ===================== 主内容：填满非菜单区域 + 桌面卡片双列网格 ===================== */
html.pc-mode .page,
html.pc-mode .more-sub {
  /* 不限宽、不居中：填满「图标栏 + 上下文面板」之外的全部区域，仅保留 20px 呼吸边距 */
  max-width: none;
  margin: 0;
  padding: 16px 20px 40px;
  min-height: calc(100vh - var(--header-height));
}
/* 移动端顶部分段 tab 在 PC 下隐藏，由上下文面板接管视图切换；
   但 body 级 .more-sub（我的心动/好友/消息等）内的 .list-tabs 需保留，否则子视图无法切换 */
html.pc-mode .list-tabs { display: none !important; }
html.pc-mode .more-sub .list-tabs { display: flex !important; margin-bottom: 12px; gap: 4px; border-bottom: 1px solid var(--border); }
html.pc-mode .more-sub .list-tab { padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-3); font-size: 13px; }
html.pc-mode .more-sub .list-tab.active { color: var(--primary); background: var(--surface-2); font-weight: 600; }
/* 市场卡片网格（每行 3 项）。容器对照（id 极易混淆，务必核对）：
   #lm-list-container                          101 出租时间市场（page-lend）
   #rh-list-orders / company / personal / popular   201 租用时间市场的四个子 tab（page-rent）
   #rr-list-container                          203 出租推荐（page-rent 子页，静态示例卡）
   #rec-list-container                         103 租用推荐（page-lend 子页）
   ⚠️ 关键坑：rh-list-* 由 switchRhListTab() 用「内联 style.display」切换，
      内联样式优先级高于 CSS 选择器，会把这里的 display:grid 覆盖成 block。
      故该函数已在 pc-mode 下改为清空内联 display，交回本文件的网格接管。
   窗口偏窄（≤1360px）自动降为 2 列，避免卡片被挤压变形 */
html.pc-mode :is(#lm-list-container, #rh-list-orders, #rh-list-company, #rh-list-personal, #rh-list-popular, #rr-list-container, #rec-list-container) {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 1360px) {
  html.pc-mode :is(#lm-list-container, #rh-list-orders, #rh-list-company, #rh-list-personal, #rh-list-popular, #rr-list-container, #rec-list-container) {
    grid-template-columns: repeat(2, 1fr);
  }
}
/* 卡片在移动端靠 margin-bottom 留间距，网格下清零改由 gap 统一控制 */
html.pc-mode #lm-list-container > *,
html.pc-mode #rr-list-container > *,
html.pc-mode #rec-list-container > *,
html.pc-mode [id^="rh-list-"] > * { margin: 0; }
/* 201 租用需求的详情面板是卡片的「兄弟节点」（不像 101 那样内嵌在卡片里），
   展开后若不跨满整行就会挤占一个卡片格位，导致该行只剩一张卡。 */
html.pc-mode [id^="rh-list-"] > .need-detail-panel { grid-column: 1 / -1; }
/* 卡片在桌面下更挺括 */
html.pc-mode .rec-card,
html.pc-mode .card,
html.pc-mode .notice-card {
  border-radius: var(--radius-md);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
html.pc-mode .rec-card:hover,
html.pc-mode .card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* 弹窗在桌面下更舒适 */
html.pc-mode .modal-box { max-width: 520px; }

/* 桌面下隐藏移动端「下载 App」浮动按钮，避免遮挡 */
html.pc-mode #app-download-fab { display: none !important; }

/* ===================== 一键切换按钮 ===================== */
#pc-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}
#pc-toggle:hover { color: var(--primary); border-color: var(--primary); }

/* ===================== 安全网：窄屏误开 PC 模式时回退为移动框 ===================== */
@media (max-width: 900px) {
  html.pc-mode body {
    max-width: 480px;
    margin: 0 auto;
    padding: 0;
    overflow-x: hidden;
  }
  html.pc-mode .bottom-nav {
    left: 50%;
    top: auto;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--nav-height);
    flex-direction: row;
    align-items: center;
    justify-content: initial;
    gap: 0;
    padding-bottom: var(--nav-safe);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    border-right: none;
    box-shadow: 0 -1px 8px rgba(15, 23, 42, .04);
  }
  html.pc-mode .bottom-nav::before { display: none; }
  html.pc-mode .bottom-nav .nav-group {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    width: auto;
    height: auto;
    margin: 0;
    padding: 6px 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-2);
  }
  html.pc-mode .bottom-nav .nav-group.active { background: transparent; color: var(--primary); }
  html.pc-mode .bottom-nav .nav-group.active::before { display: none; }
  html.pc-mode .bottom-nav .nav-icon { width: 26px; height: 26px; }
  html.pc-mode .bottom-nav .nav-label { font-size: 11px; display: block; }
  html.pc-mode .pc-me { display: none; }
  html.pc-mode #pc-ctx { display: none; }
}
