/* ==========================================================================
   Chinese Sidebar Customization (微信悬浮二维码与本土化样式隔离)
   Only loaded when meta.lang == 'zh'
   ========================================================================== */

/* 确保展开状态下微信二维码浮层不被面板 overflow:hidden 裁剪 */
.sany-sidebar-panel:not(.is-folded) {
  overflow: visible !important;
}

/* 微信按钮样式 */
.sany-sidebar-item.sany-sidebar-wechat {
  position: relative;
  cursor: pointer;
  background: none;
  border-bottom: 1px solid var(--dm-gray-100, #eef2f5);
}

.sany-sidebar-item.sany-sidebar-wechat:hover,
.sany-sidebar-item.sany-sidebar-wechat.is-active {
  color: #07c160; /* WeChat official green accent */
  background-color: var(--dm-gray-50, #f8fafc);
}

/* 微信二维码浮层卡片 (桌面端位于侧边栏左侧) */
.sany-wechat-popup {
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) scale(0.92);
  background: #ffffff;
  padding: 12px 12px 10px 12px;
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.22s;
  z-index: 1060;
  white-space: nowrap;
}

/* 指向侧边栏按钮的右侧小三角形 */
.sany-wechat-popup::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 6px solid #ffffff;
}

.sany-wechat-popup img {
  width: 130px;
  height: 130px;
  display: block;
  object-fit: contain;
  border-radius: 4px;
}

.sany-wechat-popup span {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #333333;
  line-height: 1.4;
  text-align: center;
}

/* 鼠标悬浮 (:hover) 或点击后激活 (.is-active) */
.sany-sidebar-wechat:hover .sany-wechat-popup,
.sany-sidebar-wechat.is-active .sany-wechat-popup {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}

/* 移动端响应式 (底部固定栏：浮层改在按钮上方显示) */
@media (max-width: 767px) {
  .sany-wechat-popup {
    right: auto;
    left: 50%;
    bottom: calc(100% + 14px);
    top: auto;
    transform: translateX(-50%) scale(0.92);
  }

  .sany-wechat-popup::after {
    right: auto;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #ffffff;
    border-bottom: none;
  }

  .sany-sidebar-wechat:hover .sany-wechat-popup,
  .sany-sidebar-wechat.is-active .sany-wechat-popup {
    transform: translateX(-50%) scale(1);
  }
}
