/**
 * Codehouse B2B — pricing frontend styles.
 *
 * Two surfaces share this file (it is enqueued storefront-wide):
 *   1. The "Your B2B price" badge on PLP/PDP/cart/checkout (unchanged).
 *   2. The "Your prices" My-Account endpoint — search, controls, table,
 *      savings chip and pagination (restyled to the at-theme design system).
 *
 * Account-page form controls (inputs / selects / buttons) live in the shared
 * account-ui.css; this file only carries the price-specific layout.
 */

/* ===================================================================== */
/* Storefront badge (PLP / PDP / cart / checkout)                        */
/* ===================================================================== */

.ch-b2b-price-badge {
	display: inline-block;
	margin-left: 0.5em;
	padding: 0.15em 0.5em;
	font-size: var( --wp--preset--font-size--body-sm, 0.8125rem );
	font-weight: 600;
	line-height: 1.4;
	color: #1d2327;
	background: #e6f1fa;
	border-radius: 2px;
	vertical-align: middle;
}

.ch-b2b-regular-price {
	display: block;
	margin-top: 0.15em;
	font-size: 0.8em;
	font-weight: 400;
	color: #565657;
}

.ch-b2b-refresh-status {
	margin-left: 0.5em;
	font-size: 0.9em;
}

.ch-b2b-refresh-status.is-loading {
	color: #565657;
}

.ch-b2b-refresh-status.is-ok {
	color: #1a7f37;
}

.ch-b2b-refresh-status.is-error {
	color: #d63638;
}

.ch-b2b-refresh-prices.is-busy {
	opacity: 0.7;
	cursor: progress;
}

.ch-b2b-refresh-prices.is-busy::after {
	content: "";
	display: inline-block;
	width: 0.85em;
	height: 0.85em;
	margin-left: 0.5em;
	vertical-align: -0.1em;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: ch-b2b-spin 0.6s linear infinite;
}

@keyframes ch-b2b-spin {
	to {
		transform: rotate( 360deg );
	}
}

.ch-b2b-quote-link {
	display: inline-block;
	padding: 0.5em 1em;
	font-weight: 600;
	color: #fff;
	background: #0071ce;
	border: 1px solid #004e8c;
	border-radius: 2px;
	text-decoration: none;
}

.ch-b2b-quote-link:hover,
.ch-b2b-quote-link:focus {
	background: #004e8c;
	color: #fff;
}

.ch-b2b-price-on-request {
	display: inline-block;
	font-weight: 600;
	color: #555;
}

/* ===================================================================== */
/* "Your prices" My-Account endpoint                                     */
/* ===================================================================== */

/* ---- Toolbar: search (left, grows) + actions (right) ------------------ */

.ch-b2b-my-prices-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 1.25rem;
}

/* Search box takes the free space on the left; actions sit flush right. */
.ch-b2b-my-prices-toolbar .ch-b2b-my-prices-search {
	flex: 1 1 18rem;
	max-width: none;
	margin: 0;
}

.ch-b2b-my-prices-toolbar .ch-b2b-my-prices-controls {
	flex: 0 0 auto;
	margin: 0 0 0 auto;
}

/* ---- Controls row (Refresh + Export) ---------------------------------- */

.ch-b2b-my-prices-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 1.5rem;
}

.ch-b2b-my-prices-form {
	margin: 0;
}

