/* ============================================================
   悬浮客服 · 名片弹层 · 咨询弹窗 样式（v2）
   ============================================================ */

/* ---------- 悬浮客服（右侧固定） ---------- */
.float-service {
  position: fixed;
  right: 18px;
  bottom: 50%;
  transform: translateY(50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fs-item { position: relative; }

.fs-btn {
  width: 50px;
  height: 48px;
  border: 1px solid rgba(15, 23, 42, .07);
  border-radius: 13px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #475569;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  box-shadow: 0 4px 14px -4px rgba(15, 23, 42, .16), 0 1px 2px rgba(15, 23, 42, .04);
  transition: transform .22s cubic-bezier(.4, 0, .2, 1), box-shadow .22s, background .22s, color .22s, border-color .22s;
  padding: 0;
  line-height: 1;
  text-decoration: none;
  font-family: inherit;
}
.fs-btn .icon { width: 17px; height: 17px; }
.fs-btn span { font-size: 9.5px; letter-spacing: .2px; margin-top: 2px; font-weight: 500; }
.fs-btn:hover,
.fs-btn.active {
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  border-color: transparent;
  color: #fff;
  transform: translateX(-4px) scale(1.04);
  box-shadow: 0 10px 24px -8px rgba(37, 99, 235, .7);
}
.fs-btn.fs-primary {
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(37, 99, 235, .75);
}
.fs-btn.fs-primary:hover { transform: translateX(-4px) scale(1.05); }

/* ---------- 名片弹层（悬停左侧滑出） ---------- */
.fs-card {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translate(8px, -50%) scale(.97);
  transform-origin: right center;
  width: 232px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, .06);
  border-radius: 16px;
  box-shadow: 0 20px 50px -18px rgba(15, 23, 42, .32), 0 2px 8px rgba(15, 23, 42, .05);
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .22s, transform .24s cubic-bezier(.2, .8, .2, 1), visibility .24s;
  text-align: center;
  box-sizing: border-box;
}
.fs-item:hover .fs-card,
.fs-card.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(0, -50%) scale(1);
}
.fs-card::after {
  content: "";
  position: absolute;
  right: -5.5px;
  top: 50%;
  width: 11px;
  height: 11px;
  background: #fff;
  border-right: 1px solid rgba(15, 23, 42, .07);
  border-bottom: 1px solid rgba(15, 23, 42, .07);
  transform: translateY(-50%) rotate(-45deg);
}
.fs-card-head {
  display: flex; align-items: center; gap: 9px;
  padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 1px solid #f1f5f9; text-align: left;
}
.fs-card-head .fs-card-ic {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(37, 99, 235, .1), rgba(6, 182, 212, .12));
  color: #2563eb;
}
.fs-card-tt { display: flex; flex-direction: column; min-width: 0; }
.fs-card-tt b { font-size: 13px; font-weight: 700; color: #0f172a; line-height: 1.3; }
.fs-card-tt small { font-size: 10.5px; color: #94a3b8; margin-top: 1px; }

.fs-qr-wrap {
  position: relative; width: 148px; height: 148px; margin: 0 auto 10px;
  padding: 6px; border-radius: 12px;
  background: #fff; border: 1px solid #eef2f8;
  box-shadow: 0 4px 14px -6px rgba(15, 23, 42, .14);
}
.fs-card .fs-qr {
  width: 100%; height: 100%;
  border-radius: 8px;
  object-fit: contain;
  display: block;
  background: #fff;
}
.fs-card .fs-qr-empty {
  width: 148px; height: 148px;
  border-radius: 12px;
  margin: 0 auto 10px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 11px;
  flex-direction: column;
  gap: 6px;
}
.fs-card .fs-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 4px;
  word-break: break-all;
}
.fs-card .fs-phone {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #2563eb;
  margin: 2px 0 4px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.fs-card .fs-tip {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 8px;
  padding-top: 9px;
  border-top: 1px dashed #eef2f8;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.fs-card .fs-actions { display: flex; gap: 8px; margin-top: 10px; }
.fs-card .fs-card-btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  color: #fff; font-size: 12.5px; font-weight: 600;
  box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .8);
  transition: transform .2s, box-shadow .2s;
  white-space: nowrap;
}
.fs-card .fs-card-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgba(37, 99, 235, .9); }

