/* ========== 侧边悬浮快捷栏 ========== */
.nh-floatbar {
  position: fixed;
  right: 16px;
  bottom: 24px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  width: 73px;
  background: #fff;
  border: 1px solid var(--gray-200, #edf0f5);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
  overflow: hidden;
}

.nh-floatbar__list {
  display: flex;
  flex-direction: column;
}

.nh-floatbar__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 81px;
  padding: 10px 5px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--gray-200, #edf0f5);
  color: var(--gray-600, #6b7280);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition-fast, 0.2s ease), color var(--transition-fast, 0.2s ease);
}

.nh-floatbar__item:last-of-type {
  border-bottom: 0;
}

.nh-floatbar__item:hover,
.nh-floatbar__item:focus-visible {
  background: var(--gray-100, #f7f8fa);
  color: var(--blue-500, #2b6cb0);
}

.nh-floatbar__item svg {
  width: 29px;
  height: 29px;
  flex: none;
}

.nh-floatbar__item > span {
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

/* 购物车数量角标 */
.nh-floatbar__badge {
  position: absolute;
  top: 7px;
  right: 5px;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border-radius: 11px;
  background: #e53e3e;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 21px;
  text-align: center;
  display: none;
}

.nh-floatbar__badge[data-nh-cart-count]:not([data-nh-cart-count="0"]) {
  display: block;
}

/* 收起/展开开关 */
.nh-floatbar__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 47px;
  border: 0;
  border-top: 1px solid var(--gray-200, #edf0f5);
  background: var(--gray-50, #f9fafb);
  color: var(--gray-500, #6b7280);
  cursor: pointer;
  font-family: inherit;
  transition: color var(--transition-fast, 0.2s ease), background var(--transition-fast, 0.2s ease);
}

.nh-floatbar__toggle:hover,
.nh-floatbar__toggle:focus-visible {
  color: var(--blue-500, #2b6cb0);
  background: var(--gray-100, #f7f8fa);
}

.nh-floatbar__toggle svg {
  width: 21px;
  height: 21px;
  transition: transform var(--transition-fast, 0.2s ease);
}

/* 已收起：只剩一个圆形展开按钮 */
.nh-floatbar.is-collapsed {
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.nh-floatbar.is-collapsed .nh-floatbar__list {
  display: none;
}

.nh-floatbar.is-collapsed .nh-floatbar__toggle {
  width: 57px;
  height: 57px;
  border: 1px solid var(--gray-200, #edf0f5);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.nh-floatbar.is-collapsed .nh-floatbar__toggle svg {
  transform: rotate(180deg);
}

/* 移动端略收窄 */
@media (max-width: 640px) {
.nh-floatbar {
    right: 8px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 8px;
    width: auto;
    flex-direction: row;
    align-items: stretch;
    border-radius: 10px;
  }

  .nh-floatbar__list {
    flex-direction: row;
    min-width: 0;
    flex: 1;
  }

  .nh-floatbar__item {
    width: auto;
    min-width: 0;
    height: 56px;
    flex: 1 1 0;
    gap: 3px;
    padding: 6px 2px;
    border-right: 1px solid var(--gray-200, #edf0f5);
    border-bottom: 0;
  }

  .nh-floatbar__item svg {
    width: 20px;
    height: 20px;
  }

  .nh-floatbar__item > span {
    font-size: 10px;
    letter-spacing: -.02em;
  }

  .nh-floatbar__badge {
    top: 3px;
    right: 1px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    border-radius: 8px;
    font-size: 10px;
    line-height: 16px;
  }

  .nh-floatbar__toggle {
    width: 38px;
    height: 56px;
    flex: none;
    border-top: 0;
    border-left: 1px solid var(--gray-200, #edf0f5);
  }

  .nh-floatbar.is-collapsed .nh-floatbar__toggle {
    width: 48px;
    height: 48px;
    margin-left: auto;
  }
}
