/*
 * 区块结账页「付款选项」那一块的过渡（2026-11-20）：单选按钮、选中行、展开收起。
 * 支付方式列表和单选按钮是 WooCommerce 自己的组件，这里只加过渡，不改布局；只作用于 .wc-block-checkout__payment-method 里面。
 * 高度的平滑展开收起纯样式做不到（WooCommerce 是直接换掉内容的），在 checkout-polish.js 里。
 * 注意：它会作用于这一块里**所有**支付方式（包括别的插件的），正式发给客户前要想好要不要带。
 */

.wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option {
  transition:
    background-color 0.25s ease,
    box-shadow 0.25s ease;
}

/* 选中的那一行：WooCommerce 用内阴影画边框，这里让它渐变出现，再垫一层很淡的底色 */
.wc-block-checkout__payment-method
  .wc-block-components-radio-control-accordion-option--checked-option-highlighted {
  background-color: var(--ccg-accent-tint, rgba(0, 0, 0, 0.018));
}

/*
 * 选中框改轻（2026-11-20 产品）：WooCommerce 默认 1.5px、跟主题文字色（这个主题是纯黑），
 * 和黑色的勾选圆挤在一起显得重。改成 1px 深灰，勾选圆当主角、边框退一步。配送选项同样处理。
 * 多套一层 --highlight-checked，压过 WooCommerce 自己的同名规则。
 */
.wc-block-checkout__payment-method
  .wc-block-components-radio-control--highlight-checked
  .wc-block-components-radio-control-accordion-option--checked-option-highlighted,
.wc-block-checkout__shipping-option
  .wc-block-components-radio-control--highlight-checked
  .wc-block-components-radio-control__option--checked-option-highlighted {
  box-shadow: inset 0 0 0 1px var(--ccg-accent-border, rgba(0, 0, 0, 0.6));
}

/* 没选中的行：鼠标放上去有一点反馈 */
.wc-block-checkout__payment-method
  .wc-block-components-radio-control-accordion-option:not(
    .wc-block-components-radio-control-accordion-option--checked-option-highlighted
  )
  > .wc-block-components-radio-control__option:hover {
  background-color: rgba(0, 0, 0, 0.025);
}
.wc-block-checkout__payment-method .wc-block-components-radio-control__option {
  transition: background-color 0.2s ease;
}

/*
 * 选择按钮：勾选圆（2026-11-20，替换原来的「圆圈 + 圆点」）。
 * 没选中是一个细圈；选中后整个圆填满深色，中间一个白色对勾弹性出现——比圆点更像「就用这个付」。
 * 黑色跟店铺主题的「下单」按钮一致。对勾用 ::before 的右、下两条边旋转 45° 画出来，不用图片。
 */