/* ---------- 回到顶部 ---------- */
.back-top {
  position: fixed;
  right: 18px;
  bottom: 26px;
  z-index: 890;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, .07);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px -4px rgba(15, 23, 42, .16);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: all .25s;
}
.back-top.show { opacity: 1; transform: none; pointer-events: auto; }
.back-top:hover { background: linear-gradient(135deg, #2563eb, #06b6d4); color: #fff; border-color: transparent; }

/* 折叠按钮（仅移动端显示） */
.float-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 50px; height: 48px; border-radius: 13px; border: none; cursor: pointer;
  background: linear-gradient(135deg, #2563eb, #06b6d4); color: #fff;
  box-shadow: 0 6px 18px -8px rgba(37, 99, 235, .8);
  transition: all .2s;
}

/* ============================================================
   咨询弹窗（居中）
   ============================================================ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}
.modal-mask.open { display: flex; }
.modal-box {
  width: 100%;
  max-width: 620px;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .28);
  position: relative;
  animation: modalIn .3s cubic-bezier(.34, 1.4, .64, 1) both;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(24px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
.modal-head {
  padding: 26px 30px 18px;
  border-bottom: 1px solid #f1f5f9;
  position: relative;
  flex-shrink: 0;
}
.modal-head h3 { font-size: 20px; font-weight: 700; color: #0f172a; margin-bottom: 6px; padding-right: 40px; }
.modal-head p { font-size: 13.5px; color: #94a3b8; line-height: 1.6; }
.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  padding: 0;
}
.modal-close:hover { background: #e2e8f0; color: #0f172a; transform: rotate(90deg); }
.modal-body {
  padding: 22px 30px 26px;
  overflow-y: auto;
  flex: 1;
}
.modal-loading {
  padding: 46px 0;
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
}

/* 弹窗内表单 */
.modal-body .form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
}
.modal-body .form-group { margin: 0; }
.modal-body .form-group.full { grid-column: 1 / -1; }
.modal-body .form-group label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 7px;
}
.modal-body .form-group label .req { color: #ef4444; margin-left: 2px; }
.modal-body .form-group input,
.modal-body .form-group textarea,
.modal-body .form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14.5px;
  font-family: inherit;
  color: #0f172a;
  background: #f8fafc;
  transition: all .2s;
  box-sizing: border-box;
}
.modal-body .form-group input:focus,
.modal-body .form-group textarea:focus,
.modal-body .form-group select:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .1);
}
.modal-body .form-group textarea { min-height: 96px; resize: vertical; line-height: 1.65; }
.modal-foot { margin-top: 20px; }
.modal-foot .btn-submit {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  color: #fff;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(37, 99, 235, .3);
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.modal-foot .btn-submit:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(37, 99, 235, .4); }
.modal-foot .btn-submit:disabled { opacity: .65; cursor: not-allowed; transform: none; }
.modal-msg {
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 14px;
  display: none;
}
.modal-msg.ok { background: #dcfce7; color: #15803d; display: block; }
.modal-msg.err { background: #fee2e2; color: #b91c1c; display: block; }
.modal-success {
  text-align: center;
  padding: 30px 10px 20px;
}
.modal-success .ok-icon {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}
.modal-success h4 { font-size: 18px; margin-bottom: 8px; }
.modal-success p { color: #94a3b8; font-size: 14px; }

/* ============================================================
   移动端适配（统一）
   ============================================================ */
@media (max-width: 860px) {
  /* 悬浮客服：右侧贴边、竖向居中偏下，可折叠 */
  .float-service {
    right: 8px;
    left: auto;
    bottom: 110px;
    top: auto;
    transform: none;
    gap: 6px;
    transition: opacity .3s;
  }
  .fs-btn { width: 42px; height: 42px; border-radius: 12px; }
  .fs-btn .icon { width: 16px; height: 16px; }
  .fs-btn span { font-size: 9px; line-height: 1.1; margin-top: 1px; }
  .fs-btn:hover, .fs-btn.active { transform: none; }

  .float-toggle {
    display: flex;
    width: 42px; height: 42px; border-radius: 12px;
  }
  .float-service.is-collapsed .fs-item:not(.fs-item-collapse) { display: none; }
  .float-service.is-collapsed { opacity: .4; }
  .float-service:not(.is-collapsed) .float-toggle {
    background: rgba(255,255,255,.96); color: #64748b;
    border: 1px solid rgba(15,23,42,.07);
    box-shadow: 0 4px 14px -4px rgba(15,23,42,.16);
  }

  /* 名片改为覆盖式（避免超出屏幕左边界） */
  .fs-card {
    right: calc(100% + 10px);
    left: auto;
    top: 50%;
    width: 214px;
    padding: 14px;
    transform: translate(6px, -50%) scale(.97);
  }
  .fs-item:hover .fs-card, .fs-card.open { transform: translate(0, -50%) scale(1); }
  .fs-card::after {
    right: -5px; left: auto;
    border-right: 1px solid rgba(15,23,42,.07);
    border-bottom: 1px solid rgba(15,23,42,.07);
    border-left: none;
    transform: translateY(-50%) rotate(-45deg);
  }
  .fs-card .fs-qr, .fs-card .fs-qr-empty, .fs-qr-wrap { width: 132px; height: 132px; }
  .fs-card .fs-phone { font-size: 17px; }
  .fs-card .fs-tip { font-size: 10.5px; }

  .back-top { right: 8px; bottom: 22px; width: 38px; height: 38px; }

  /* 弹窗 */
  .modal-box { max-width: 100%; border-radius: 18px; }
  .modal-head { padding: 22px 20px 16px; }
  .modal-head h3 { font-size: 18px; }
  .modal-body { padding: 18px 20px 22px; }
  .modal-body .form-grid-2 { grid-template-columns: 1fr; gap: 14px; }

  /* 旧版首页 hero 兼容 */
  .hero-content { padding: 0 18px; }
  .hero-actions { gap: 10px; }
  .hero-actions .btn { flex: 1 1 42%; max-width: 47%; padding: 12px 8px; font-size: 14px; }
}

@media (min-width: 861px) {
  .float-toggle { display: none; }
}
