/**
 * Form field overrides — consistent 1px borders, password toggle, selects.
 */

/* ── Shared field shell ── */
.wp-site-blocks :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'],
	select,
	textarea:not(#comment),
	.dhyan-wc-page .woocommerce form .input-text,
	.dhyan-wc-page .woocommerce form select,
	.dhyan-wc-page .woocommerce form textarea:not(#comment)
):not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='submit']):not([type='button']):not(.saue-field__control) {
	-webkit-appearance: none !important;
	appearance: none !important;
	box-sizing: border-box !important;
	height: 2.5rem !important;
	min-height: 0 !important;
	max-height: none !important;
	padding: 0 0.875rem !important;
	border: var(--dhyan-border-width) solid var(--dhyan-color-border) !important;
	border-radius: var(--dhyan-radius-sm) !important;
	background: var(--dhyan-color-background) !important;
	background-image: none !important;
	color: var(--dhyan-color-foreground) !important;
	font-size: 0.875rem !important;
	line-height: 1.25rem !important;
	box-shadow: none !important;
	outline: none !important;
	filter: none !important;
	transition: border-color var(--dhyan-duration-fast) ease, box-shadow var(--dhyan-duration-fast) ease !important;
}

/* Extra-hardened auth fields (browser autofill / UA inset shadows) */
body.dhyan-wc-auth .woocommerce form :is(input.input-text, input[type='text'], input[type='email'], input[type='password']),
body.dhyan-wc-auth .dhyan-auth-shell :is(input.input-text, input[type='text'], input[type='email'], input[type='password']) {
	-webkit-appearance: none !important;
	appearance: none !important;
	border: var(--dhyan-border-width) solid var(--dhyan-color-border) !important;
	border-radius: var(--dhyan-radius-sm) !important;
	background-color: var(--dhyan-color-background) !important;
	background-image: none !important;
	box-shadow: none !important;
	-webkit-box-shadow: none !important;
	outline: none !important;
}

body.dhyan-wc-auth .woocommerce form :is(input.input-text, input[type='text'], input[type='email'], input[type='password']):focus,
body.dhyan-wc-auth .woocommerce form :is(input.input-text, input[type='text'], input[type='email'], input[type='password']):focus-visible,
body.dhyan-wc-auth .dhyan-auth-shell :is(input.input-text, input[type='text'], input[type='email'], input[type='password']):focus,
body.dhyan-wc-auth .dhyan-auth-shell :is(input.input-text, input[type='text'], input[type='email'], input[type='password']):focus-visible {
	border-color: var(--dhyan-color-accent) !important;
	outline: none !important;
	box-shadow: 0 0 0 2px var(--dhyan-color-background), var(--dhyan-shadow-focus) !important;
	-webkit-box-shadow: 0 0 0 2px var(--dhyan-color-background), var(--dhyan-shadow-focus) !important;
}

.wp-site-blocks textarea:not(#comment),
.dhyan-wc-page .woocommerce form textarea:not(#comment) {
	height: auto !important;
	min-height: 5.5rem !important;
	padding-top: 0.625rem !important;
	padding-bottom: 0.625rem !important;
	resize: vertical !important;
}

/* Product review textarea — must beat compact field + WooCommerce form rules */
.dhyan-wc-product-page .dhyan-product-details .comment-form-comment textarea,
.dhyan-wc-product-page .dhyan-product-details #comment,
.woocommerce form #comment {
	box-sizing: border-box !important;
	height: auto !important;
	min-height: 14rem !important;
	padding: 1rem !important;
	font-size: 1rem !important;
	line-height: 1.625 !important;
	resize: vertical !important;
}

.wp-site-blocks select,
.dhyan-wc-page .woocommerce form select {
	appearance: none !important;
	padding-right: 2.25rem !important;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748B' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m19.5 8.25-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E") !important;
	background-repeat: no-repeat !important;
	background-position: right 0.75rem center !important;
	background-size: 0.875rem !important;
}

