.cel-tax-list {
	max-width: 1200px;
	text-align: left;
}

/*
 * Flex row: search box on the left, "Show all X" toggle pushed to the far
 * right via margin-left: auto on the button itself (works whether the
 * toggle is the only child or sits next to the search box) — wraps onto
 * its own line under narrow/mobile widths since there's no title anymore
 * to keep it visually anchored to.
 */
.cel-tax-list-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
	margin-bottom: 20px;
}

.cel-tax-list-search-wrap {
	position: relative;
	flex: 1 1 240px;
	max-width: 320px;
}

.cel-tax-list-search-icon {
	position: absolute;
	top: 50%;
	left: 12px;
	width: 14px;
	height: 14px;
	margin-top: -8px;
	border: 2px solid #999;
	border-radius: 50%;
	pointer-events: none;
}

.cel-tax-list-search-icon::after {
	content: "";
	position: absolute;
	right: -6px;
	bottom: -6px;
	width: 6px;
	height: 2px;
	background: #999;
	transform: rotate(45deg);
}

/*
 * Scoped under .cel-tax-list-search-wrap + the element type (not just the
 * bare .cel-tax-list-search class) to outrank the theme's own
 * `input[type="text"] { padding: 10px; width: 230px; ... }` rule — that
 * selector's specificity (0,0,1,1) otherwise beats a single class selector
 * (0,0,1,0) regardless of stylesheet order, silently overriding our
 * padding-left (needed to clear the search icon) and width.
 */
.cel-tax-list-search-wrap input.cel-tax-list-search {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 14px 10px 34px;
	margin: 0;
	border: 1px solid #ccc;
	border-radius: 6px;
	background: #fff;
	font-size: 14px;
	font-family: inherit;
}

.cel-tax-list-grid {
	display: grid;
	grid-template-columns: repeat(var(--cel-tax-columns, 4), 1fr);
	gap: 14px;
}

.cel-tax-list-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 14px;
	border: 1px solid #e2e2e2;
	border-radius: 8px;
	background: #fff;
	text-decoration: none !important;
	color: inherit;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
	/*
	 * A grid item's default min-width is `auto` (based on its content's
	 * intrinsic size), same gotcha as a flex item — without this, a long
	 * term name can force the card wider than its grid column instead of
	 * shrinking to it, throwing off the whole row. This lets it shrink to
	 * the column's actual width so .cel-tax-list-item-name's own
	 * overflow/ellipsis (below) can actually take effect.
	 */
	min-width: 0;
}

/*
 * The browser's own `[hidden] { display: none; }` rule has the same
 * specificity as `.cel-tax-list-item { display: flex; }` above, and author
 * stylesheet rules always beat user-agent rules on a specificity tie — so
 * without this, setting the `hidden` attribute via JS silently did nothing
 * visually; the item kept rendering as a flex box regardless. Confirmed via
 * live debugging: item.hidden was toggling correctly the whole time, but
 * computed display stayed "flex" until this rule was added.
 */
.cel-tax-list-item[hidden] {
	display: none;
}

.cel-tax-list-item:hover,
.cel-tax-list-item:focus-visible {
	border-color: #2b6cb0;
	background: #f7fafc;
	box-shadow: 0 2px 8px rgba(43, 108, 176, 0.12);
}

.cel-tax-list-item-name {
	min-width: 0;
	font-weight: 600;
	font-size: 15px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cel-tax-list-item-parent {
	font-weight: 400;
	color: #888;
}

.cel-tax-list-item-arrow {
	flex-shrink: 0;
	color: #2b6cb0;
	font-size: 16px;
	transition: transform 0.15s ease;
}

.cel-tax-list-item:hover .cel-tax-list-item-arrow,
.cel-tax-list-item:focus-visible .cel-tax-list-item-arrow {
	transform: translateX(3px);
}

.cel-tax-list-empty {
	color: #777;
	padding: 20px 0;
}

/* Scoped under .cel-tax-list for specificity, same reasoning as the search input above. */
.cel-tax-list button.cel-tax-list-toggle {
	display: inline-block;
	flex-shrink: 0;
	margin-left: auto;
	padding: 8px 16px;
	border: 1px solid #ccc;
	border-radius: 6px;
	background: #fff;
	color: #2b6cb0;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
	white-space: nowrap;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.cel-tax-list button.cel-tax-list-toggle:hover {
	border-color: #2b6cb0;
	background: #f7fafc;
}

@media (max-width: 900px) {
	.cel-tax-list-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 560px) {
	.cel-tax-list-grid {
		grid-template-columns: 1fr;
	}
	.cel-tax-list-search-wrap {
		max-width: none;
	}
	.cel-tax-list button.cel-tax-list-toggle {
		margin-left: 0;
		width: 100%;
		text-align: center;
	}
}
