/* ============================================================================
 * ONE HOME BUILD — WhatsApp 客服悬浮窗样式（2026-10-20）
 * ----------------------------------------------------------------------------
 * 视觉语言全部取自站点已有变量（--color-paper / --color-brass / --font-display…），
 * 不引入新配色，保证和主站是同一套审美。
 *
 * 定位：右下角，位于原有 WhatsApp 绿钮与国旗钮的【上方】，
 * 避免和它们抢位置（原两个钮 bottom 26px、50px 见方）。
 * ==========================================================================*/

#ohb-wa {
  position: fixed;
  right: 26px;
  /* 下方两个圆钮：bottom 26px + 直径 50px = 顶边距底 76px，再留 14px 缝 → 90px。
     原来写 96px 看似够，但面板自身有 1px 边框和阴影扩散，
     实测面板底边落在圆钮顶边下方 26px（视觉模型也确认"压住圆钮上半段"）。
     按 96 + 26 = 122 修正，保证任何视口下面板都完整悬在圆钮上方。 */
  bottom: 122px;
  z-index: 45;                  /* 高于浮窗组(40)，低于导航(50) */
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
  font-family: -apple-system, 'PingFang SC', system-ui, sans-serif;
}

#ohb-wa .ohb-wa-scrim {
  display: none;
}

#ohb-wa .ohb-wa-panel {
  pointer-events: auto;
  width: 344px;
  max-width: calc(100vw - 40px);
  /* 高度上限算清账，别让面板压住下面两个圆钮：
       底部留白 96px（圆钮 bottom 26 + 直径 50 + 缝隙 20）
       + 顶部安全边 16px = 112px 必须扣掉。
     原写 190px 在 900px 高的窗口里算出 710px，实际渲染 522px 面板
     底部仍会盖住圆钮（视觉模型实测确认）。改成 112px 后
     面板底边恒在圆钮上方，任何视口都不会压。 */
  max-height: min(560px, calc(100svh - 112px));
  display: flex;
  flex-direction: column;
  background: #faf8f5;
  border: 1px solid rgba(134,103,60,0.38);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(23, 19, 15, 0.18), 0 2px 8px rgba(23, 19, 15, 0.08);
  overflow: hidden;

  /* 关闭态：只靠 visibility + pointer-events 控制，不碰 opacity。
     理由：opacity 过渡/动画一旦在某些 WebView、后台标签、无头环境里
     不推进时间轴，面板会永远停在 opacity:0 —— 内容全在、用户却看不见。
     这个坑已在真实环境实测到（类名、规则、动画名全部正确，计算值仍是 0）。
     失败方向必须是安全的：宁可少一个淡入动画，也不能看不见内容。 */
  transform-origin: bottom right;
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  visibility: hidden;
  pointer-events: none;
}

#ohb-wa.is-open .ohb-wa-panel {
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

/* 入场动效只做位移，不做透明度：位移即使被冻结，元素仍在原位可读。 */
#ohb-wa.is-open .ohb-wa-panel {
  animation: ohbWaIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ohbWaIn {
  from { transform: translateY(10px) scale(0.985); }
  to   { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  #ohb-wa .ohb-wa-panel,
  #ohb-wa.is-open .ohb-wa-panel { animation: none; transition: none; }
}

#ohb-wa .ohb-wa-panel[dir='rtl'] {
  transform-origin: bottom left;
}

/* --------------------------------------------------------------- 头部 */
#ohb-wa .ohb-wa-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 14px 13px;
  background: #14110e;
  color: #faf8f5;
  flex: 0 0 auto;
}

#ohb-wa .ohb-wa-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  background: #1f9d55;
  color: #fff;
}

#ohb-wa .ohb-wa-avatar svg {
  width: 19px;
  height: 19px;
}

#ohb-wa .ohb-wa-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.3;
}

#ohb-wa .ohb-wa-id strong {
  font-family: Georgia, 'Songti SC', serif;
  font-size: 15.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ohb-wa .ohb-wa-id span {
  font-size: 11px;
  opacity: 0.62;
  margin-top: 1px;
}

#ohb-wa .ohb-wa-x {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.2s, background-color 0.2s;
}

#ohb-wa .ohb-wa-x:hover {
  opacity: 1;
  background: rgba(247, 240, 231, 0.12);
}

#ohb-wa .ohb-wa-x svg {
  width: 15px;
  height: 15px;
}

/* --------------------------------------------------------------- 主体 */
#ohb-wa .ohb-wa-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 14px 6px;
  background: #f1e9de;
}

#ohb-wa .ohb-wa-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 11px;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: #6f6558;
}

