/* ================================================
   旺质康官网 - 购物车 & 支付宝弹窗显示修复补丁
   Cart & Alipay Popup Display Fix Patch
   Version: 2026-06-12-v2
   ================================================ */

/* ===== 1. 购物车下拉面板显示修复 ===== */

/* 确保购物车按钮区域不受父容器overflow影响 */
.unified-cart-dropdown {
  position: relative;
  display: inline-block;
  z-index: 90000 !important;
}

/* 下拉面板定位修复 - 确保始终在可视区域内 */
.cart-dropdown-panel {
  position: fixed !important;
  top: auto !important;
  right: 16px !important;
  bottom: auto !important;
  margin-top: 8px;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: min(520px, 70vh);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  animation: cartSlideDown 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 90000 !important;
  transform-origin: top right;
}

/* 添加遮罩层 */
.cart-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 89998;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cartSlideDown {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 购物车按钮增强 */
.cart-trigger-btn {
  position: relative;
  z-index: 80001;
}

/* 购物车徽章 - 确保可见 */
.cart-badge {
  position: absolute !important;
  top: -8px !important;
  right: -8px !important;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: linear-gradient(135deg, #ff4757, #ff6b81) !important;
  color: white !important;
  font-size: 11px;
  font-weight: 700;
  border-radius: 11px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
  border: 2px solid white;
  z-index: 80002 !important;
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* 面板头部渐变背景 */
.cart-panel-header {
  padding: 18px 20px 14px;
  background: linear-gradient(135deg, #fff9f5 0%, #fff4eb 100%);
  border-bottom: 2px solid #ffe8d5;
}

/* 商品列表项优化 */
.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  margin: 4px 8px;
  background: #fafafa;
  border-radius: 12px;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.cart-item:hover {
  background: #ffffff;
  border-color: #ffd9b3;
  box-shadow: 0 4px 12px rgba(255, 103, 0, 0.08);
  transform: translateX(2px);
}

/* 商品图片容器 */
.item-image {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: #f5f5f5;
  border: 1px solid #eee;
  flex-shrink: 0;
}

/* 空购物车状态 */
.empty-cart {
  text-align: center;
  padding: 48px 24px;
}

.empty-cart-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.25;
  animation: cartFloat 3s ease-in-out infinite;
}

@keyframes cartFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.empty-cart-text {
  font-size: 16px;
  color: #666;
  font-weight: 600;
  margin: 0 0 6px 0;
}

.empty-cart-subtext {
  font-size: 13px;
  color: #999;
  margin: 0 0 24px 0;
}

/* 面板底部 */
.cart-panel-footer {
  padding: 14px 20px;
  background: #fafafa;
  border-top: 1px solid #f0f0f0;
}

/* ===== 2. 支付宝支付弹窗/页面显示修复 ===== */

/* 支付页面整体修复 */
.payment-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* 支付方式选择标签 */
.payment-method-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  padding: 4px;
  background: #f5f5f5;
  border-radius: 14px;
}

.payment-method-tab {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
  color: #666;
  text-align: center;
  position: relative;
}

.payment-method-tab.active {
  background: #ffffff;
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.payment-method-tab.alipay-tab.active {
  color: #1677ff;
  box-shadow: 0 2px 12px rgba(22, 119, 255, 0.2);
}

.payment-method-tab.wechat-tab.active {
  color: #009933;
  box-shadow: 0 2px 12px rgba(0, 153, 51, 0.2);
}

.payment-method-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.6);
  color: #333;
}

/* 二维码显示区域 */
.qr-code-container {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 20px auto;
  border-radius: 16px;
  overflow: hidden;
  background: #fafafa;
  border: 2px solid #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.qr-code-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

/* 二维码加载叠加层 */
.qr-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.qr-loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* 支付确认区域 */
.payment-confirm-section {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  margin-top: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  text-align: center;
}

.pay-amount-display {
  font-size: 36px;
  font-weight: 700;
  color: #f44336;
  margin: 12px 0;
}

.pay-amount-display .currency {
  font-size: 20px;
  font-weight: 500;
}

/* 确认支付按钮 */
.pay-confirm-btn {
  padding: 14px 48px;
  border: none;
  border-radius: 28px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.5px;
  width: 100%;
  max-width: 320px;
}

.pay-confirm-btn.alipay {
  background: linear-gradient(135deg, #1677ff 0%, #4096ff 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(22, 119, 255, 0.3);
}

.pay-confirm-btn.alipay:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(22, 119, 255, 0.4);
}

.pay-confirm-btn.alipay:active {
  transform: translateY(0);
}

.pay-confirm-btn.wechat {
  background: linear-gradient(135deg, #009933 0%, #00b33c 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 153, 51, 0.3);
}

.pay-confirm-btn.wechat:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 153, 51, 0.4);
}

.pay-confirm-btn:disabled {
  background: #cccccc !important;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* 支付方式图标 */
.pay-icon {
  font-size: 42px;
  margin-bottom: 8px;
}

/* 账户信息 */
.account-info {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  text-align: center;
}

.account-name {
  font-size: 17px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.account-tip {
  font-size: 13px;
  color: #888;
}

/* Alipay支付方式标签 */
.alipay-support-tags {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
  flex-wrap: wrap;
}

.alipay-support-tag {
  padding: 4px 12px;
  background: #e6f4ff;
  color: #1677ff;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #bae0ff;
}

/* 银行转账样式 */
.bank-info-card {
  background: #ffffff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.bank-info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 14px;
}

.bank-info-row:last-child {
  border-bottom: none;
}

.bank-info-label {
  color: #888;
  flex-shrink: 0;
}

.bank-info-value {
  color: #333;
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}

/* 安全提示 */
.security-notice {
  text-align: center;
  margin-top: 24px;
  padding: 12px;
  color: #999;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ===== 3. 移动端响应式修复 ===== */
@media (max-width: 768px) {
  .cart-dropdown-panel {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 75vh;
    border-radius: 20px 20px 0 0;
    margin-top: 0;
    animation: cartSlideUpMobile 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  }

  @keyframes cartSlideUpMobile {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  .cart-trigger-btn {
    padding: 8px 14px;
    font-size: 13px;
  }

  .cart-text {
    display: none;
  }

  .cart-badge {
    top: -6px !important;
    right: -6px !important;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    padding: 0 5px;
  }

  .cart-panel-content {
    max-height: 40vh;
  }

  .payment-page {
    padding: 12px 8px;
  }

  .qr-code-container {
    width: 180px;
    height: 180px;
  }

  .pay-confirm-btn {
    padding: 12px 32px;
    font-size: 15px;
  }

  .pay-amount-display {
    font-size: 28px;
  }
}

@media (max-width: 480px) {
  .cart-dropdown-panel {
    max-height: 65vh;
  }

  .cart-item {
    padding: 10px 12px;
    gap: 8px;
  }

  .item-image {
    width: 44px;
    height: 44px;
  }

  .qr-code-container {
    width: 150px;
    height: 150px;
  }

  .payment-method-tab {
    padding: 10px 14px;
    font-size: 13px;
  }
}

/* ===== 4. 通用弹窗/浮层z-index层级规范 ===== */
/* 确保所有弹窗/浮层都有正确的层级 */
.pdd-modal-overlay {
  z-index: 90000 !important;
}

.pdd-modal-content {
  z-index: 90001 !important;
}

/* 全局弹窗遮罩 */
.modal-backdrop,
.drawer-backdrop,
.overlay-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 89998;
  animation: fadeIn 0.2s ease;
}

/* ===== 5. 过渡动画增强 ===== */
.mi-animate-slide-down {
  animation: cartSlideDown 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mi-animate-pulse {
  animation: badgePulse 2s ease-in-out infinite;
}

/* 下载App按钮样式 */
.go-shopping-btn,
.download-app-btn {
  display: inline-block;
  padding: 12px 32px;
  background: linear-gradient(135deg, #ff6700, #ff8533);
  color: white;
  text-decoration: none;
  border-radius: 24px;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(255, 103, 0, 0.25);
  border: none;
  cursor: pointer;
}

.go-shopping-btn:hover,
.download-app-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 103, 0, 0.35);
}

/* ===== 6. 复制按钮样式 ===== */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: #f0f0f0;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: #e6f4ff;
  border-color: #1677ff;
  color: #1677ff;
}

.copy-btn.copied {
  background: #f6ffed;
  border-color: #52c41a;
  color: #52c41a;
}

/* ===== 7. 积分/优惠券开关样式修复 ===== */
.points-toggle,
.coupon-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.points-toggle-switch,
.coupon-toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  border-radius: 13px;
  transition: background 0.3s ease;
  cursor: pointer;
}

.points-toggle-switch.on,
.coupon-toggle-switch.on {
  background: #009933;
}

.points-toggle-switch.off,
.coupon-toggle-switch.off {
  background: #d9d9d9;
}

.toggle-knob {
  position: absolute;
  top: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  transition: left 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.toggle-knob.on {
  left: 24px;
}

.toggle-knob.off {
  left: 2px;
}