/* Frontend controls: native form values, shared Gladys presentation. */
:root {
	--gladys-form-field-size: 22px;
	--gladys-form-field-height: 58px;
	--gladys-control-font-size: 20px;
	--gladys-control-height: var(--gladys-form-field-height);
	--gladys-checkbox-size: 18px;
}
/* Keep the original select in the form and constraint validation, but not in the visual UI. */
select.gladys-native-select {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	padding: 0 !important;
	margin: -1px !important;
	border: 0 !important;
	clip: rect(0, 0, 0, 0) !important;
	clip-path: inset(50%) !important;
	overflow: hidden !important;
	white-space: nowrap !important;
}
body .gladys-select {
	display: inline-block;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	vertical-align: middle;
}
body .gladys-select[hidden], body .gladys-select__error[hidden], body .gladys-select-popup__search[hidden] { display: none !important; }
body .gladys-select .gladys-select__button {
	appearance: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: 100%;
	min-width: 0;
	min-height: var(--gladys-control-height);
	height: auto;
	margin: 0;
	padding: 10px 14px;
	border: 0;
	border-radius: 0;
	background: #fff;
	color: #000;
	box-shadow: none;
	font: 400 var(--gladys-control-font-size)/1.25 var(--gladys-font-sans, sans-serif);
	letter-spacing: normal;
	text-transform: none;
	text-align: left;
	cursor: pointer;
}
body .gladys-select__button::before { content: none; }
body .gladys-select .gladys-select__button::after {
	content: '';
	position: static;
	flex: 0 0 9px;
	width: 9px;
	height: 9px;
	margin: -4px 3px 0 0;
	background: none;
	border: solid currentColor;
	border-width: 0 1.5px 1.5px 0;
	transform: rotate(45deg);
	mask: none;
	-webkit-mask: none;
}
body .gladys-select .gladys-select__button[aria-expanded="true"]::after { transform: rotate(225deg); margin-top: 4px; }
body .gladys-select__text { min-width: 0; overflow-wrap: anywhere; }
body .gladys-select .gladys-select__button:focus-visible,
body .gladys-select-popup .gladys-select-popup__search:focus-visible { outline: 2px solid #111; outline-offset: 2px; }
body .gladys-select .gladys-select__button:disabled { opacity: .5; cursor: not-allowed; }
body .gladys-select__error { display: block; margin-top: 6px; color: #9a1717; font: 400 16px/1.3 var(--gladys-font-sans, sans-serif); }
body .gladys-select .gladys-select__button[aria-invalid="true"] { outline: 2px solid #9a1717; outline-offset: 0; }
body .gladys-select-popup {
	box-sizing: border-box;
	position: fixed;
	inset: auto;
	z-index: 1000000;
	display: flex;
	flex-direction: column;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: #fff;
	color: #000;
	box-shadow: 0 4px 14px #0002;
	font: 400 var(--gladys-control-font-size)/1.3 var(--gladys-font-sans, sans-serif);
	text-align: left;
	overflow: hidden;
}
body .gladys-select-popup .gladys-select-popup__search {
	box-sizing: border-box;
	flex: 0 0 auto;
	width: calc(100% - 20px);
	min-width: 0;
	min-height: 44px;
	height: auto;
	margin: 10px;
	padding: 8px 10px;
	border: 0;
	border-radius: 0;
	background: #fff;
	color: #000;
	font: inherit;
	box-shadow: none;
}
body .gladys-select-popup__list {
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	touch-action: pan-y;
}
body .gladys-select-popup__option {
	box-sizing: border-box;
	min-height: 44px;
	padding: 10px 14px;
	cursor: pointer;
	overflow-wrap: anywhere;
}
body .gladys-select-popup__option[aria-selected="true"] { background: #ececec; }
body .gladys-select-popup__option.is-highlighted { background: #000; color: #fff; }
@media (hover: hover) {
	body .gladys-select-popup__option:not([aria-disabled="true"]):hover { background: #000; color: #fff; }
}
body .gladys-select-popup__option[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
body .gladys-select-popup__group { padding: 10px 14px 4px; font-size: .85em; font-weight: 700; }
body .gladys-select-popup__empty { padding: 14px; }
/* Preserve SelectWoo/Select2 search, remote results and country/state integration. */
body .select2-container { max-width: 100%; font-family: var(--gladys-font-sans, sans-serif); }
body .select2-container:has(> .selection) { width: 100% !important; }
body .select2-container .select2-selection {
	border: 0 !important;
	border-radius: 0 !important;
	background: #fff !important;
	min-height: var(--gladys-control-height) !important;
	height: auto !important;
	box-shadow: none !important;
}
body .select2-container .select2-selection--single .select2-selection__rendered {
	display: flex; align-items: center; box-sizing: border-box;
	min-height: var(--gladys-control-height);
	padding: 10px 42px 10px 14px !important;
	font: 400 var(--gladys-control-font-size)/1.25 var(--gladys-font-sans, sans-serif) !important;
	color: #000 !important;
	white-space: normal;
}
body .select2-container .select2-selection--single .select2-selection__arrow { height: 100% !important; top: 0 !important; right: 14px !important; width: 12px !important; }
body .select2-container .select2-selection--single .select2-selection__arrow b {
	border: solid #111 !important;
	border-width: 0 1.5px 1.5px 0 !important;
	width: 9px !important; height: 9px !important;
	left: 0 !important; top: 50% !important; margin: -6px 0 0 !important;
	transform: rotate(45deg);
}
body .select2-container--open .select2-selection--single .select2-selection__arrow b { transform: rotate(225deg); }
body .select2-dropdown {
	border: 0 !important;
	border-radius: 0 !important;
	background: #fff !important;
	font: 400 var(--gladys-control-font-size)/1.3 var(--gladys-font-sans, sans-serif) !important;
	color: #000 !important;
}
body .select2-dropdown .select2-search__field {
	min-height: 44px !important; padding: 8px 10px !important;
	border: 0 !important; border-radius: 0 !important;
	background: #fff !important; color: #000 !important; font: inherit !important;
}
body .select2-dropdown .select2-results__option { min-height: 44px; padding: 10px 14px !important; font: inherit !important; }
body .select2-dropdown .select2-results__options { max-height: min(320px, 45vh); overscroll-behavior: contain; }
body .select2-dropdown .select2-results__option--highlighted[aria-selected] { background: #000 !important; color: #fff !important; }
body .select2-selection--multiple .select2-selection__choice { border: 1px solid #111 !important; border-radius: 0 !important; background: #eee !important; font-size: 16px; }
/* Checkbox size is deliberately independent of large label typography. */
body input[type="checkbox"]:not(#wpadminbar input) {
	-webkit-appearance: none !important;
	appearance: none !important;
	box-sizing: border-box !important;
	border: 1px solid #111 !important;
	border-radius: 0 !important;
	width: var(--gladys-checkbox-size) !important;
	height: var(--gladys-checkbox-size) !important;
	min-width: var(--gladys-checkbox-size) !important;
	min-height: var(--gladys-checkbox-size) !important;
	max-width: var(--gladys-checkbox-size) !important;
	max-height: var(--gladys-checkbox-size) !important;
	flex: 0 0 var(--gladys-checkbox-size) !important;
	padding: 0 !important;
	background: #fff !important;
	box-shadow: none !important;
	vertical-align: middle;
	cursor: pointer;
}
body input[type="checkbox"]:not(#wpadminbar input)::before,
body input[type="checkbox"]:not(#wpadminbar input)::after { content: none !important; }
body input[type="checkbox"]:not(#wpadminbar input):checked {
	background: #000 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='m4 9 3 3 7-7' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E") center / 16px 16px no-repeat !important;
}
body input[type="checkbox"]:not(#wpadminbar input):indeterminate {
	background: #000 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4 9h10' stroke='white' stroke-width='2'/%3E%3C/svg%3E") center / 16px 16px no-repeat !important;
}
body input[type="checkbox"]:not(#wpadminbar input):focus-visible { outline: 2px solid #111 !important; outline-offset: 3px; }
body input[type="checkbox"]:not(#wpadminbar input):disabled { opacity: .45; cursor: not-allowed; }
body .wc-block-components-checkbox .wc-block-components-checkbox__mark { display: none; }
@media (max-width: 1024px) { :root { --gladys-control-font-size: 18px; } }
@media (max-width: 700px) { :root { --gladys-control-font-size: 16px; } }
@media (forced-colors: active) {
	body input[type="checkbox"]:not(#wpadminbar input) { appearance: auto !important; -webkit-appearance: auto !important; background: none !important; }
}

/* Woo Blocks' floating label remains above the value; remove its duplicate arrow. */
body .wc-blocks-components-select__container:has(.gladys-native-select) .gladys-select__button {
	padding-top: 24px;
	padding-bottom: 8px;
	min-height: 58px;
}
body .wc-blocks-components-select__container:has(.gladys-native-select) .wc-blocks-components-select__expand { display: none; }
body .wc-blocks-components-select__container:has(.gladys-native-select) { border-radius: 0; }

/* Ordinary forms share the catalog-filter scale; access screens keep theirs. */
@media (max-width: 1024px) {
 :root { --gladys-form-field-size: 20px; --gladys-form-field-height: 54px; }
}
@media (max-width: 700px) {
 :root { --gladys-form-field-size: 18px; --gladys-form-field-height: 48px; }
}
body .site :is(.gladys-account--woocommerce, .gladys-catalog__filter-form, .woocommerce-checkout, .wp-block-woocommerce-checkout, #review_form) :is(input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="number"], input[type="search"], textarea) {
 font-size: var(--gladys-form-field-size);
 line-height: 1.25;
 min-height: var(--gladys-form-field-height);
 height: auto;
 padding: 10px 16px;
 box-sizing: border-box;
}
body .site :is(.gladys-account--woocommerce, .gladys-catalog__filter-form, .woocommerce-checkout, .wp-block-woocommerce-checkout, #review_form) textarea { min-height: 130px; }

/* Checkout labels already sit above the field: no floating-label inset needed. */
body.woocommerce-checkout .wp-block-woocommerce-checkout .wc-blocks-components-select__container:has(.gladys-native-select) .gladys-select__button {
 padding: 10px 14px;
 min-height: var(--gladys-control-height);
}
body .wc-blocks-components-select__container:has(.gladys-native-select) { border: 0; }