.ch-b2b-refresh-wrap {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

/* ---- Search ----------------------------------------------------------- */

.ch-b2b-my-prices-search {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	max-width: 34rem;
	margin-bottom: 1.25rem;
}

.ch-b2b-my-prices-search input[type="search"] {
	flex: 1 1 16rem;
}

.ch-b2b-my-prices-search-clear {
	font-size: 0.8125rem;
	color: var( --wp--preset--color--original-blue, #0071ce );
	text-decoration: none;
}

.ch-b2b-my-prices-search-clear:hover,
.ch-b2b-my-prices-search-clear:focus {
	text-decoration: underline;
}

/* ---- Table ------------------------------------------------------------ */

.ch-b2b-my-prices-tablewrap {
	overflow-x: 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--subtle, 0 1px 2px rgba( 0, 0, 0, 0.04 ) );
}

table.ch-b2b-my-prices {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	font-size: var( --wp--preset--font-size--body-sm, 0.875rem );
}

/* Neutralise WooCommerce's .shop_table own borders so they don't stack with
   the single hairline divider defined below (otherwise rows read as ~2px). */
.woocommerce-account table.ch-b2b-my-prices,
.woocommerce-account table.ch-b2b-my-prices th,
.woocommerce-account table.ch-b2b-my-prices td,
.woocommerce-account table.ch-b2b-my-prices tr {
	border: 0;
}

.woocommerce-account table.ch-b2b-my-prices thead th {
	padding: 0.85rem 1rem;
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	text-align: left;
	white-space: nowrap;
	color: var( --wp--preset--color--dark-grey, #565657 );
	background: var( --wp--preset--color--lightest-grey, #fafafa );
	border-bottom: 1px solid var( --wp--preset--color--light-grey, #e5e5e5 );
}

.woocommerce-account table.ch-b2b-my-prices tbody td {
	padding: 0.8rem 1rem;
	vertical-align: middle;
	color: var( --wp--preset--color--black, #101012 );
	border-bottom: 1px solid var( --wp--preset--color--light-grey, #e5e5e5 );
}

.ch-b2b-my-prices tbody tr {
	transition: background-color var( --wp--custom--transition--fast, 150ms ease );
}

.ch-b2b-my-prices tbody tr:hover {
	background: var( --wp--preset--color--light-blue, #e6f1fa );
}

.woocommerce-account table.ch-b2b-my-prices tbody tr:last-child td {
	border-bottom: 0;
}

/* SKU column — tabular, muted. */
.ch-b2b-my-prices td:first-child {
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
	color: var( --wp--preset--color--dark-grey, #565657 );
}

/* Numeric columns (Your price, Regular price, Savings) — right aligned. */
.ch-b2b-my-prices th:nth-child( n + 3 ),
.ch-b2b-my-prices td:nth-child( n + 3 ) {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* "Your price" — emphasised. */
.ch-b2b-my-prices td:nth-child( 3 ) {
	font-weight: 600;
}

/* "Regular price" — muted. */
.ch-b2b-my-prices td:nth-child( 4 ) {
	color: var( --wp--preset--color--dark-grey, #565657 );
}

.ch-b2b-my-prices-savings {
	display: inline-block;
	padding: 0.15em 0.55em;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	color: #0a7d3f;
	background: #e7f6ee;
	border-radius: var( --wp--custom--border-radius--pill, 36px );
}

.ch-b2b-my-prices-count {
	margin-top: 0.85rem;
	font-size: 0.8125rem;
	color: var( --wp--preset--color--dark-grey, #565657 );
}

.ch-b2b-my-prices-empty {
	margin: 1rem 0;
	color: var( --wp--preset--color--dark-grey, #565657 );
}

/* ---- Pagination ------------------------------------------------------- */

.ch-b2b-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin-top: 1.25rem;
}

.ch-b2b-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.25rem;
	min-height: 2.25rem;
	padding: 0 0.6rem;
	font-size: var( --wp--preset--font-size--body-sm, 0.875rem );
	color: var( --wp--preset--color--original-blue, #0071ce );
	text-decoration: none;
	border: 1px solid var( --wp--preset--color--light-grey, #e5e5e5 );
	border-radius: var( --wp--custom--border-radius--default, 0 );
	transition: background-color var( --wp--custom--transition--fast, 150ms ease ),
		border-color var( --wp--custom--transition--fast, 150ms ease );
}

.ch-b2b-pagination .page-numbers:hover {
	background: var( --wp--preset--color--lightest-grey, #fafafa );
	border-color: var( --wp--preset--color--dark-grey, #565657 );
}

.ch-b2b-pagination .page-numbers.current {
	color: var( --wp--preset--color--white, #fff );
	background: var( --wp--preset--color--original-blue, #0071ce );
	border-color: var( --wp--preset--color--original-blue, #0071ce );
}

.ch-b2b-pagination .page-numbers.dots {
	border-color: transparent;
}
