/* ==========================================================================
   侧边悬浮栏 — 样式
   6 个功能：返回顶部 / 电话 / 售前 / 售后 / 微信 / 收起
   电话、售前、售后、微信：悬停或点击左侧弹出内容
   ========================================================================== */

.floatbar {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 1px;
  background: #e5e5df;             /* 按钮间的 1px 细线 */
  border: 1px solid #e5e5df;
  font-family: "Inter", "Noto Sans SC", "PingFang SC", "HarmonyOS Sans SC",
    "Source Han Sans SC", "Microsoft YaHei", sans-serif;
}

.floatbar__item {
  position: relative;
  width: 46px;
  height: 46px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floatbar__btn {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  color: #161a17;
  cursor: pointer;
  transition: color 0.25s ease, background-color 0.25s ease;
}

.floatbar__btn svg {
  display: block;
  width: 38px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.floatbar__item:hover .floatbar__btn,
.floatbar__btn:focus-visible {
  color: #fff;
  background: #2e9c27;             /* 悬停：绿底 */
  outline: none;
}

/* 悬停：图标同步变白（覆盖 SVG 自带的深色 fill） */
.floatbar__item:hover .floatbar__btn svg path[fill],
.floatbar__btn:focus-visible svg path[fill] {
  fill: #fff;
}

/* --------------------------------------------------------------------------
   弹出内容：电话 / 售前 / 售后 / 微信
   -------------------------------------------------------------------------- */
.floatbar__tip {
  position: absolute;
  top: 50%;
  right: calc(100% + 14px);
  transform: translateY(-50%);
  min-width: 144px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e5e5df;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 10;
}

.floatbar__tip::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -6px;
  width: 10px;
  height: 10px;
  background: #fff;
  border-right: 1px solid #e5e5df;
  border-top: 1px solid #e5e5df;
  transform: translateY(-50%) rotate(45deg);
}

.floatbar__item:hover .floatbar__tip,
.floatbar__item.is-open .floatbar__tip {
  opacity: 1;
  visibility: visible;
}

.floatbar__tip-title {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #8b908b;
}

.floatbar__tip a {
  display: block;
  margin: 8px 0;
  font-size: 13px;
  color: #161a17;
  text-decoration: none;
  transition: color 0.25s ease;
}

.floatbar__tip a:hover {
  color: #2e9c27;
}

.floatbar__tip img {
  margin: 0 auto;
  display: block;
  width: 120px;
  height: 120px;
  padding: 4px;
  border: 1px solid #e5e5df;
  background: #fff;
}

/* --------------------------------------------------------------------------
   收起：只保留返回顶部；点击返回顶部按钮自动展开
   -------------------------------------------------------------------------- */
.floatbar.is-collapsed .floatbar__item:not(.floatbar__top) {
  display: none;
}

/* --------------------------------------------------------------------------
   移动端
   只保留返回顶部按钮：绿底白字、放大
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  .floatbar {
    right: 16px;
    left: auto;
    top: auto;
    bottom: 24px;
    transform: none;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: transparent;
    border: 0;
  }

  /* 移动端只保留返回顶部按钮 */
  .floatbar__item:not(.floatbar__top) {
    display: none;
  }

  .floatbar__item {
    width: 56px;
    height: 56px;
    background: #2e9c27;             /* 绿底 */
    box-shadow: 0 8px 24px rgba(46, 156, 39, 0.38);
  }

  /* 白字（白色图标） */
  .floatbar__btn {
    color: #fff;
  }

  .floatbar__btn svg {
    width: 28px;
    height: 28px;
  }

  .floatbar__item:hover .floatbar__btn,
  .floatbar__btn:hover,
  .floatbar__btn:focus-visible {
    background: #2e9c27;
    color: #fff;
  }
}
