/**
 * 移动端购物车WhatsApp结账按钮修复
 * 解决按钮被遮挡和结账信息不显示的问题
 */

/* 移动端适配 */
@media (max-width: 768px) {
  /* 优惠券容器样式 */
  .cart-coupon-container {
    position: fixed !important;
    bottom: 210px !important; /* 为结账信息和按钮留出空间 */
    left: 0 !important;
    right: 0 !important;
    background-color: #fff !important;
    padding: 10px 15px !important;
    z-index: 10000 !important;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05) !important;
  }

  /* 确保购物车总结区域不被底部导航栏遮挡 */
  .cart-summary {
    position: fixed !important;
    bottom: 70px !important; /* 为底部导航栏留出空间 */
    left: 0 !important;
    right: 0 !important;
    background-color: #fff !important;
    padding: 10px 15px !important;
    z-index: 10001 !important;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05) !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* 确保WhatsApp结账按钮样式正确且不被遮挡 */
  .checkout-whatsapp-btn {
    width: 100% !important;
    margin-top: 5px !important;
    margin-bottom: 5px !important;
    background-color: #25D366 !important; /* WhatsApp绿色 */
    background-image: linear-gradient(to right, #25D366, #1DA851) !important; /* 微妙渐变 */
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    position: relative !important;
    z-index: 10002 !important; /* 确保在最上层 */
    box-shadow: 0 2px 6px rgba(37, 211, 102, 0.4) !important;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    height: 48px !important; /* 保持当前大小 */
  }

  /* 结账信息容器样式 */
  .checkout-info {
    background-color: #f9f9f9 !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    margin: 5px 0 !important;
    width: 100% !important;
  }

  /* 小计、折扣和总计样式 */
  .cart-subtotal,
  .cart-discount,
  .cart-total {
    display: flex !important;
    justify-content: space-between !important;
    margin-bottom: 5px !important;
    width: 100% !important;
    padding: 3px 0 !important;
  }

  .cart-total {
    font-weight: bold !important;
    margin-top: 5px !important;
    padding-top: 5px !important;
    border-top: 1px solid #eee !important;
    font-size: 16px !important;
  }

  .cart-discount {
    color: #e74c3c !important; /* 红色显示折扣 */
  }

  /* 优惠券模态框样式调整 */
  .user-coupons-modal-overlay {
    z-index: 20000 !important; /* 确保在最上层 */
  }

  /* 为优惠券留出空间，避免被底部固定元素遮挡 */
  .cart-items {
    padding-bottom: 280px !important; /* 为底部的优惠券、结账信息和导航栏留出空间 */
  }

  /* 为iOS设备底部安全区域适配 */
  @supports (padding: env(safe-area-inset-bottom)) {
    .cart-summary {
      bottom: calc(70px + env(safe-area-inset-bottom)) !important;
      padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    }

    .cart-coupon-container {
      bottom: calc(210px + env(safe-area-inset-bottom)) !important;
    }

    .cart-items {
      padding-bottom: calc(280px + env(safe-area-inset-bottom)) !important;
    }
  }
}
