/**
 * Codehouse B2B — shared My-Account control styling.
 *
 * One scoped layer for the interactive controls on the Companies and
 * Your-Prices endpoints: text/search inputs, custom-skinned selects, the
 * primary/secondary button pair, the agent typeahead, and WooCommerce
 * notices. Consumes at-theme design tokens (theme.json custom + preset CSS
 * vars) with hex/px fallbacks so the pages still read correctly under other
 * themes.
 *
 * Corners are square by design: the theme's `--border-radius--default`
 * resolves to 0 (Nordic Performance). Only pill chips opt into a radius.
 *
 * Every rule is rooted at `.woocommerce-account` (the body class WooCommerce
 * always sets on My-Account) so it outweighs WC core's own
 * `.woocommerce button.button` / `.input-text` styling, and scoped under
 * .ch-b2b-* so nothing leaks onto the rest of the account chrome.
 */

/* ---- Fields: text, search, select ------------------------------------- */

.woocommerce-account .ch-b2b-my-prices-search input[type="search"],
.woocommerce-account .ch-b2b-company-switcher select,
.woocommerce-account .ch-b2b-agent-view select,
.woocommerce-account .ch-b2b-agent-combobox__input {
	box-sizing: border-box;
	width: 100%;
	min-height: 2.5rem;
	margin: 0;
	padding: 0.5rem 0.75rem;
	font-family: inherit;
	font-size: var( --wp--preset--font-size--body-sm, 0.875rem );
	line-height: 1.4;
	color: var( --wp--preset--color--black, #101012 );
	background-color: var( --wp--preset--color--white, #fff );
	border: 1px solid var( --wp--preset--color--light-grey, #e5e5e5 );
	border-radius: var( --wp--custom--border-radius--default, 0 );
	box-shadow: var( --wp--custom--shadow--subtle, 0 1px 2px rgba( 0, 0, 0, 0.04 ) );
	transition: border-color var( --wp--custom--transition--fast, 150ms ease ),
		box-shadow var( --wp--custom--transition--fast, 150ms ease );
	appearance: none;
	-webkit-appearance: none;
}

.woocommerce-account .ch-b2b-my-prices-search input[type="search"]::placeholder,
.woocommerce-account .ch-b2b-agent-combobox__input::placeholder {
	color: var( --wp--preset--color--dark-grey, #565657 );
	opacity: 0.7;
}

.woocommerce-account .ch-b2b-my-prices-search input[type="search"]:hover,
.woocommerce-account .ch-b2b-company-switcher select:hover,
.woocommerce-account .ch-b2b-agent-view select:hover,
.woocommerce-account .ch-b2b-agent-combobox__input:hover {
	border-color: var( --wp--preset--color--dark-grey, #565657 );
}

.woocommerce-account .ch-b2b-my-prices-search input[type="search"]:focus,
.woocommerce-account .ch-b2b-company-switcher select:focus,
.woocommerce-account .ch-b2b-agent-view select:focus,
.woocommerce-account .ch-b2b-agent-combobox__input:focus {
	outline: none;
	border-color: var( --wp--preset--color--original-blue, #0071ce );
	box-shadow: 0 0 0 3px rgba( 0, 113, 206, 0.15 );
}

/* Custom select chevron — matches the theme's WooCommerce select skin. */
.woocommerce-account .ch-b2b-company-switcher select,
.woocommerce-account .ch-b2b-agent-view select {
	padding-right: 2.25rem;
	cursor: pointer;
	background-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23565657' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E" );
	background-repeat: no-repeat;
	background-position: right 0.65rem center;
	background-size: 14px;
}

/* Search input — leading magnifier glyph. */
.woocommerce-account .ch-b2b-my-prices-search input[type="search"] {
	padding-left: 2.35rem;
	background-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23565657' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E" );
	background-repeat: no-repeat;
	background-position: left 0.7rem center;
	background-size: 16px;
}

/* ---- Buttons: primary / secondary ------------------------------------- */

.woocommerce-account .ch-b2b-btn.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	min-height: 2.5rem;
	margin: 0;
	padding: 0.5rem 1.15rem;
	font-family: inherit;
	font-size: var( --wp--preset--font-size--body-sm, 0.875rem );
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	border: 1px solid transparent;
	border-radius: var( --wp--custom--border-radius--default, 0 );
	cursor: pointer;
	transition: background-color var( --wp--custom--transition--fast, 150ms ease ),
		border-color var( --wp--custom--transition--fast, 150ms ease ),
		color var( --wp--custom--transition--fast, 150ms ease );
}

.woocommerce-account .ch-b2b-btn.button:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba( 0, 113, 206, 0.25 );
}

.woocommerce-account .ch-b2b-btn--primary.button {
	color: var( --wp--preset--color--white, #fff );
	background-color: var( --wp--preset--color--original-blue, #0071ce );
	border-color: var( --wp--preset--color--original-blue, #0071ce );
	box-shadow: var( --wp--custom--shadow--subtle, 0 1px 2px rgba( 0, 0, 0, 0.04 ) );
}

.woocommerce-account .ch-b2b-btn--primary.button:hover,
.woocommerce-account .ch-b2b-btn--primary.button:focus {
	color: var( --wp--preset--color--white, #fff );
	background-color: var( --wp--preset--color--medium-blue, #004e8c );
	border-color: var( --wp--preset--color--medium-blue, #004e8c );
}

.woocommerce-account .ch-b2b-btn--primary.button:active {
	transform: translateY( 1px );
}

.woocommerce-account .ch-b2b-btn--secondary.button {
	color: var( --wp--preset--color--black, #101012 );
	background-color: var( --wp--preset--color--white, #fff );
	border-color: var( --wp--preset--color--light-grey, #e5e5e5 );
	box-shadow: var( --wp--custom--shadow--subtle, 0 1px 2px rgba( 0, 0, 0, 0.04 ) );
}

.woocommerce-account .ch-b2b-btn--secondary.button:hover,
.woocommerce-account .ch-b2b-btn--secondary.button:focus {
	color: var( --wp--preset--color--black, #101012 );
	background-color: var( --wp--preset--color--lightest-grey, #fafafa );
	border-color: var( --wp--preset--color--dark-grey, #565657 );
}

.woocommerce-account .ch-b2b-btn.button[disabled],
.woocommerce-account .ch-b2b-btn.button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
	transform: none;
}

/* ---- Agent typeahead -------------------------------------------------- */

.woocommerce-account .ch-b2b-agent-view {
	margin-top: 1rem;
}

.woocommerce-account .ch-b2b-agent-view h2 {
	margin: 0 0 0.35rem;
	font-size: 1.25rem;
	line-height: 1.2;
}

.woocommerce-account .ch-b2b-agent-view > p {
	margin: 0 0 0.75rem;
	color: var( --wp--preset--color--dark-grey, #565657 );
}

.woocommerce-account .ch-b2b-agent-combobox {
	position: relative;
	max-width: 32rem;
}

.woocommerce-account .ch-b2b-agent-combobox__list {
	list-style: none;
	margin: 0.35rem 0 0;
	padding: 0.25rem;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 20;
	max-height: 18rem;
	overflow-y: auto;
	background: var( --wp--preset--color--white, #fff );
	border: 1px solid var( --wp--preset--color--light-grey, #e5e5e5 );
	border-radius: var( --wp--custom--border-radius--default, 0 );
	box-shadow: var( --wp--custom--shadow--popover, 0 8px 32px rgba( 0, 0, 0, 0.12 ) );
}

.woocommerce-account .ch-b2b-agent-combobox__list:empty {
	display: none;
}

.woocommerce-account .ch-b2b-agent-combobox__item {
	padding: 0.55rem 0.65rem;
	font-size: var( --wp--preset--font-size--body-sm, 0.875rem );
	color: var( --wp--preset--color--black, #101012 );
	cursor: pointer;
	transition: background-color var( --wp--custom--transition--fast, 150ms ease );
}

.woocommerce-account .ch-b2b-agent-combobox__item:hover,
.woocommerce-account .ch-b2b-agent-combobox__item:focus {
	outline: none;
	background: var( --wp--preset--color--light-blue, #e6f1fa );
}

/* ---- WooCommerce notices --------------------------------------------- */

.woocommerce-account .ch-b2b-companies .woocommerce-info,
.woocommerce-account .ch-b2b-companies .woocommerce-message,
.woocommerce-account .ch-b2b-select-required,
.woocommerce-account .ch-b2b-refresh-banner {
	border-radius: var( --wp--custom--border-radius--default, 0 );
}
