/* ==========================================================================
   问渠 WenQu —— 桌面端左栏导航 Web App 外壳（css/app-shell.css）
   --------------------------------------------------------------------------
   仅供功能页（app/daily/study/result/errorbook/vocab/learn/onboarding/account/pay）
   在 style.min.css、各页 extra css、mobile-app.min.css 之后引入。

   职责：
   - ≥1024px：左侧固定深墨色栏目导航（品牌 + 栏目链接 + 底部用户区）
   - 右侧内容区 margin-left:248px，宽度充分利用（容器 1140）
   - 桌面隐藏原顶部 .site-header（品牌/导航已收进侧栏）
   - <1024px：侧栏隐藏，保留原有顶部 header 与移动端外壳

   设计纪律：无 icon、无 CSS 自绘图形、无「框内单字」标识；素材真实；字体分层不变。
   ========================================================================== */

/* —— 原生 button 外观重置：去浏览器默认样式，按钮继承站点字体/配色 —— */
button,
input[type="button"],
input[type="submit"],
[role="button"] {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  margin: 0;
  padding: 0;
  font: inherit;
  font-family: inherit;
  color: inherit;
  line-height: inherit;
  cursor: pointer;
  text-align: inherit;
  letter-spacing: inherit;
}

/* ==========================================================================
   功能页页头横幅（真实摄影素材 + 深色渐变压字）
   由 app-shell.css 统一提供，所有功能页共享（含 app.html）
   ========================================================================== */
.wq-top-kicker {
  font-family: var(--display);
  font-weight: 600;
  font-size: .76rem;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin: 0 0 8px;
}
.wq-page-hero {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  margin: 4px 0 22px;
  min-height: 128px;
  display: flex;
  align-items: flex-end;
}
.wq-page-hero picture {
  position: absolute;
  inset: 0;
}
.wq-page-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.wq-page-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(15, 23, 42, .62), rgba(15, 23, 42, .12));
}
.wq-page-hero-text {
  position: relative;
  padding: 22px 24px;
}
.wq-page-hero-text h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  margin: 0;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .35);
}
.wq-page-hero-text p {
  margin: 6px 0 0;
  font-size: .9rem;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .3);
}
/* 深色照片上的小字用亮金，保证可读 */
.wq-page-hero-text .wq-top-kicker {
  color: var(--gold-2);
  margin-bottom: 10px;
}

/* ==========================================================================
   侧栏本体（默认隐藏；≥1024px 显示）
   ========================================================================== */
#appSidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 60;
  width: 248px;
  display: none;
  flex-direction: column;
  background: #fff;
  color: var(--ink);
  border-right: 1px solid var(--line);
  box-shadow: 2px 0 16px rgba(15, 23, 42, .04);
}
.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}

/* —— 顶部品牌 —— */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}
.sidebar-brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}
.sidebar-brand-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--ink);
  letter-spacing: .04em;
  line-height: 1.2;
}
.sidebar-brand-en {
  font-family: var(--display);
  font-weight: 700;
  font-size: .72rem;
  letter-spacing: .22em;
  color: var(--gold);
  text-transform: uppercase;
  margin-left: 6px;
}

