/**
 * Bigazone — Universal form control presentation.
 * Country/Region's light-gray idle border is the single design token for text
 * fields, textarea, native selects, SelectWoo and WC Blocks floating fields.
 * Do not restyle radio/checkbox, action buttons, errors or native data logic.
 */
:root {
  --bz-field-border: var(--bz-border, #e7e7e9);
  --bz-field-arrow: var(--bz-muted, #6b717b);
}

/* Plain HTML, native WordPress forms, WooCommerce classic + search/comments. */
body :is(input[type="text"], input[type="email"], input[type="password"],
         input[type="tel"], input[type="url"], input[type="search"],
         input[type="number"], input[type="date"], input[type="time"],
         input[type="datetime-local"], textarea, select):not(.qty):not([hidden]):not([type="hidden"]):not([aria-invalid="true"]):not(:focus):not(:focus-visible),
body .woocommerce form .form-row:not(.woocommerce-invalid) :is(input.input-text, textarea, select):not([aria-invalid="true"]):not(:focus):not(:focus-visible) {
  border-color: var(--bz-field-border);
}

/* WC Cart/Checkout block inputs often supply higher-specificity borders. */
body :is(.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout)
  :is(.wc-block-components-text-input:not(.has-error) input,
      .wc-block-components-combobox-control:not(.has-error) input,
      .wc-blocks-components-select__select,
      .wc-block-components-textarea,
      textarea):not([aria-invalid="true"]):not(:focus):not(:focus-visible) {
  border-color: var(--bz-field-border) !important;
}
body :is(.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout)
  :is(.wc-block-components-text-input, .wc-block-components-combobox-control)
  :is(input):not(:focus):not(:focus-visible) {
  box-shadow: none;
}

/* The WC Blocks floating input may use a field wrapper to style its border. */
body .wp-block-woocommerce-checkout .bz-checkout-picker__trigger:not(:focus-visible),
body .wp-block-woocommerce-checkout .bz-checkout-picker:not(.is-open) .bz-checkout-picker__trigger:not(:focus-visible) {
  border-color: var(--bz-field-border) !important;
}
/* SelectWoo used on My Account billing/shipping edit form. */
body.woocommerce-account .woocommerce-address-fields .select2-container--default:not(.select2-container--open):not(.select2-container--focus)
  .select2-selection--single {
  border-color: var(--bz-field-border) !important;
}

/* Native/select-like arrows share a muted-gray tint. No icons are replaced. */
body .woocommerce-address-fields .select2-container--default .select2-selection--single .select2-selection__arrow,
body .wc-blocks-components-select .wc-blocks-components-select__expand,
body .wc-block-components-combobox .wc-block-components-combobox-control__button,
body .bz-checkout-picker__arrow,
body .woocommerce .woocommerce-ordering .bz-sort__arrow {
  color: var(--bz-field-arrow);
}
body.woocommerce-account .woocommerce-address-fields .select2-container--default .select2-selection--single .select2-selection__arrow {
  background: var(--bz-field-arrow) !important;
  -webkit-mask: url('../icons/chevron-down.svg') center / 12px 12px no-repeat;
  mask: url('../icons/chevron-down.svg') center / 12px 12px no-repeat;
}

/* One-pixel focus border without double outline; WC error fields retain their
 * validation colors through:not(.has-error) /:not(.is-error) exclusions.*/
body :is(.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout)
  :is(.wc-block-components-text-input:not(.has-error) input,
      .wc-block-components-combobox-control:not(.has-error) input,
      .wc-blocks-components-select:not(.has-error) select,
      .wc-block-components-textarea):focus,
body :is(.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout)
  :is(.wc-block-components-text-input:not(.has-error) input,
      .wc-block-components-combobox-control:not(.has-error) input,
      .wc-blocks-components-select:not(.has-error) select,
      .wc-block-components-textarea):focus-visible {
  border-color: var(--bz-primary) !important;
  border-width: 1px;
  outline: none;
  box-shadow: none;
}

/* The WooCommerce Blocks payment group owns ONE visible border.
 * The previous version boxed both the group's native container and an inner
 * accordion option, leaving duplicate vertical edges in staging. Exclude all
 * child labels/layout/description from the border. Preserve WC separators and
 * actual radio selection, including keyboard focus on the whole payment group.*/
body .wp-block-woocommerce-checkout .wc-block-checkout__payment-method
  .wc-block-components-radio-control {
  border: 1px solid var(--bz-field-border) !important;
  border-radius: var(--bz-radius) !important;
  box-shadow: none !important;
  overflow: hidden;
}
body .wp-block-woocommerce-checkout .wc-block-checkout__payment-method
  :is(.wc-block-components-radio-control-accordion-option,
      .wc-block-components-radio-control-accordion-content,
      .wc-block-components-radio-control__option,
      .wc-block-components-radio-control__option-layout) {
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0;
  box-shadow: none !important;
}
body .wp-block-woocommerce-checkout .wc-block-checkout__payment-method
  .wc-block-components-radio-control:has(input[type="radio"]:focus-visible) {
  border-color: var(--bz-primary) !important;
}
/* Retain a visible cue if WC renders its radio outside the expected group. */
body .wp-block-woocommerce-checkout .wc-block-checkout__payment-method
  input[type="radio"]:focus-visible {
  outline: 2px solid var(--bz-primary);
  outline-offset: 2px;
}
/* Classic checkout's payment methods use the same resting tone. */
body.woocommerce-checkout #payment :is(ul.payment_methods, .payment_box) {
  border-color: var(--bz-field-border);
}

/* checkbox single-border focus standard (QA screenshot: Checkout order notes).
 * Remove the browser/Blocks double outer halo from pointer and keyboard focus
 * preserve a visible keyboard cue by changing the existing checkbox border color.
 * Do not alter the checked state, mark, size or behavior.*/
body input[type="checkbox"]:focus,
body input[type="checkbox"]:focus-visible,
body .wc-block-components-checkbox input[type="checkbox"]:focus,
body .wc-block-components-checkbox input[type="checkbox"]:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}
body input[type="checkbox"]:focus-visible,
body .wc-block-components-checkbox input[type="checkbox"]:focus-visible {
  border-color: var(--bz-primary) !important;
}
