/* ==========================================================================
   ai-page.css —— H5 端 AI 匹配 / 智能客服 两个页面的样式
   与小程序 pages/ai-match、pages/service 视觉保持一致（紫蓝渐变 + 圆角卡片）
   ========================================================================== */

/* ---------------- AI 智能匹配 ---------------- */
.am-hero {
  background: var(--primary-gradient);
  padding: 26px 20px 46px;
  color: #fff;
  border-radius: 0 0 24px 24px;
}
.am-hero-title { font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.am-hero-sub { margin-top: 8px; font-size: 13px; line-height: 1.6; opacity: 0.9; }

.am-stack {
  position: relative;
  z-index: 2;
  margin: -30px 14px 0;
}

/* 报名人切换 */
.am-person { background: #fff; border-radius: 18px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(91, 110, 245, 0.1); margin-bottom: 10px; }
.am-person:empty { display: none; }
.ap-head { display: flex; align-items: baseline; gap: 8px; }
.ap-label { font-size: 14px; font-weight: 700; color: #1a1d29; }
.ap-hint { font-size: 11px; color: #9aa0b4; }
.ap-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ap-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 14px; border-radius: 999px;
  background: #f5f6fa; color: #6b7280; font-size: 13px;
  border: 1px solid transparent; cursor: pointer;
}
.ap-chip.on { background: rgba(91, 110, 245, 0.1); color: #5b6ef5; border-color: rgba(91, 110, 245, 0.35); font-weight: 600; }
.ap-chip i { font-style: normal; font-size: 11px; opacity: 0.75; }
.ap-chip b { font-weight: 600; font-size: 10px; background: #5b6ef5; color: #fff; border-radius: 4px; padding: 1px 4px; }
.ap-chip.manual { color: #5b6ef5; }

.am-form {
  margin: 0;
  background: #fff;
  border-radius: 18px;
  padding: 6px 14px 16px;
  box-shadow: 0 8px 24px rgba(91, 110, 245, 0.1);
}
.am-row {
  display: flex;
  align-items: center;
  min-height: 52px;
  border-bottom: 1px solid #f2f3f7;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 0;
}
.am-row:last-of-type { border-bottom: none; }
.am-label { width: 84px; flex: none; font-size: 14px; color: #303133; }
.am-unit { font-size: 12px; color: #9aa0b4; }
.am-input {
  flex: 1;
  min-width: 80px;
  border: none;
  outline: none;
  font-size: 15px;
  color: #303133;
  background: transparent;
}
.am-input-sm { flex: 0 0 74px; min-width: 74px; }
.am-select {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  color: #303133;
  background: transparent;
  appearance: none;
}
.am-seg, .am-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.am-seg-item {
  padding: 7px 20px;
  border-radius: 999px;
  background: #f4f5fa;
  color: #606266;
  font-size: 14px;
  cursor: pointer;
}
.am-seg-item.on { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.am-chip {
  padding: 6px 14px;
  border-radius: 999px;
  background: #f4f5fa;
  color: #606266;
  font-size: 13px;
  cursor: pointer;
}
.am-chip.on { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.am-bmi { font-size: 12px; color: #9aa0b4; padding: 0 0 8px 84px; }
.am-bmi b { color: var(--primary); }

.am-submit {
  width: 100%;
  margin-top: 14px;
  height: 48px;
  border: none;
  border-radius: 14px;
  background: var(--primary-gradient);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(91, 110, 245, 0.28);
}
.am-submit:disabled { opacity: 0.7; }
.am-note { margin-top: 10px; font-size: 11px; line-height: 1.6; color: #a8adbd; }

.am-result { padding: 16px 14px 8px; }
.am-empty {
  text-align: center;
  color: #a8adbd;
  font-size: 13px;
  padding: 40px 24px;
  line-height: 1.7;
}
.am-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: #303133;
  margin-bottom: 6px;
}
.am-result-head b { color: var(--primary); font-size: 17px; }
.am-engine { font-size: 11px; color: #9aa0b4; }
.am-stat { font-size: 11px; color: #9aa0b4; margin-bottom: 10px; }
.am-sort-tip { color: #5b6ef5; }

.am-card {
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(17, 24, 39, 0.05);
}
.am-card-top { display: flex; gap: 12px; }
.am-score {
  flex: none;
  width: 54px;
  text-align: center;
  background: var(--primary-bg);
  border-radius: 12px;
  padding: 8px 0;
  height: fit-content;
}
.am-score b { display: block; font-size: 20px; color: var(--primary); line-height: 1.1; }
.am-score span { font-size: 10px; color: #8a90a6; }
.am-card-main { flex: 1; min-width: 0; }
/* 运营「推荐」角标：颜色跟后台属性管理一致，随项目下发 */
.am-rec {
  display: inline-block;
  vertical-align: 1px;
  margin-right: 6px;
  padding: 0 5px;
  height: 16px;
  line-height: 16px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
}
.am-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #1f2430;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.am-card-meta { font-size: 12px; color: #8a90a6; margin-top: 4px; }
.am-card-money { font-size: 12px; color: #606266; margin-top: 6px; }
.am-card-money b { color: #ff5a3c; font-size: 15px; }
.am-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.am-tag {
  font-size: 11px;
  color: #00a870;
  background: #e8f8f1;
  border-radius: 6px;
  padding: 3px 8px;
}
.am-reason {
  margin-top: 10px;
  font-size: 12.5px;
  color: #4b5163;
  line-height: 1.7;
  background: #f7f8fd;
  border-radius: 10px;
  padding: 9px 11px;
}
.am-caution { margin-top: 8px; font-size: 12px; color: #d97706; line-height: 1.6; }
.am-card-actions { display: flex; gap: 10px; margin-top: 12px; }
.am-btn {
  flex: 1;
  height: 38px;
  border-radius: 11px;
  font-size: 14px;
  border: none;
  cursor: pointer;
}
.am-btn.ghost { background: #f4f5fa; color: #606266; }
.am-btn.primary { background: var(--primary-bg); color: var(--primary); font-weight: 600; }

/* ---------------- 智能客服 ---------------- */
#page-service {
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-sizing: border-box;
  /* 底部让出 tabbar 的高度，输入栏才不会被导航盖住 */
  padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom, 0px)) !important;
  background: #f6f7fb;
}
#page-service.active { display: flex; }

.sv-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.04);
}
.sv-head-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--primary-gradient);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sv-head-text { flex: 1; min-width: 0; }
.sv-head-title { font-size: 15px; font-weight: 600; color: #1f2430; }
.sv-head-sub {
  font-size: 11px;
  color: #8a90a6;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sv-handoff {
  flex: none;
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-bg);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
}
.sv-handoff.on { color: #ff7a45; background: rgba(255, 122, 69, 0.12); }

.sv-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 8px;
  -webkit-overflow-scrolling: touch;
}
.sv-tip {
  font-size: 11px;
  color: #a8adbd;
  text-align: center;
  line-height: 1.6;
  padding: 0 20px 12px;
}
.sv-msg { margin-bottom: 14px; display: flex; flex-direction: column; align-items: flex-start; }
.sv-msg.user { align-items: flex-end; }
.sv-msg-head { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.sv-avatar {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sv-msg.admin .sv-avatar { background: rgba(255, 122, 69, 0.14); color: #ff7a45; }
.sv-role { font-size: 11px; color: #9aa0b4; }
.sv-bubble {
  max-width: 82%;
  background: #fff;
  border-radius: 14px;
  padding: 11px 13px;
  font-size: 14px;
  line-height: 1.7;
  color: #2b2f3a;
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.04);
}
.sv-msg.user .sv-bubble { background: var(--primary-gradient); color: #fff; }
.sv-msg.admin .sv-bubble { background: #fff8f3; border: 1px solid #ffe6d8; }
.sv-bubble.typing { display: flex; gap: 5px; padding: 14px 16px; }
.sv-bubble.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c7cbd8;
  animation: sv-blink 1.2s infinite;
}
.sv-bubble.typing i:nth-child(2) { animation-delay: 0.2s; }
.sv-bubble.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes sv-blink { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }

.sv-refs { margin-top: 9px; display: flex; flex-direction: column; gap: 8px; }
.sv-ref {
  position: relative;
  background: #f7f8fd;
  border-radius: 10px;
  padding: 9px 56px 9px 11px;
  cursor: pointer;
}
.sv-ref-title { font-size: 13px; color: #1f2430; line-height: 1.45; }
.sv-ref-meta { font-size: 11px; color: #8a90a6; margin-top: 4px; }
.sv-ref-go {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--primary);
}

.sv-quick { flex: none; padding: 0 14px 8px; }
.sv-quick-title { font-size: 11px; color: #9aa0b4; margin-bottom: 8px; }
.sv-quick-item {
  background: #fff;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 13px;
  color: #4b5163;
  margin-bottom: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.04);
}

.sv-inputbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px calc(10px + var(--safe-bottom, 0px));
  background: #fff;
  border-top: 1px solid #f0f1f6;
}
.sv-input {
  flex: 1;
  height: 40px;
  border-radius: 999px;
  border: none;
  outline: none;
  background: #f4f5fa;
  padding: 0 16px;
  font-size: 14px;
  color: #303133;
}
.sv-send {
  flex: none;
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 999px;
  background: var(--primary-gradient);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* 转人工弹层 */
.sv-sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  z-index: 900;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sv-sheet {
  width: 100%;
  max-width: 430px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(20px + var(--safe-bottom, 0px));
  text-align: center;
  /* 内容随通道配置增减，小屏不设上限会把底部按钮顶出视口 */
  max-height: 86vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sv-sheet-title { font-size: 17px; font-weight: 600; color: #1f2430; }
.sv-sheet-tip { font-size: 12px; color: #8a90a6; margin-top: 8px; line-height: 1.6; }
.sv-sheet-qr {
  width: 160px;
  height: 160px;
  object-fit: contain;
  margin: 14px auto 6px;
  display: block;
  border-radius: 12px;
}
.sv-sheet-wx {
  margin-top: 10px;
  font-size: 13px;
  color: #4b5163;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.sv-copy {
  font-size: 12px;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 999px;
  padding: 2px 10px;
  cursor: pointer;
}
.sv-sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sv-sheet-btn {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  cursor: pointer;
}
.sv-sheet-btn.ghost { background: #f4f5fa; color: #606266; }
.sv-sheet-btn.primary { background: var(--primary-gradient); color: #fff; font-weight: 600; }
.sv-sheet-btn.block { display: block; width: 100%; margin-top: 12px; }

/* 主路径：留在本页等人工（唯一能与本页对话互通的通道） */
.sv-main-way {
  margin-top: 16px;
  padding: 14px 14px 16px;
  background: #f3f4ff;
  border-radius: 14px;
  text-align: left;
}
.sv-main-way-title { font-size: 14px; font-weight: 600; color: #1f2430; }
.sv-main-way-tip { margin-top: 4px; font-size: 12px; line-height: 1.6; color: #6b7280; }

/* 其他通道：另开一条对话，与本页不互通 */
.sv-alt-way { margin-top: 18px; text-align: left; }
.sv-alt-way-title { font-size: 11px; color: #9aa0b4; margin-bottom: 2px; }

/* 微信客服直达（企业微信客服链接） */
.sv-contact-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  margin-top: 12px;
  border-radius: 12px;
  background: var(--primary-gradient);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
/* 次要通道：白底描边，不与「留在本页」抢主视觉 */
.sv-contact-btn.ghost {
  background: #fff;
  color: var(--primary);
  border: 1px solid #dde0f5;
  font-size: 14px;
  font-weight: 500;
}

/* ---------------- 首页筛选吸顶：收起订阅省份行 ---------------- */
.filter-section.is-stuck .city-tags-row {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  overflow: hidden;
  transition: max-height 0.22s ease, opacity 0.18s ease, padding 0.22s ease;
}
.filter-section .city-tags-row {
  max-height: 80px;
  opacity: 1;
  transition: max-height 0.22s ease, opacity 0.18s ease, padding 0.22s ease;
}
/* 吸顶后的迷你省份入口 */
.am-city-pill {
  display: none;
  position: absolute;
  right: 10px;
  top: -34px;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.12);
  font-size: 12px;
  color: #4456d9;
  cursor: pointer;
  z-index: 61;
}
.filter-section.is-stuck .am-city-pill { display: flex; }
.am-city-pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}
.am-city-sheet { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 0 10px; }
.am-city-opt {
  padding: 9px 18px;
  border-radius: 999px;
  background: #f4f5fa;
  font-size: 13px;
  color: #4b5163;
  cursor: pointer;
}
.am-city-opt.on { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.am-city-empty { font-size: 12px; color: #9aa0b4; padding: 8px 0; }
