/* ============================================================
   浙里办仿制 — 主样式表
   规范: 用 vw/vh/rem/% 做布局,禁止固定 px 写布局(字号可配媒体查询)
   ============================================================ */

/* ---------- 基础重置 ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* 去除链接/按钮默认样式 */
a, button {
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

/* 图片默认无间隙 */
img {
  display: block;
  max-width: 100%;
}

/* ---------- #app 容器 ---------- */
#app {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: #f5f5f5;
}

/* ============================================================
   截图页样式
   ============================================================ */
.shot-page {
  width: 100vw;
  height: 100vh;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;          /* 容忍边缘裁切,保证不变形 */
  position: relative;
}

/* ---------- 热点(可点击区域) ---------- */
.hotspot {
  position: absolute;
  background: transparent;
  cursor: pointer;
  /* 调试期可打开红色边框,定位准确后注释掉 */
  /* border: 1px solid rgba(255, 0, 0, 0.4); */
  /* background: rgba(255, 0, 0, 0.1); */
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}

/* 调试模式:给 body 加 .debug-hotspots 类即可显示所有热点 */
body.debug-hotspots .hotspot {
  border: 1px dashed rgba(255, 0, 0, 0.6);
  background: rgba(255, 0, 0, 0.08);
}

/* ============================================================
   代码页通用样式
   ============================================================ */
.code-page {
  width: 100vw;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: #f5f5f5;
  position: relative;
}

/* ---------- 顶部导航栏 ---------- */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  height: 11.73vw;                 /* 约 44px @375pt */
  padding: 0 4vw;
  padding-top: env(safe-area-inset-top, 0px); /* 留出状态栏空间 */
  background: #ffffff;
  border-bottom: 1px solid #eee;
  font-size: 4.27vw;               /* 约 16px */
  font-weight: 600;
  color: #333;
}

.nav-bar .nav-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 8vw;
  height: 8vw;
  font-size: 5.33vw;
  color: #333;
  margin-left: -2vw;
}

.nav-bar .nav-title {
  flex: 1;
  text-align: center;
  margin-right: 8vw;               /* 抵消返回键宽度,居中 */
}

/* ---------- 表单区域 ---------- */
.form-section {
  background: #fff;
  margin-top: 2.67vw;
  padding: 0 4vw;
}

.form-item {
  display: flex;
  align-items: center;
  min-height: 13.33vw;            /* 约 50px */
  border-bottom: 1px solid #f0f0f0;
}

.form-item:last-child {
  border-bottom: none;
}

.form-item label {
  flex-shrink: 0;
  width: 24vw;
  font-size: 3.73vw;               /* 约 14px */
  color: #666;
}

.form-item input,
.form-item select,
.form-item textarea {
  flex: 1;
  border: none;
  outline: none;
  font-size: 3.73vw;
  color: #333;
  background: transparent;
  -webkit-user-select: text;
  user-select: text;
}

.form-item input::placeholder {
  color: #bbb;
}

/* ---------- 按钮 ---------- */
.btn-primary {
  display: block;
  width: 92vw;
  height: 11.73vw;
  margin: 5.33vw auto 0;
  border-radius: 5.87vw;           /* 约 22px */
  background: #1677ff;             /* 浙里办主蓝色(从截图取色) */
  color: #fff;
  font-size: 4.27vw;
  font-weight: 600;
  text-align: center;
  line-height: 11.73vw;
}

.btn-primary:active {
  opacity: 0.85;
}

.btn-primary:disabled {
  background: #a0c4ff;
}

/* ---------- 列表 ---------- */
.list-item {
  display: flex;
  align-items: center;
  min-height: 13.33vw;
  padding: 0 4vw;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}

.list-item:active {
  background: #f5f5f5;
}

.list-item .item-text {
  flex: 1;
  font-size: 3.73vw;
  color: #333;
}

.list-item .item-arrow {
  color: #ccc;
  font-size: 4vw;
}

