/* ========================================
   微信悬浮二维码组件
   ======================================== */

/* 外层容器：固定在右侧垂直居中 */
.wx-float {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  /* 面板默认藏在屏幕右侧外 */
  flex-direction: row;
}

/* 触发标签条（始终可见的小条） */
.wx-tab {
  flex-shrink: 0;
  width: 44px;
  height: 180px;
  background: #07c160;
  color: #fff;
  cursor: pointer;
  border-radius: 8px 0 0 8px;
  box-shadow: -2px 2px 12px rgba(0, 0, 0, 0.15);
  transition: background 0.3s ease, border-radius 0.3s ease;
  user-select: none;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.wx-tab:hover {
  background: #06ad56;
}

.wx-tab .wx-tab-icon {
  font-size: 22px;
  line-height: 1;
}

.wx-tab .wx-tab-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 14px;
  letter-spacing: 4px;
  font-weight: 600;
}

/* 二维码面板 */
.wx-panel {
  flex-shrink: 0;
  width: 0;
  overflow: hidden;
  background: #fff;
  border-radius: 12px 0 0 12px;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  opacity: 0;
}

/* ---- PC端：hover 展开 ---- */
@media (hover: hover) and (pointer: fine) {
  .wx-float:hover .wx-panel {
    width: 240px;
    padding: 24px 20px;
    opacity: 1;
  }

  .wx-float:hover .wx-tab {
    border-radius: 0 0 0 0;
  }
}

/* ---- 触屏端：点击展开（JS 控制 .active 类） ---- */
@media (hover: none), (pointer: coarse) {
  .wx-float.active .wx-panel {
    width: 240px;
    padding: 24px 20px;
    opacity: 1;
  }
}

/* 面板内部内容 */
.wx-panel-inner {
  width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wx-panel-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.wx-panel-subtitle {
  font-size: 12px;
  color: #999;
  margin-bottom: 16px;
}

.wx-qr-wrap {
  width: 180px;
  height: 180px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}

.wx-qr-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wx-scan-tip {
  margin-top: 14px;
  font-size: 12px;
  color: #07c160;
  display: flex;
  align-items: center;
  gap: 4px;
}

.wx-scan-tip::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #07c160;
  animation: wx-blink 1.5s infinite;
}

@keyframes wx-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.wx-wechat-id {
  margin-top: 10px;
  font-size: 13px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 4px;
}
.wx-wechat-id .wx-id-value {
  color: #07c160;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 8px;
  border: 1px dashed #ccc;
  border-radius: 4px;
  transition: background 0.2s, border-color 0.2s;
  position: relative;
}
.wx-wechat-id .wx-id-value:hover {
  background: #e8f5e9;
  border-color: #07c160;
}
.wx-wechat-id .wx-copy-icon {
  font-size: 12px;
  opacity: 0.5;
  flex-shrink: 0;
}
/* 复制成功提示 toast */
.wx-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 12px 28px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
}
.wx-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ====== 平板 & 手机端微调 ====== */
@media (max-width: 768px) {
  .wx-tab {
    width: 38px;
    height: 150px;
  }
  .wx-tab .wx-tab-icon {
    font-size: 18px;
  }
  .wx-tab .wx-tab-text {
    font-size: 13px;
    letter-spacing: 3px;
  }
  .wx-float.active .wx-panel {
    width: 220px;
    padding: 20px 16px;
  }
  .wx-panel-inner {
    width: 180px;
  }
  .wx-qr-wrap {
    width: 160px;
    height: 160px;
  }
}

@media (max-width: 380px) {
  .wx-float.active .wx-panel {
    width: 200px;
    padding: 16px 12px;
  }
  .wx-panel-inner {
    width: 168px;
  }
  .wx-qr-wrap {
    width: 148px;
    height: 148px;
  }
}