/*
 * WooCommerce 核心模板的 Bootstrap 样式补丁（2026-11-09）
 *
 * 以前主题覆盖了 8 个 WooCommerce 模板，只是为了给元素加 Bootstrap 类名
 * （form-control / btn / btn-primary / d-flex flex-wrap / col-12 col-md-6）。
 * 这些覆盖模板已删除，改用核心模板，样式在这里用核心模板自带的类名 / ID 重新实现：
 *   checkout/form-coupon、global/form-login、myaccount/form-login、myaccount/form-lost-password、
 *   product-searchform、myaccount/my-address、order/order-details-customer、checkout/form-checkout
 *
 * 注意：
 * - 本文件紧跟 bootstrap.css 加载（functions.php 中依赖 'bootstrap'）。
 * - 输入框 / 按钮的选择器用 :where() 把优先级压到与 Bootstrap 类名相同（0,1,0），
 *   这样 WooCommerce 和 joy-shopping.css 里原本能覆盖 Bootstrap 的规则仍然生效，最终效果与原来一致。
 * - 声明值照抄 Bootstrap 4.3.1。
 */

/* ---------- .form-control ---------- */
.input-text:where(#coupon_code, .woocommerce-form-login #username, .woocommerce-form-login #password, .woocommerce-form-register #reg_username, .woocommerce-form-register #reg_email, .woocommerce-ResetPassword #user_login),
.search-field:where(.woocommerce-product-search > *) {
  display: block;
  width: 100%;
  height: calc(1.5em + .75rem + 2px);
  padding: .375rem .75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #495057;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #ced4da;
  border-radius: .25rem;
  transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
  .input-text:where(#coupon_code, .woocommerce-form-login #username, .woocommerce-form-login #password, .woocommerce-form-register #reg_username, .woocommerce-form-register #reg_email, .woocommerce-ResetPassword #user_login),
  .search-field:where(.woocommerce-product-search > *) {
    transition: none;
  }
}

.input-text:where(#coupon_code, .woocommerce-form-login #username, .woocommerce-form-login #password, .woocommerce-form-register #reg_username, .woocommerce-form-register #reg_email, .woocommerce-ResetPassword #user_login):focus,
.search-field:where(.woocommerce-product-search > *):focus {
  color: #495057;
  background-color: #fff;
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 .2rem rgba(0, 123, 255, .25);
}

.input-text:where(#coupon_code, .woocommerce-form-login #username, .woocommerce-form-login #password, .woocommerce-form-register #reg_username, .woocommerce-form-register #reg_email, .woocommerce-ResetPassword #user_login)::placeholder,
.search-field:where(.woocommerce-product-search > *)::placeholder {
  color: #6c757d;
  opacity: 1;
}

.input-text:where(#coupon_code, .woocommerce-form-login #username, .woocommerce-form-login #password, .woocommerce-form-register #reg_username, .woocommerce-form-register #reg_email, .woocommerce-ResetPassword #user_login):disabled,
.search-field:where(.woocommerce-product-search > *):disabled {
  background-color: #e9ecef;
  opacity: 1;
}

/* ---------- .btn（商品搜索按钮；我的账户登录按钮另加 .btn-primary） ---------- */
[type="submit"]:where(.woocommerce-product-search > *),
.woocommerce-form-login__submit:where(.woocommerce-account *) {
  display: inline-block;
  font-weight: 400;
  color: #212529;
  text-align: center;
  vertical-align: middle;
  user-select: none;
  background-color: transparent;
  border: 1px solid transparent;
  padding: .375rem .75rem;
  font-size: 1rem;
  line-height: 1.5;
  border-radius: .25rem;
  transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
  [type="submit"]:where(.woocommerce-product-search > *),
  .woocommerce-form-login__submit:where(.woocommerce-account *) {
    transition: none;
  }
}

[type="submit"]:where(.woocommerce-product-search > *):hover,
.woocommerce-form-login__submit:where(.woocommerce-account *):hover {
  color: #212529;
  text-decoration: none;
}

[type="submit"]:where(.woocommerce-product-search > *):focus,
.woocommerce-form-login__submit:where(.woocommerce-account *):focus {
  outline: 0;
  box-shadow: 0 0 0 .2rem rgba(0, 123, 255, .25);
}

[type="submit"]:where(.woocommerce-product-search > *):disabled,
.woocommerce-form-login__submit:where(.woocommerce-account *):disabled {
  opacity: .65;
}

[type="submit"]:where(.woocommerce-product-search > *):not(:disabled):not(.disabled),
.woocommerce-form-login__submit:where(.woocommerce-account *):not(:disabled):not(.disabled) {
  cursor: pointer;
}

/* .btn-primary：只用于“我的账户”登录按钮 */
.woocommerce-form-login__submit:where(.woocommerce-account *) {
  color: #fff;
  background-color: #007bff;
  border-color: #007bff;
}

.woocommerce-form-login__submit:where(.woocommerce-account *):hover {
  color: #fff;
  background-color: #0069d9;
  border-color: #0062cc;
}

.woocommerce-form-login__submit:where(.woocommerce-account *):focus {
  box-shadow: 0 0 0 .2rem rgba(38, 143, 255, .5);
}

.woocommerce-form-login__submit:where(.woocommerce-account *):disabled {
  color: #fff;
  background-color: #007bff;
  border-color: #007bff;
}

.woocommerce-form-login__submit:where(.woocommerce-account *):not(:disabled):not(.disabled):active {
  color: #fff;
  background-color: #0062cc;
  border-color: #005cbf;
}

.woocommerce-form-login__submit:where(.woocommerce-account *):not(:disabled):not(.disabled):active:focus {
  box-shadow: 0 0 0 .2rem rgba(38, 143, 255, .5);
}

/* ---------- 两栏布局（原 d-flex flex-wrap + col-12 col-md-6） ----------
 * 核心模板的列是 .col-1 / .col-2，会被 Bootstrap 当成 1/12、2/12 宽的栅格列，
 * 也会被 WooCommerce 的 float:left; width:48% 命中，这里统一改回原来的效果：
 * 手机一列，≥768px 两列各占 50%，左右各 15px 内边距。
 */
:is(#customer_details, .woocommerce-Addresses, .woocommerce-columns--addresses).col2-set {
  display: flex !important;
  flex-wrap: wrap !important;
}

:is(#customer_details, .woocommerce-Addresses, .woocommerce-columns--addresses).col2-set > :is(.col-1, .col-2) {
  position: relative;
  float: none;
  width: 100%;
  padding-right: 15px;
  padding-left: 15px;
  flex: 0 0 100%;
  max-width: 100%;
}

@media (min-width: 768px) {
  :is(#customer_details, .woocommerce-Addresses, .woocommerce-columns--addresses).col2-set > :is(.col-1, .col-2) {
    flex: 0 0 50%;
    max-width: 50%;
  }
}