/* ---------- 加载提示 ---------- */
.loading-mask {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-mask .spinner {
  width: 10.67vw;
  height: 10.67vw;
  border: 0.8vw solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-mask .loading-text {
  margin-top: 3vw;
  color: #fff;
  font-size: 3.73vw;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- 页面切换动画 ---------- */
.page-enter {
  animation: slideInRight 0.25s ease-out;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.page-exit {
  animation: slideOutLeft 0.25s ease-in;
}

@keyframes slideOutLeft {
  from { transform: translateX(0); }
  to   { transform: translateX(-30%); }
}

/* ---------- 摄像头页面 ---------- */
.camera-page {
  width: 100vw;
  height: 100vh;
  background: #000;
  position: relative;
  overflow: hidden;
}

.camera-page video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.camera-overlay .face-guide {
  width: 60vw;
  height: 80vw;
  border: 0.5vw solid rgba(255,255,255,0.6);
  border-radius: 50%;
  position: relative;
}

.camera-overlay .status-text {
  margin-top: 6vw;
  color: #fff;
  font-size: 4vw;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.camera-overlay .status-text.success {
  color: #4caf50;
}

.camera-capture-btn {
  position: absolute;
  bottom: 10vw;
  left: 50%;
  transform: translateX(-50%);
  width: 16vw;
  height: 16vw;
  border-radius: 50%;
  border: 0.8vw solid #fff;
  background: rgba(255,255,255,0.3);
  z-index: 11;
}

.camera-capture-btn:active {
  background: rgba(255,255,255,0.6);
}

/* ============================================================
   搜索页样式 (混合模式: 代码顶栏 + 截图/联想切换)
   ============================================================ */

/* ---------- 搜索页容器 ---------- */
.search-page {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
}

/* ---------- 状态栏安全区域(代码页通用)
     网页延伸到状态栏后,内容会被状态栏遮挡,
     需要在顶部预留空白区域(约 24-28dp / 6.5-7.5vw).
     首页是截图页,截图本身已包含状态栏区域,不需要此占位.
     所有代码页都需要加这个占位.
     ---------- */
.status-bar-spacer {
  width: 100%;
  height: env(safe-area-inset-top, 10.8vw); /* 约 27.5px @375pt,适配刘海屏 */
  flex-shrink: 0;
  background: #fff;                     /* 与页面背景一致 */
}

/* ---------- 搜索顶部栏(地区 + 输入框 + 取消) ---------- */
.search-bar {
  display: flex;
  align-items: center;
  padding: 2.67vw 4vw;
  /* 不再单独加 safe-area-inset-top,由上方的 status-bar-spacer 统一处理 */
  background: #fff;
  border-bottom: 0.27vw solid #f0f0f0;
  flex-shrink: 0;
  z-index: 100;
}

/* 地区选择器 */
.search-bar .region-selector {
  display: flex;
  align-items: center;
  font-size: 3.73vw;
  color: #333;
  font-weight: 500;
  white-space: nowrap;
  margin-right: 2.67vw;
  cursor: pointer;
}

.search-bar .region-selector::after {
  content: '';
  display: inline-block;
  margin-left: 1.07vw;
  width: 0;
  height: 0;
  border-left: 1.5vw solid transparent;
  border-right: 1.5vw solid transparent;
  border-top: 1.8vw solid #999;
}

/* 搜索输入框区域 */
.search-bar .search-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  height: 9.87vw;               /* 约 37px */
  background: #f5f5f5;
  border-radius: 4.93vw;
  padding: 0 3.73vw;
  position: relative;
}

.search-bar .search-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 3.47vw;             /* 约 13px */
  color: #333;
  -webkit-user-select: text;
  user-select: text;
}

.search-bar .search-input-wrap input::placeholder {
  color: #bbb;
}

/* 清除按钮(×) — 有内容时显示 */
.search-bar .search-clear-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 4.33vw;
  height: 4.33vw;
  border-radius: 50%;
  background: #88909d;
  color: #fff;
  font-size: 3.2vw;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 1.33vw;
}

.search-bar .search-clear-btn.visible {
  display: flex;
}

.search-bar .search-clear-btn:active {
  background: #999;
}

/* 取消按钮 */
.search-bar .cancel-btn {
  font-size: 3.73vw;
  color: #1677ff;
  white-space: nowrap;
  margin-left: 2.67vw;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- 搜索下方内容区 ---------- */
.search-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

/* --- 初始态:截图背景 --- */
.search-content .content-screenshot {
  width: 100%;
  min-height: 100%;
  /* search1.png 包含了原搜索页完整截图,
     需要裁掉顶部栏部分(约 25vw),只保留"我的常用"+"为你推荐"区域 */
  background-image: url('../images/screenshots/search1.png');
  background-repeat: no-repeat;
  background-position: center top;
  background-size: 100% auto;
  display: block;
}

/* 隐藏态 */
.search-content .content-screenshot.hidden {
  display: none;
}

/* --- 联想列表态 --- */
.search-content .content-suggestions {
  display: none;
  background: #fff;
  min-height: 100%;
}

.search-content .content-suggestions.visible {
  display: block;
}

/* --- 搜索结果态(点击联想词后) --- */
.search-content .content-result {
  display: none;
  width: 100%;
  min-height: 100%;
  background-repeat: no-repeat;
  background-position: center top;
  background-size: 100% auto;
}

.search-content .content-result.visible {
  display: block;
}

/* 联想列表项 */
.suggestion-item {
  display: flex;
  align-items: center;
  padding: 3.2vw 4vw;
  border-bottom: 0.27vw solid #f5f5f5;
  font-size: 5.2vw;
  color: #333;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0,0,0,0.05);
}

.suggestion-item:active {
  background: #f5f5f5;
}

/* 联想关键词高亮(匹配部分加粗) */
.suggestion-item .match-text {
  font-weight: 600;
  color: #1677ff;
}

/* ============================================================
   Loading 页面样式 (登录认证中)
   ============================================================ */

.loading-page {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
}

/* 内容区 */
.loading-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 22vh;
  position: relative;
}

/* 卡片区域 */
.card-wrapper {
  position: relative;
  width: 19vw;
  height: 19vw;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 3.6vw;
}

/* 外方框 */
.card-outer-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  border-radius: 2vw;
  overflow: hidden;
}

/* 斜线填充 */
.card-outer-frame .diagonal-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f2f4ff;
  background-image:
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 1vw,
      rgba(255,255,255,0.75) 1vw,
      rgba(255,255,255,0.75) 2vw
    );
  opacity: 0;
  animation: linesFadeIn 0.6s ease-out 1.5s forwards;
}