#ohb-wa .ohb-wa-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1f9d55;
  box-shadow: 0 0 0 3px rgba(31, 157, 85, 0.16);
  flex: 0 0 6px;
}

#ohb-wa .ohb-wa-bubble {
  background: #faf8f5;
  border: 1px solid #e4dbcc;
  border-radius: 3px 12px 12px 12px;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.6;
  color: #232323;
  box-shadow: 0 1px 2px rgba(23, 19, 15, 0.04);
}

#ohb-wa .ohb-wa-panel[dir='rtl'] .ohb-wa-bubble {
  border-radius: 12px 3px 12px 12px;
}

#ohb-wa .ohb-wa-pick {
  margin: 15px 0 8px;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #6f6558;
}

#ohb-wa .ohb-wa-qs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 8px;
}

#ohb-wa .ohb-wa-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #e2ddd6;
  border-radius: 8px;
  background: #faf8f5;
  color: #232323;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.45;
  text-align: start;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

#ohb-wa .ohb-wa-q:hover {
  border-color: #8a6a3b;
  background: #e8dfd2;
}

#ohb-wa .ohb-wa-q.is-picked {
  border-color: #1f9d55;
  background: #eef7f1;
  color: #14683a;
  font-weight: 500;
}

#ohb-wa .ohb-wa-chev {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  opacity: 0.4;
}

#ohb-wa .ohb-wa-panel[dir='rtl'] .ohb-wa-chev {
  transform: scaleX(-1);
}

/* --------------------------------------------------------------- 底部 CTA */
#ohb-wa .ohb-wa-foot {
  flex: 0 0 auto;
  padding: 11px 14px 13px;
  background: #faf8f5;
  border-top: 1px solid #e4dbcc;
}

#ohb-wa .ohb-wa-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: #1f9d55;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background-color 0.2s, transform 0.2s;
}

#ohb-wa .ohb-wa-cta:hover {
  background: #178a49;
  transform: translateY(-1px);
}

#ohb-wa .ohb-wa-cta svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

#ohb-wa .ohb-wa-note {
  margin: 7px 0 0;
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
  color: #6f6558;
  opacity: 0.85;
}

/* --------------------------------------------------------------- 手机 */
@media (max-width: 767px) {
  #ohb-wa {
    right: 14px;
    left: 14px;
    /* 与桌面同源：122px（= 圆钮 26+50 + 缝 + 边框/阴影余量）。
       原来 88px 在 390x844 实测压住圆钮 30px。 */
    bottom: 122px;
    justify-content: stretch;
  }

  #ohb-wa .ohb-wa-panel {
    width: 100%;
    max-width: none;
    max-height: min(70svh, calc(100svh - 112px));
    border-radius: 16px;
  }
}

/* --------------------------------------------------------------- 无障碍 */
@media (prefers-reduced-motion: reduce) {
  #ohb-wa .ohb-wa-cta { transition: none; }
}


/* ============================================================================
 * REBUILD 适配（2026-10-26 移植追加）
 * ----------------------------------------------------------------------------
 * 本站右下角已有一个询盘浮标组（.float，含 .float-pill 与 .float-btn，
 * 位置 bottom:26px right:26px）。为避免叠压，WhatsApp 绿钮放在它【左侧】，
 * 面板整体上移，与浮标组垂直错开。
 * ==========================================================================*/

.ohb-wa-trigger {
  position: fixed;
  right: 92px;              /* 让开右侧 50px 询盘钮 + 缝隙 */
  bottom: 26px;
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 41;
  box-shadow: 0 6px 18px rgba(37, 211, 102, .34), 0 2px 6px rgba(23, 19, 15, .12);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.ohb-wa-trigger:hover {
  background: #1fbe5b;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(37, 211, 102, .42), 0 3px 8px rgba(23, 19, 15, .16);
}
.ohb-wa-trigger:active { transform: translateY(0); }
.ohb-wa-trigger svg { width: 26px; height: 26px; }

/* 打开时按钮轻微内收，避免与面板边缘视觉粘连 */
#ohb-wa.is-open ~ .ohb-wa-trigger,
.ohb-wa-open .ohb-wa-trigger { transform: scale(.92); }

.ohb-wa-mkt { font-weight: 600; }

/* 面板右侧与绿钮对齐 */
#ohb-wa { right: 26px; }

@media (max-width: 767px) {
  .ohb-wa-trigger {
    right: 84px;
    bottom: 20px;
    width: 46px;
    height: 46px;
  }
  .ohb-wa-trigger svg { width: 23px; height: 23px; }
  #ohb-wa {
    right: 16px;
    bottom: 86px;
  }
  #ohb-wa .ohb-wa-panel {
    max-height: min(520px, calc(100svh - 150px));
  }
}
