/**
 * Frontend compatibility styles for Peru Locations for WooCommerce.
 *
 * Some themes override Select2/SelectWoo's accessibility-hiding rules and make
 * the original <select> visible next to the SelectWoo control. Keep only the
 * enhanced visual control visible while leaving the original field available
 * to the browser/form submission.
 */
.woocommerce .form-row select.plw-district-select.select2-hidden-accessible,
.woocommerce .form-row select.plw-district-select.plw-selectwoo-active {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Never leave more than one SelectWoo visual container for our District field. */
.woocommerce .plw-district-select + .select2-container {
	width: 100% !important;
}

/* Classic cart shipping calculator: keep Peru hierarchy vertical and aligned
 * inside narrow cart-total columns used by themes such as Impreza. */
.woocommerce form.woocommerce-shipping-calculator.plw-cart-peru .shipping-calculator-form .form-row,
.woocommerce form.woocommerce-shipping-calculator.plw-cart-peru .shipping-calculator-form .plw-cart-location-field {
	float: none !important;
	clear: both !important;
	width: 100% !important;
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

.woocommerce form.woocommerce-shipping-calculator.plw-cart-peru .shipping-calculator-form label {
	display: block;
	width: 100%;
}

.woocommerce form.woocommerce-shipping-calculator.plw-cart-peru .shipping-calculator-form input.input-text,
.woocommerce form.woocommerce-shipping-calculator.plw-cart-peru .shipping-calculator-form select,
.woocommerce form.woocommerce-shipping-calculator.plw-cart-peru .shipping-calculator-form .select2-container {
	box-sizing: border-box;
	width: 100% !important;
	max-width: none !important;
}

/* The native city input remains the submitted WooCommerce field. District is
 * selected through our companion control and mirrored into that hidden input. */
.woocommerce form.woocommerce-shipping-calculator.plw-cart-peru #calc_shipping_city.plw-cart-native-city-mirror {
	display: none !important;
}

/* Defensive SelectWoo hiding for themes that expose the original select. */
.woocommerce form.woocommerce-shipping-calculator select.plw-cart-province-select.select2-hidden-accessible,
.woocommerce form.woocommerce-shipping-calculator select.plw-cart-province-select.plw-selectwoo-active,
.woocommerce form.woocommerce-shipping-calculator select.plw-cart-district-select.select2-hidden-accessible,
.woocommerce form.woocommerce-shipping-calculator select.plw-cart-district-select.plw-selectwoo-active {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Real-time postal feedback. District compatibility is advisory and never
 * disables the checkout button; hard structural errors remain enforced by
 * WooCommerce/server validation. */
.plw-postcode-feedback {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin-top: 7px;
    padding: 8px 10px;
    border-left: 3px solid currentColor;
    border-radius: 2px;
    font-size: 0.88em;
    line-height: 1.4;
}

.plw-postcode-feedback.plw-postcode-warning {
    color: #7a5200;
    background: #fff8e5;
}

.plw-postcode-feedback.plw-postcode-error {
    color: #b32d2e;
    background: #fff0f0;
}

/* Server-side postal advisories (for example after saving a My Account
 * address) remain informational. Mark them yellow without changing the
 * browser/theme focus outline, which is kept for accessibility. */
body.woocommerce .woocommerce-info[data-plw-postcode-level="warning"],
body.woocommerce-page .woocommerce-info[data-plw-postcode-level="warning"],
.woocommerce .woocommerce-info[data-plw-postcode-level="warning"] {
    color: #7a5200 !important;
    background-color: #fff8e5 !important;
}