@keyframes linesFadeIn {
  to { opacity: 1; }
}

/* SVG 外框线条 */
.card-outer-frame svg.frame-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.card-outer-frame .frame-path {
  fill: transparent;
  stroke: #6b8fcc;
  stroke-width: 0.32vw;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 350;
  stroke-dashoffset: 350;
  animation: frameDraw 2s ease-in-out forwards;
}

@keyframes frameDraw {
  from { stroke-dashoffset: 350; }
  to { stroke-dashoffset: 0; }
}

/* SIM卡图标 */
.doc-icon {
  width: 7.8vw;
  height: 9.8vw;
  border: 0.32vw solid #6081f4;
  border-radius: 0.6vw;
  position: relative;
  z-index: 3;
  clip-path: polygon(
    0% 0%,
    calc(100% - 3.2vw) 0%,
    100% 3.2vw,
    100% 100%,
    0% 100%
  );
  background-color: #f2f4ff;
  background-image:
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 0.5vw,
      rgba(255,255,255,0.7) 0.5vw,
      rgba(255,255,255,0.7) 1vw
    );
  opacity: 0;
  transform: scale(0.85);
  animation: cardFadeIn 0.5s ease-out 1.8s forwards;
}

@keyframes cardFadeIn {
  to { opacity: 1; transform: scale(1); }
}

/* 切角处的边框线 */
.doc-icon::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 3.2vw;
  height: 3.2vw;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cline x1='0' y1='0' x2='12' y2='12' stroke='%236081f4' stroke-width='0.8' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  z-index: 4;
}

/* 三条黄色横线 */
.doc-icon .line {
  position: absolute;
  left: 20%;
  right: 20%;
  height: 0.28vw;
  background-color: #f2c968;
  border-radius: 0.12vw;
  z-index: 2;
}

.doc-icon .line:nth-child(1) { top: 30%; }
.doc-icon .line:nth-child(2) { top: 45%; }
.doc-icon .line:nth-child(3) { top: 60%; }

/* 登录认证中文本 */
.loading-text {
  font-size: 3.73vw;
  color: #4f7cd9;
  opacity: 0;
  animation: textFadeIn 0.5s ease-out 0.3s forwards;
}

@keyframes textFadeIn {
  to { opacity: 1; }
}

/* 底部服务信息 */
.loading-footer {
  position: absolute;
  bottom: 6vh;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 3.2vw;
  color: #999;
  line-height: 1.8;
  padding: 0 6vw;
  opacity: 0;
  animation: footerFadeIn 0.5s ease-out 2.2s forwards;
}

@keyframes footerFadeIn {
  to { opacity: 1; }
}

.loading-footer .hotline {
  color: #4f7cd9;
}

/* ============================================================
   Result1 页面 Toast 加载效果
   ============================================================ */

.result1-page {
  width: 100vw;
  height: 100vh;
  position: relative;
  background: #fff;
  overflow: hidden;
}

/* Toast 弹窗 - 正方形缩小尺寸 */
.result1-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 26vw;
  height: 26vw;
  padding: 3vw;
  background-color: #3a3a3c;
  border-radius: 2vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vw;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.result1-toast.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* 环形加载动画 - 缩小 */
.result1-toast .circle-loader {
  width: 6vw;
  height: 6vw;
  border: 0.5vw solid rgba(255,255,255,0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Toast 文字 - 缩小字号 */
.result1-toast .toast-text {
  color: #fff;
  font-size: 3.2vw;
  text-align: center;
  line-height: 1.4;
}

/* 结果图片 */
.result1-image {
  width: 100%;
  height: 100%;
  background-image: url('../images/screenshots/result1.png');
  background-repeat: no-repeat;
  background-position: center top;
  background-size: 100% auto;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.result1-image.fade-in {
  opacity: 1;
}
