/*
 * polish.css - zhanghaowuyou.com UX 增强样式
 *
 * 用途：图片排版规整、破图兜底占位、客服触达组件样式
 * 注入方式：nginx 在 </head> 前注入 <link rel="stylesheet" href="/polish.css" />
 * 回滚方法：删除 nginx 注入配置，清除浏览器缓存
 *
 * 包含功能：
 * - P0.4 商品图统一比例与裁切
 * - P0.1 破图占位样式
 * - P0.2 悬浮微信咨询按钮
 * - P0.3 商品卡片「咨询这款」按钮
 * - P1.1 移动端底部联系条
 * - P1.2 Footer 微信号可复制样式
 * - P2.2 顶部导航「微信咨询」突出显示
 */

/* ========== P0.4 商品图排版规整 ========== */
.product-grid .item .cover {
  display: block;
  position: relative;
  width: 100%;
  /* 固定图框高度，避免图片高度不一致导致卡片底部参差 */
  height: 200px;
  overflow: hidden;
  border-radius: 8px;
  background-color: #f5f5f5;
}

.product-grid .item .cover img {
  width: 100%;
  height: 100%;
  /* 图片填充图框，超出部分裁切 */
  object-fit: cover;
  object-position: center;
  display: block;
}

/* ========== P0.1 破图兜底占位 ========== */
.product-grid .item .cover.img-error {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;
  border: 1px solid #e0e0e0;
}

.product-grid .item .cover.img-error::before {
  content: "图片暂缺\A咨询客服了解详情";
  white-space: pre-wrap;
  text-align: center;
  font-size: 14px;
  color: #999;
  line-height: 1.6;
}

.product-grid .item .cover.img-error img {
  /* 隐藏破图的 img 标签 */
  display: none;
}

/* ========== P0.2 悬浮微信咨询按钮 ========== */
.wechat-float-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #07C160, #00B050);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  color: white;
  font-size: 24px;
  user-select: none;
}

.wechat-float-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(7, 193, 96, 0.4);
}

.wechat-float-btn::before {
  content: "💬";
}

/* 移动端适配：缩小按钮，上移避免遮挡系统导航栏 */
@media (max-width: 768px) {
  .wechat-float-btn {
    width: 50px;
    height: 50px;
    bottom: 80px;
    right: 16px;
    font-size: 20px;
  }
}

/* ========== P0.3 商品卡片「咨询这款」按钮 ========== */
.product-grid .item .action-btns {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.product-grid .item .btn-consult {
  flex: 1;
  padding: 10px 16px;
  background: linear-gradient(135deg, #07C160, #00B050);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0.9;
}

.product-grid .item .btn-consult:hover {
  opacity: 1;
  transform: translateY(-1px);
}

/* 原「查看详情」按钮调整为与咨询按钮并列 */
.product-grid .item .btn-detail {
  flex: 1;
}

/* 移动端：按钮竖向堆叠 */
@media (max-width: 768px) {
  .product-grid .item .action-btns {
    flex-direction: column;
  }

  .product-grid .item .btn-consult,
  .product-grid .item .btn-detail {
    width: 100%;
  }
}

/* ========== P1.1 移动端底部联系条 ========== */
.wechat-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(90deg, #07C160, #00B050);
  color: white;
  padding: 12px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  z-index: 9998;
  cursor: pointer;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  display: none;
  user-select: none;
}

.wechat-bottom-bar:active {
  opacity: 0.9;
}

/* 只在移动端显示 */
@media (max-width: 768px) {
  .wechat-bottom-bar {
    display: block;
  }

  /* 给 body 添加底部 padding，避免底部条遮挡内容 */
  body {
    padding-bottom: 48px;
  }
}

/* ========== P1.2 Footer 微信号可复制 ========== */
.wechat-copy {
  color: inherit;
  text-decoration: underline;
  text-decoration-style: dotted;
  cursor: pointer;
  transition: color 0.3s ease;
}

.wechat-copy:hover {
  color: #07C160;
}

/* ========== P2.2 顶部导航「微信咨询」突出显示 ========== */
.xy-topbar .wechat-entry {
  background: linear-gradient(135deg, #07C160, #00B050) !important;
  color: white !important;
  padding: 8px 16px !important;
  border-radius: 999px !important;
  font-weight: bold !important;
  transition: box-shadow 0.3s ease, transform 0.3s ease !important;
}

.xy-topbar .wechat-entry:hover {
  box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3);
  transform: translateY(-1px);
}

/* ========== Toast 提示组件 ========== */
.wechat-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 16px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 10000;
  pointer-events: none;
  animation: fadeInOut 2s ease-in-out;
  white-space: pre-wrap;
  text-align: center;
  max-width: 80%;
  word-break: break-word;
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  10% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  90% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
}

/* ========== 品牌 logo 兜底（破图按商品品牌换 logo） ========== */
.product-grid .item .cover img.brand-logo-img {
  object-fit: contain;
  padding: 36px 46px;
  box-sizing: border-box;
  background-color: #f7f7f5;
}

.hero-shot img.brand-logo-img {
  object-fit: contain;
  padding: 40px 60px;
  box-sizing: border-box;
  background-color: #f7f7f5;
}

.hero-shot.img-error {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;
  border: 1px solid #e0e0e0;
  min-height: 240px;
}

.hero-shot.img-error img {
  display: none;
}

.hero-shot.img-error::after {
  content: "图片暂缺，咨询客服了解详情";
  font-size: 14px;
  color: #999;
}