/* 付款选项和配送选项用的是同一个单选组件，两处统一成勾选圆（2026-11-20） */
:is(.wc-block-checkout__payment-method, .wc-block-checkout__shipping-option)
  input.wc-block-components-radio-control__input {
  width: 20px;
  height: 20px;
  border: 1.5px solid rgba(0, 0, 0, 0.32);
  border-radius: 50%;
  background: #fff;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
:is(.wc-block-checkout__payment-method, .wc-block-checkout__shipping-option)
  input.wc-block-components-radio-control__input:hover {
  border-color: rgba(0, 0, 0, 0.55);
}
:is(.wc-block-checkout__payment-method, .wc-block-checkout__shipping-option)
  input.wc-block-components-radio-control__input:checked {
  border-color: var(--ccg-accent, #111);
  background: var(--ccg-accent, #111);
}
:is(.wc-block-checkout__payment-method, .wc-block-checkout__shipping-option)
  input.wc-block-components-radio-control__input::before {
  content: '';
  position: absolute;
  top: 46%;
  left: 50%;
  display: block;
  width: 5px;
  height: 9px;
  margin: 0;
  border: solid var(--ccg-on-accent, #fff);
  border-width: 0 2px 2px 0;
  border-radius: 0;
  background: transparent;
  transform: translate(-50%, -50%) rotate(45deg) scale(0);
  transition: transform 0.24s cubic-bezier(0.3, 1.6, 0.6, 1);
}
/* 选中时 WooCommerce 自己的规则会把它改回 10×10 的圆点：形状要在这里再写一遍 */
:is(.wc-block-checkout__payment-method, .wc-block-checkout__shipping-option)
  input.wc-block-components-radio-control__input:checked::before {
  top: 46%;
  left: 50%;
  width: 5px;
  height: 9px;
  border: solid var(--ccg-on-accent, #fff);
  border-width: 0 2px 2px 0;
  border-radius: 0;
  background: transparent;
  transform: translate(-50%, -50%) rotate(45deg) scale(1);
}
:is(.wc-block-checkout__payment-method, .wc-block-checkout__shipping-option)
  input.wc-block-components-radio-control__input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ccg-accent-ring, rgba(0, 0, 0, 0.18));
}

/* 配送选项的选中行：和付款选项一样，边框渐变出现、垫一层很淡的底色 */
.wc-block-checkout__shipping-option .wc-block-components-radio-control__option {
  transition:
    background-color 0.25s ease,
    box-shadow 0.25s ease;
}
.wc-block-checkout__shipping-option
  .wc-block-components-radio-control__option--checked-option-highlighted {
  background-color: var(--ccg-accent-tint, rgba(0, 0, 0, 0.018));
}

/* 我们三种新表单的那一行：右边是卡组织图标（WooCommerce 自带的图标） */
.wc-block-checkout__payment-method .ccgm-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  width: 100%;
}
.wc-block-checkout__payment-method .ccgm-label .wc-block-components-payment-method-icons {
  margin: 0;
}

/*
 * 新展开的内容：从「模糊 + 透明 + 略微上移」到「清晰 + 不透明 + 归位」，像镜头对焦。
 * 模糊要轻（6px、0.3 秒）、只用在新出现的内容上；高度的过渡在 checkout-polish.js，不叠模糊。
 */
.wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-content {
  animation: ccgp-content-in 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes ccgp-content-in {
  from {
    opacity: 0;
    filter: blur(6px);
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}

/*
 * ═══════════ 经典结账页（短代码 [woocommerce_checkout]）：同一套勾选圆与淡入 ═══════════
 * 经典页的单选按钮是浏览器原生的；这里套成和区块页一样的勾选圆。对勾用背景里的 SVG 画（不靠 input 的 ::before，
 * 有的浏览器不给 input 画伪元素），出现时把背景尺寸从 0 放大，带一点回弹。
 * 支付方式的展开收起 WooCommerce 经典页自己会滑动，这里只给展开的内容加模糊淡入。
 */
#payment ul.payment_methods li > input.input-radio,
#shipping_method li > input.shipping_method[type='radio'] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  width: 20px;
  height: 20px;
  margin: 0 10px 0 0;
  vertical-align: -4px;
  border: 1.5px solid rgba(0, 0, 0, 0.32);
  border-radius: 50%;
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.6-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 0 0 no-repeat;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    background-size 0.24s cubic-bezier(0.3, 1.6, 0.6, 1),
    box-shadow 0.2s ease;
}
/* 主色是浅色时（比如黄色按钮，applyAccent 会给根元素加 ccg-accent-light），对勾换成深色才看得清 */
.ccg-accent-light #payment ul.payment_methods li > input.input-radio:checked,
.ccg-accent-light #shipping_method li > input.shipping_method[type='radio']:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.6-5' fill='none' stroke='%23111' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
#payment ul.payment_methods li > input.input-radio:hover,
#shipping_method li > input.shipping_method[type='radio']:hover {
  border-color: rgba(0, 0, 0, 0.55);
}
#payment ul.payment_methods li > input.input-radio:checked,
#shipping_method li > input.shipping_method[type='radio']:checked {
  border-color: var(--ccg-accent, #111);
  background-color: var(--ccg-accent, #111);
  background-size: 12px 12px;
}
#payment ul.payment_methods li > input.input-radio:focus-visible,
#shipping_method li > input.shipping_method[type='radio']:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ccg-accent-ring, rgba(0, 0, 0, 0.18));
}
#payment ul.payment_methods li > label {
  cursor: pointer;
}
#payment .payment_box {
  animation: ccgp-content-in 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  #payment ul.payment_methods li > input.input-radio,
  #shipping_method li > input.shipping_method[type='radio'] {
    transition: none;
  }
  #payment .payment_box {
    animation: none;
  }
  .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option,
  .wc-block-checkout__payment-method .wc-block-components-radio-control__option,
  .wc-block-checkout__shipping-option .wc-block-components-radio-control__option,
  :is(.wc-block-checkout__payment-method, .wc-block-checkout__shipping-option)
    input.wc-block-components-radio-control__input,
  :is(.wc-block-checkout__payment-method, .wc-block-checkout__shipping-option)
    input.wc-block-components-radio-control__input::before {
    transition: none;
  }
  .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-content {
    animation: none;
  }
}