/* —— 栏目导航（纯文字；当前页：金色左描边 + 淡金底） —— */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 14px 8px;
  flex: 1;
}
.sidebar-link {
  display: block;
  padding: 12px 16px;
  border-radius: 10px;
  border-left: 3px solid transparent;
  font-family: var(--sans);
  font-size: .97rem;
  letter-spacing: .02em;
  color: var(--ink-soft);
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.sidebar-link:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.sidebar-link.active {
  background: rgba(79, 110, 247, .1);
  border-left-color: var(--gold);
  color: var(--gold-deep);
  font-weight: 700;
}

/* —— 底部用户区 —— */
.sidebar-foot {
  padding: 16px 18px 22px;
  border-top: 1px solid var(--line);
}
.sidebar-user {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.su-phone {
  font-family: var(--display);
  font-weight: 600;
  font-size: .92rem;
  color: var(--ink);
  letter-spacing: .04em;
}
.su-login,
.su-logout {
  font-family: var(--sans);
  font-size: .88rem;
  color: var(--muted);
  transition: color .18s ease;
}
.su-login:hover,
.su-logout:hover {
  color: var(--gold-deep);
}
.sidebar-download {
  display: block;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-family: var(--sans);
  font-size: .84rem;
  letter-spacing: .02em;
  color: var(--muted);
  transition: color .18s ease;
}
.sidebar-download:hover {
  color: var(--gold-deep);
}

/* ==========================================================================
   桌面端（≥1024px）布局
   ========================================================================== */
@media (min-width: 1024px) {
  #appSidebar { display: flex; }

  /* 原顶部导航收进侧栏：桌面隐藏 */
  .site-header { display: none; }

  /* 右侧内容区：避开侧栏、充分利用宽度
     （覆盖 .dashboard-main/.study-main/.daily-main 及各页行内 max-width） */
  main.shell-main.container,
  main.shell-main {
    width: auto !important;
    max-width: 1280px !important;
    margin-left: 248px !important;
    margin-right: auto !important;
  }

  /* 页脚内容与内容区对齐（侧栏固定不动，页脚整条仍为墨色） */
  .site-footer .container { margin-left: 248px; }

  /* —— 功能页页头更饱满：加高 + 更深的左向渐变叠压白字 —— */
  .wq-page-hero {
    min-height: 196px;
    border-radius: 20px;
    margin: 6px 0 26px;
  }
  .wq-page-hero-overlay {
    background: linear-gradient(90deg, rgba(15, 23, 42, .78) 0%, rgba(15, 23, 42, .42) 48%, rgba(15, 23, 42, .12) 100%);
  }
  .wq-page-hero-text { padding: 26px 30px; }
  .wq-page-hero-text h2 { font-size: 1.9rem; }
  .wq-page-hero-text p { font-size: .96rem; }
  .wq-top-kicker { margin-bottom: 12px; }

  /* —— 个人主页入口横幅在桌面更舒展 —— */
  .entry-panel { padding: 34px 36px; }
  .entry-title { font-size: 1.6rem; }
}

/* —— 功能页提示条：细描边更清晰 —— */
.alert {
  border: 1px solid rgba(179, 68, 47, .16);
  border-radius: 12px;
  line-height: 1.6;
}
.alert.ok { border-color: rgba(46, 125, 91, .18); }
.alert.info { border-color: rgba(79, 110, 247, .22); }

/* —— 功能页背景：顶部暖金微光（与购买页同源），内容区更显质感 —— */
body.app-page,
body.account-page {
  background:
    radial-gradient(920px 460px at 50% -140px, rgba(79, 110, 247, .10), transparent 64%),
    var(--paper);
}

/* —— 全站焦点可见态与选区色（功能页通用，键盘可达性） —— */
.shell-main :focus-visible {
  outline: 2px solid var(--gold-2);
  outline-offset: 2px;
  border-radius: 6px;
}
.shell-main ::selection {
  background: rgba(214, 162, 63, .28);
  color: var(--ink);
}

/* ==========================================================================
   2026-08-17 侧栏 / 页头细节打磨（v2）
   - 侧栏滚动条细金美化
   - 链接 hover 微位移、active 渐变底
   - 用户区、品牌区层次微调
   - 页头入场微动效（尊重 prefers-reduced-motion）
   ========================================================================== */
.sidebar-inner::-webkit-scrollbar { width: 8px; }
.sidebar-inner::-webkit-scrollbar-track { background: transparent; }
.sidebar-inner::-webkit-scrollbar-thumb {
  background: rgba(214, 162, 63, .34);
  border-radius: 999px;
  border: 2px solid #0F172A;
}
.sidebar-inner::-webkit-scrollbar-thumb:hover { background: rgba(214, 162, 63, .55); }
.sidebar-inner { scrollbar-width: thin; scrollbar-color: rgba(214, 162, 63, .34) transparent; }

/* —— 链接交互细化 —— */
.sidebar-link {
  position: relative;
  transform: translateX(0);
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.sidebar-link:hover { transform: translateX(2px); }
.sidebar-link.active {
  background: linear-gradient(90deg, rgba(79, 110, 247, .22), rgba(79, 110, 247, .07));
  border-left-color: var(--gold-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
/* —— 品牌区 —— */
.sidebar-brand { padding: 24px 24px 18px; }
.sidebar-brand-logo { border-radius: 10px; }

/* —— 用户区 —— */
.sidebar-foot { padding: 18px 20px 24px; }
.su-phone { letter-spacing: .1em; }
.su-login, .su-logout { display: inline-block; padding: 2px 0; }
.su-login { color: var(--gold-2); }

/* —— 页头入场微动效 —— */
.wq-page-hero {
  animation: wqHeroIn .5s ease both;
}
@keyframes wqHeroIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .wq-page-hero { animation: none; }
  .sidebar-link { transition: background .18s ease, color .18s ease, border-color .18s ease; }
  .sidebar-link:hover { transform: none; }
}

/* ==========================================================================
   窄屏（<1024px）：侧栏隐藏，保留原顶部 header 与移动端外壳
   ========================================================================== */
@media (max-width: 1023.98px) {
  #appSidebar { display: none; }
}

/* —— 手机端（≤640px）页头更紧凑，登录卡/内容区更早可见 —— */
@media (max-width: 640px) {
  .wq-page-hero { min-height: 104px; border-radius: 16px; margin: 2px 0 16px; }
  .wq-page-hero-text { padding: 16px 18px; }
  .wq-page-hero-text h2 { font-size: 1.26rem; }
  .wq-page-hero-text p { font-size: .84rem; }
}
