/* ============================================================
 * mobile-app.css — PWA / Capacitor 原生 APP 模式样式
 * 仅在 display-mode:standalone 或 Capacitor 环境下生效（html.app-mode）
 * 目标：去掉模拟手机壳、全屏铺满、适配刘海与底部手势区
 * ============================================================ */

/* ---------- 启动屏 ---------- */
#app-splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1a56a0 0%, #0f3b78 55%, #0a2c5e 100%);
  color: #fff; text-align: center;
  transition: opacity .38s ease, visibility .38s ease;
  -webkit-user-select: none; user-select: none;
}
#app-splash.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
#app-splash .sp-logo {
  width: 96px; height: 96px; border-radius: 24px;
  background: rgba(255,255,255,.14);
  box-shadow: 0 12px 34px rgba(0,0,0,.22), inset 0 0 0 1px rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px; animation: sp-pop .5s cubic-bezier(.2,.9,.3,1.2) both;
}
#app-splash .sp-logo img { width: 82px; height: 82px; border-radius: 20px; }
#app-splash .sp-name { font-size: 22px; font-weight: 800; letter-spacing: .5px; }
#app-splash .sp-sub { font-size: 12px; opacity: .78; margin-top: 5px; letter-spacing: 1.2px; }
#app-splash .sp-spin {
  width: 26px; height: 26px; margin-top: 32px;
  border: 2.5px solid rgba(255,255,255,.28); border-top-color: #e3b341;
  border-radius: 50%; animation: sp-rotate .8s linear infinite;
}
#app-splash .sp-foot {
  position: absolute; bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  font-size: 10px; opacity: .55; letter-spacing: .6px;
}
@keyframes sp-rotate { to { transform: rotate(360deg); } }
@keyframes sp-pop { from { transform: scale(.75); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- 原生 APP 全屏模式 ---------- */
html.app-mode, html.app-mode body {
  height: 100%; overflow: hidden;
  overscroll-behavior: none; -webkit-overflow-scrolling: touch;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
html.app-mode body { background: var(--primary-d); }

/* 关键：APP 模式下 html/body 锁死滚动，必须让 #app 成为统一的滚动容器。
   门户页/功能页/关于页/登录页都没有内部 .wap-scroll，若 #app 不滚动则
   超出一屏的内容（门户页高达 2700px+）完全无法查看——表现为"界面不能上下滑"。
   #app 自身滚动，与 wap 内部 .wap-scroll 嵌套共存（内层内容自适应高度，不冲突）。 */
html.app-mode #app {
  height: 100vh; height: 100dvh;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  box-sizing: border-box;
}

html.app-mode .stage {
  padding: 0; margin: 0; min-height: 100vh; min-height: 100dvh;
  align-items: stretch; display: block;
}
html.app-mode .phone {
  width: 100%; height: 100vh; height: 100dvh; min-height: 0;
  border-radius: 0; padding: 0; box-shadow: none; background: var(--bg);
}
html.app-mode .phone-body {
  height: 100%; border-radius: 0;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--primary-d);
}
html.app-mode .phone-notch,
html.app-mode .phone-status { display: none !important; }

/* 内容滚动区：独立于外壳，底部留出 Home 指示条 */
html.app-mode .wap-scroll {
  height: 100%; flex: 1 1 auto; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html.app-mode .wap-inner { min-height: 100%; }

/* 顶部导航安全区：让渐变色延伸进状态栏 */
html.app-mode .wap-head { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
html.app-mode .subhead { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }

/* 底部 Tab：适配手势区，去掉模拟机圆角 */
html.app-mode .wap-tabbar {
  height: calc(58px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  flex: none;
}
html.app-mode .wap-tabbar .tab { padding: 6px 0 4px; }

/* 已装成 APP 后，门户页的"安装到手机"按钮无意义，隐藏之 */
html.app-mode .install-btn { display: none !important; }

/* 管理后台在移动端横屏/大屏 APP 中的基础适配 */
html.app-mode .admin { min-height: 100vh; min-height: 100dvh; }

/* PWA 安装横幅占位（如自行接入 beforeinstallprompt 可用） */
#pwa-install {
  position: fixed; left: 14px; right: 14px; bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  z-index: 200; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: 0 10px 30px rgba(15,35,70,.18);
  padding: 12px 14px; display: flex; align-items: center; gap: 10px;
}
#pwa-install[hidden] { display: none; }
#pwa-install .t { flex: 1; font-size: 12.5px; font-weight: 600; }
#pwa-install button {
  border: 0; background: var(--primary); color: #fff; border-radius: 8px;
  padding: 7px 12px; font-size: 12px; font-weight: 700;
}
#pwa-install .x { background: none; color: var(--muted); padding: 6px; font-size: 16px; }

/* ---------- 窄屏顶栏压缩：品牌名完整显示、退出按钮不出屏 ---------- */
@media (max-width: 560px) {
  html.app-mode .apptop {
    gap: 6px;
    padding: 0 10px;
    padding-top: env(safe-area-inset-top, 0px);
    height: auto;
    min-height: calc(52px + env(safe-area-inset-top, 0px));
    overflow: hidden;
  }
  /* 品牌名禁止换行，完整显示「老挝招聘」 */
  html.app-mode .apptop .brand { gap: 6px; font-size: 14px; flex: none; }
  html.app-mode .apptop .brand span { white-space: nowrap; }
  /* 返回按钮只留箭头图标 */
  html.app-mode .apptop .back-txt { display: none; }
  html.app-mode .apptop .btn.btn-sm { padding: 5px 8px; }
  /* 用户名胶囊收起（「我的」页里仍能看到账号） */
  html.app-mode .apptop .role-pill { display: none; }
  /* 退出按钮只留图标 */
  html.app-mode .apptop .btn-logout { display: inline-flex; align-items: center; padding: 6px 8px; }
  html.app-mode .apptop .logout-txt { display: none; }
  /* 语言切换保留但收紧 */
  html.app-mode .apptop .lang-switch { padding: 2px; }
  html.app-mode .apptop .lang-switch button { padding: 4px 7px; font-size: 11px; }
}
