/*
 * 我要买卡 Batch 22 v3
 * PC 结账页付款方式图标与文字防重叠修正版
 *
 * 左侧图标固定定位，中间文字保留完整空间，右侧单选框固定。
 * 仅影响电脑端结账页。
 */

@media (min-width: 768px) {
  body:has(#checkout-payment-method)
  #checkout-payment-method
  .form-check > label,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  .radio > label,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label:has(input[type="radio"]) {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;

    width: 100% !important;
    min-height: 78px !important;

    /*
     * 左侧 118px 专供图标，右侧 105px 保留“已选择”和单选框。
     */
    padding: 15px 105px 15px 118px !important;
    box-sizing: border-box !important;

    font-size: 15px !important;
    line-height: 1.45 !important;
    text-indent: 0 !important;
    white-space: normal !important;
    overflow: visible !important;

    grid-template-columns: none !important;
    column-gap: 0 !important;
    gap: 0 !important;
  }

  /*
   * 图标及可能的图标包装层全部固定在左侧。
   */
  body:has(#checkout-payment-method)
  #checkout-payment-method
  label > img,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .payment-logo,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .payment-image,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .payment-icon,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .method-image,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .method-icon,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .thumb,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .image,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .logo,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label [style*="background-image"] {
    position: absolute !important;
    left: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: 88px !important;
    min-width: 88px !important;
    max-width: 88px !important;
    height: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;

    margin: 0 !important;
    padding: 5px 8px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  /*
   * 包装层内图片保持比例，不拉伸。
   */
  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .payment-logo img,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .payment-image img,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .payment-icon img,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .method-image img,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .method-icon img,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .thumb img,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .image img,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .logo img,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label > img {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 76px !important;
    max-height: 40px !important;
    object-fit: contain !important;
    object-position: center !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /*
   * 中间文字区域完整显示，不截断、不向左覆盖图标。
   */
  body:has(#checkout-payment-method)
  #checkout-payment-method
  label span:not(.payment-logo):not(.payment-image):not(.payment-icon):not(.method-image):not(.method-icon):not(.thumb):not(.image):not(.logo),

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .name,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .title,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .method-name,

  body:has(#checkout-payment-method)
  #checkout-payment-method
  label .payment-name {
    position: static !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;

    overflow: visible !important;
    white-space: normal !important;
    text-overflow: clip !important;
    transform: none !important;
  }

  /*
   * 单选框固定在最右侧。
   */
  body:has(#checkout-payment-method)
  #checkout-payment-method
  label input[type="radio"] {
    position: absolute !important;
    right: 18px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;

    display: block !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
  }
}