.wp-site-blocks :is(input, select, textarea):focus,
.wp-site-blocks :is(input, select, textarea):focus-visible,
.dhyan-wc-page .woocommerce form :is(input, select, textarea):focus,
.dhyan-wc-page .woocommerce form :is(input, select, textarea):focus-visible {
	border-color: var(--dhyan-color-accent) !important;
	outline: none !important;
	box-shadow: 0 0 0 2px var(--dhyan-color-background), var(--dhyan-shadow-focus) !important;
}

/* ── Password wrapper ── */
.password-input,
.woocommerce-input-wrapper.password-input,
.dhyan-password-field {
	position: relative !important;
	display: block !important;
	width: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	isolation: isolate;
}

.password-input input,
.dhyan-password-field input,
.woocommerce-input-wrapper.password-input input {
	position: relative !important;
	z-index: var(--dhyan-z-base) !important;
	padding-right: 2.5rem !important;
}

/* Hide misplaced WC toggle buttons outside the wrapper */
.form-row > button.show-password-input,
.woocommerce-form-row > button.show-password-input,
p.form-row > button.show-password-input {
	display: none !important;
}

button.show-password-input,
button.dhyan-password-toggle {
	position: absolute !important;
	right: 0.5rem !important;
	top: 50% !important;
	left: auto !important;
	bottom: auto !important;
	z-index: var(--dhyan-z-dropdown) !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 2rem !important;
	height: 2rem !important;
	min-width: 2rem !important;
	min-height: 2rem !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0.375rem !important;
	background-color: transparent !important;
	pointer-events: auto !important;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748B' stroke-width='1.75'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z'/%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z'/%3E%3C/svg%3E") !important;
	background-repeat: no-repeat !important;
	background-position: center !important;
	background-size: 1.125rem !important;
	box-shadow: none !important;
	color: transparent !important;
	font-size: 0 !important;
	line-height: 0 !important;
	overflow: hidden !important;
	cursor: pointer !important;
	transform: translateY(-50%) !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}

button.show-password-input::before,
button.show-password-input::after,
button.dhyan-password-toggle::before,
button.dhyan-password-toggle::after {
	display: none !important;
	content: none !important;
}

button.show-password-input:hover,
button.dhyan-password-toggle:hover {
	background-color: var(--dhyan-color-surface) !important;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748B' stroke-width='1.75'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z'/%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z'/%3E%3C/svg%3E") !important;
}

button.show-password-input:focus-visible,
button.dhyan-password-toggle:focus-visible {
	overflow: visible !important;
	outline: 2px solid var(--dhyan-color-primary) !important;
	outline-offset: 2px !important;
	background-color: var(--dhyan-color-surface) !important;
	box-shadow: var(--dhyan-shadow-focus-primary) !important;
}

button.show-password-input.is-visible,
button.dhyan-password-toggle.is-visible {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2300a3a3' stroke-width='1.75'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88'/%3E%3C/svg%3E") !important;
}

.woocommerce-password-strength,
.woocommerce-password-hint,
small.woocommerce-password-hint {
	display: none !important;
	height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	overflow: hidden !important;
}

/* WooCommerce buttons must not style password toggles */
.dhyan-wc-page .woocommerce button.show-password-input,
.dhyan-wc-page .woocommerce button.dhyan-password-toggle {
	background-color: transparent !important;
	color: transparent !important;
}

/* Form row layout */
.dhyan-wc-page .woocommerce form .form-row,
.woocommerce-MyAccount-content form .form-row {
	margin-bottom: 0.875rem !important;
}

.dhyan-wc-page .woocommerce form label,
.woocommerce-MyAccount-content form label {
	display: block !important;
	margin-bottom: 0.375rem !important;
	font-size: 0.875rem !important;
	font-weight: 500 !important;
	color: var(--dhyan-color-foreground) !important;
}

.woocommerce-MyAccount-content fieldset {
	margin-top: 1.25rem !important;
	padding: 1rem 1.25rem !important;
	border: var(--dhyan-border-width) solid var(--dhyan-color-border) !important;
	border-radius: var(--dhyan-radius-lg) !important;
	background: var(--dhyan-color-surface) !important;
}

