/* ============================================================
   右侧悬浮插件样式（纯 CSS 交互，无第三方依赖）
   4 个入口：微信 / WhatsApp / 邮件 / 电话
   所有类名均以 rf- 前缀，避免污染宿主网站样式
   ============================================================ */

.rf-float {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.rf-float *,
.rf-float *::before,
.rf-float *::after {
  box-sizing: border-box;
}

/* 主悬浮条 */
.rf-float__bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-radius: 20px;
  background: linear-gradient(155deg, #263244 0%, #111827 72%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* 单个入口 */
.rf-item {
  position: relative;
}

.rf-item__btn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #d7dee9;
  cursor: pointer;
  outline: none;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rf-item__btn svg {
  width: 21px;
  height: 21px;
  display: block;
}

.rf-item:hover .rf-item__btn,
.rf-item:focus-within .rf-item__btn {
  background: rgba(255, 255, 255, 0.13);
  color: var(--rf-c, #ffffff);
  transform: translateX(-3px);
}

.rf-item__btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75);
}

/* 每个入口的品牌色 */
.rf-item--wechat   { --rf-c: #22c55e; }
.rf-item--whatsapp { --rf-c: #00b894; }
.rf-item--mail     { --rf-c: #fbbf24; }
.rf-item--phone    { --rf-c: #60a5fa; }

/* 展开面板 */
.rf-popover {
  position: absolute;
  right: calc(100% + 16px);
  top: 50%;
  width: 232px;
  padding: 18px;
  border-radius: 16px;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #edf1f6;
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.18);
  opacity: 0;
  transform: translate(12px, -50%);
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* 桥接鼠标移动间隙，避免面板闪退 */
.rf-popover::before {
  content: "";
  position: absolute;
  left: 100%;
  top: 0;
  width: 18px;
  height: 100%;
}

/* 指向悬浮条的小箭头 */
.rf-popover::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 11px;
  height: 11px;
  background: #ffffff;
  border-top: 1px solid #edf1f6;
  border-right: 1px solid #edf1f6;
  transform: translateY(-50%) rotate(45deg);
}

.rf-item:hover .rf-popover,
.rf-item:focus-within .rf-popover {
  opacity: 1;
  transform: translate(0, -50%);
  pointer-events: auto;
}

.rf-popover__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rf-popover__title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--rf-c, #0f172a);
}

.rf-popover__badge {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 99px;
}

/* 二维码 */
.rf-qr {
  width: 158px;
  height: 158px;
  margin: 14px auto 10px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid #e8edf4;
  border-radius: 12px;
}

.rf-qr img {
  display: block;
  width: 100%;
  height: 100%;
}

.rf-qr-tip {
  margin: 0;
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
}

/* 联系方式卡片 */
.rf-contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.rf-contact:hover {
  background: #f1f5f9;
  border-color: #dbe4ef;
}

.rf-contact__value {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.3px;
}

.rf-contact__hint {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
}

/* 复制按钮 */
.rf-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 34px;
  margin-top: 10px;
  border: 1px solid #e8edf4;
  border-radius: 10px;
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.rf-copy svg {
  width: 14px;
  height: 14px;
}

.rf-copy:hover {
  background: var(--rf-c, #f1f5f9);
  border-color: transparent;
  color: #ffffff;
}

/* 复制提示 */
.rf-toast {
  position: fixed;
  left: 50%;
  bottom: 38px;
  transform: translate(-50%, 12px);
  padding: 10px 18px;
  border-radius: 99px;
  background: #0f172a;
  color: #ffffff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 10000;
}

.rf-toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 小屏适配：横向排列在右下角，面板向上展开 */
@media (max-width: 640px) {
  .rf-float {
    right: 12px;
    top: auto;
    bottom: 14px;
    transform: none;
  }

  .rf-float__bar {
    flex-direction: row;
    padding: 6px;
    border-radius: 18px;
  }

  .rf-item__btn {
    width: 42px;
    height: 42px;
  }

  .rf-item:hover .rf-item__btn,
  .rf-item:focus-within .rf-item__btn {
    transform: translateY(-3px);
  }

  .rf-popover {
    right: auto;
    left: 50%;
    top: auto;
    bottom: calc(100% + 14px);
    width: 220px;
    transform: translate(-50%, 10px);
  }

  .rf-popover::before {
    left: 0;
    top: 100%;
    width: 100%;
    height: 16px;
  }

  .rf-popover::after {
    right: auto;
    left: 50%;
    bottom: -6px;
    top: auto;
    border: 0;
    border-bottom: 1px solid #edf1f6;
    border-left: 1px solid #edf1f6;
    transform: translateX(-50%) rotate(45deg);
  }

  .rf-item:hover .rf-popover,
  .rf-item:focus-within .rf-popover {
    transform: translate(-50%, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rf-float *,
  .rf-float *::before,
  .rf-float *::after {
    transition-duration: 0.01ms !important;
  }
}
