/* runtime/runtime.css —— H5 运行时的基础样式
 * 只负责「小程序原生组件 → HTML 元素」的观感补齐：
 *   - 页面容器 / 顶部导航条 / 底部 tabBar
 *   - image、input、switch、picker、swiper、scroll-view 的基础盒模型
 *   - toast / loading / modal / actionSheet / 图片预览
 * 业务样式仍然来自 miniapp 的 wxss（构建时 rpx→rem 转换后注入），所以这里**不要**写业务类名。
 */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #F5F6F8;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: #1A2B4C;
}

body { padding-top: var(--h5-navbar-h); }   /* 预留顶部导航条高度（见 :root 的 --h5-navbar-h） */

:root {
  --h5-navbar-h: 0.88rem;   /* 88rpx；1rem = 100rpx（见 index.html 的 html{font-size:100vw/7.5}） */
  --h5-tabbar-h: 1.02rem;   /* 102rpx */
}

/* ---------- 顶部导航条（小程序自带，H5 需要自己画） ---------- */
.h5-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--h5-navbar-h);
  display: flex;
  align-items: center;
  background: #FFFFFF;
  border-bottom: 1px solid #EFF0F3;
  z-index: 100;
}
.h5-navbar-back {
  width: 1.2rem;
  padding-left: 0.3rem;
  font-size: 0.7rem;
  line-height: 1;
  color: #1A2B4C;
  cursor: pointer;
}
.h5-navbar-title {
  flex: 1;
  text-align: center;
  font-size: 0.34rem;
  font-weight: 600;
  color: #1A2B4C;
  margin-right: 1.2rem;
}

/* ---------- 页面容器 ---------- */
.h5-pages { min-height: 60vh; }
.h5-page { display: block; }
.h5-pages.with-tabbar { padding-bottom: var(--h5-tabbar-h); }

/* ---------- 底部 tabBar（内容由 custom-tab-bar 组件渲染） ---------- */
.h5-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #FFFFFF;
  border-top: 1px solid #EFF0F3;
  z-index: 100;
}
.h5-tabbar .h5-component { display: block; }
.h5-component { display: block; }

/* ---------- 基础元素 ---------- */
.h5-image { display: block; width: 100%; height: 100%; }
.h5-scroll-view { -webkit-overflow-scrolling: touch; }
.h5-input { border: none; outline: none; font: inherit; color: inherit; background: transparent; width: 100%; }
textarea.h5-input { resize: none; }
button.h5-input, button { font: inherit; }

/* swiper：横向滚动 + 吸附；指示点由 runtime 省略（业务样式里通常没写点的定位） */
.h5-swiper {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.h5-swiper::-webkit-scrollbar { display: none; }
.h5-swiper-item { flex: 0 0 100%; scroll-snap-align: start; }

/* switch（小程序原生开关） */
.h5-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
  vertical-align: middle;
}
.h5-switch > input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; z-index: 2; }
.h5-switch-knob {
  position: absolute;
  inset: 0;
  background: #E5E5E5;
  border-radius: 999px;
  transition: background .2s;
}
.h5-switch-knob::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .2s;
}
.h5-switch > input:checked + .h5-switch-knob { background: var(--h5-switch-on, #04BE02); }
.h5-switch > input:checked + .h5-switch-knob::after { transform: translateX(20px); }

/* picker：日期用原生 input；其余模式由 wx.showModal 风格弹层兜底 */
.h5-picker { position: relative; }
.h5-picker-native {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
}
canvas { display: block; }

/* ---------- toast / loading / modal / sheet / 预览 ---------- */
.h5-toast {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  min-width: 120px;
  max-width: 70%;
  padding: 14px 18px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .78);
  color: #FFFFFF;
  text-align: center;
  z-index: 300;
}
.h5-toast-icon { font-size: 30px; line-height: 1.2; }
.h5-toast-text { font-size: 14px; line-height: 1.5; }
.h5-toast-text-plain { padding: 4px 2px; }

.h5-loading {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  padding: 18px 20px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .78);
  color: #FFFFFF;
  text-align: center;
  z-index: 300;
}
.h5-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 8px;
  border: 3px solid rgba(255, 255, 255, .3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: h5-spin .8s linear infinite;
}
@keyframes h5-spin { to { transform: rotate(360deg); } }
.h5-loading-text { font-size: 13px; }

.h5-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 290; }
.h5-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 6.6rem;
  max-width: 78vw;
  background: #FFFFFF;
  border-radius: 12px;
  overflow: hidden;
  z-index: 310;
}
.h5-modal-title { padding: 20px 20px 6px; font-size: 16px; font-weight: 600; text-align: center; }
.h5-modal-content { padding: 0 20px 16px; font-size: 14px; line-height: 1.6; color: #4A5160; text-align: center; white-space: pre-wrap; }
.h5-modal-editable .h5-modal-content { text-align: left; }
.h5-modal-input {
  display: block;
  width: calc(100% - 40px);
  margin: 0 20px 16px;
  padding: 8px 10px;
  border: 1px solid #E2E5EA;
  border-radius: 8px;
  font-size: 14px;
}
.h5-modal-actions { display: flex; border-top: 1px solid #EFF0F3; }
.h5-modal-btn { flex: 1; padding: 14px 0; text-align: center; font-size: 15px; cursor: pointer; }
.h5-modal-cancel { color: #6B7280; border-right: 1px solid #EFF0F3; }
.h5-modal-confirm { color: #1A2B4C; font-weight: 600; }

.h5-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #FFFFFF;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
  z-index: 310;
}
.h5-sheet-item, .h5-sheet-cancel { padding: 15px 0; text-align: center; font-size: 15px; cursor: pointer; }
.h5-sheet-item { border-bottom: 1px solid #F2F3F5; }
.h5-sheet-cancel { color: #6B7280; }

.h5-preview {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 320;
}
.h5-preview img, .h5-preview video { max-width: 100%; max-height: 86vh; }
.h5-preview-tip { margin-top: 12px; color: #D6D8DC; font-size: 13px; }

.h5-fatal {
  margin: 20px;
  padding: 16px;
  background: #FFF3F3;
  color: #B3261E;
  border-radius: 10px;
  font-size: 12px;
  white-space: pre-wrap;
}