.woocommerce-MyAccount-content fieldset legend {
	padding: 0 0.25rem !important;
	font-size: 0.875rem !important;
	font-weight: 600 !important;
}

/* Select2 / SelectWoo (country & state) — override WooCommerce .woocommerce-page padding */
.woocommerce-page form .form-row .select2-container,
.dhyan-wc-page .woocommerce form .form-row .select2-container,
.woocommerce-MyAccount-content form .form-row .select2-container,
.select2-container {
	width: 100% !important;
	max-width: 100% !important;
}

.woocommerce-page form .form-row .select2-container .select2-selection--single,
.dhyan-wc-page .woocommerce form .form-row .select2-container .select2-selection--single,
.woocommerce-MyAccount-content form .form-row .select2-container .select2-selection--single,
.select2-container--default .select2-selection--single {
	box-sizing: border-box !important;
	display: flex !important;
	align-items: center !important;
	height: 2.5rem !important;
	min-height: 2.5rem !important;
	border: var(--dhyan-border-width) solid var(--dhyan-color-border) !important;
	border-radius: var(--dhyan-radius-sm) !important;
	background: var(--dhyan-color-background) !important;
	box-shadow: none !important;
}

.woocommerce-page form .form-row .select2-container .select2-selection--single .select2-selection__rendered,
.dhyan-wc-page .woocommerce form .form-row .select2-container .select2-selection--single .select2-selection__rendered,
.woocommerce-MyAccount-content form .form-row .select2-container .select2-selection--single .select2-selection__rendered,
.select2-container--default .select2-selection--single .select2-selection__rendered {
	display: block !important;
	flex: 1 1 auto !important;
	width: 100% !important;
	height: 2.5rem !important;
	padding: 0 2rem 0 0.875rem !important;
	line-height: 2.5rem !important;
	font-size: 0.875rem !important;
	color: var(--dhyan-color-foreground) !important;
}

.woocommerce-page form .form-row .select2-container .select2-selection--single .select2-selection__placeholder,
.dhyan-wc-page .woocommerce form .form-row .select2-container .select2-selection--single .select2-selection__placeholder,
.select2-container--default .select2-selection__placeholder {
	color: var(--dhyan-color-footer-muted) !important;
	line-height: 2.5rem !important;
}

.woocommerce-page form .form-row .select2-container .select2-selection--single .select2-selection__arrow,
.dhyan-wc-page .woocommerce form .form-row .select2-container .select2-selection--single .select2-selection__arrow,
.woocommerce-MyAccount-content form .form-row .select2-container .select2-selection--single .select2-selection__arrow,
.select2-container--default .select2-selection--single .select2-selection__arrow {
	position: absolute !important;
	top: 0 !important;
	right: 0.5rem !important;
	height: 2.5rem !important;
	width: 1.25rem !important;
}

.woocommerce-page form .form-row .select2-container .select2-selection--single .select2-selection__arrow b,
.select2-container--default .select2-selection--single .select2-selection__arrow b {
	display: none !important;
}

.woocommerce-page form .form-row .select2-container.select2-container--focus .select2-selection--single,
.woocommerce-page form .form-row .select2-container.select2-container--open .select2-selection--single,
.dhyan-wc-page .woocommerce form .form-row .select2-container.select2-container--focus .select2-selection--single,
.dhyan-wc-page .woocommerce form .form-row .select2-container.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
	border-color: var(--dhyan-color-accent) !important;
	outline: none !important;
	box-shadow: 0 0 0 2px var(--dhyan-color-background), var(--dhyan-shadow-focus) !important;
}

.select2-dropdown {
	border: var(--dhyan-border-width) solid var(--dhyan-color-border) !important;
	border-radius: var(--dhyan-radius-sm) !important;
	box-shadow: 0 8px 24px -12px rgb(var(--dhyan-color-foreground-rgb) / 0.18) !important;
	overflow: hidden !important;
}

.select2-results__option {
	padding: 0.5rem 0.875rem !important;
	font-size: 0.875rem !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
	background: var(--dhyan-color-primary-soft) !important;
	color: var(--dhyan-color-foreground) !important;
}
