/**
 * 1🌱 WP Go Maps Certification Filter
 * Checkbox skin mirrors the /vendors-list/ Divi Machine filter:
 * white 22px square, #1d441f checked state with a CSS-drawn white tick.
 */

.msmap-cert-filter {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
}

.msmap-cert-filter *,
.msmap-cert-filter *::before,
.msmap-cert-filter *::after {
	box-sizing: border-box;
}

.msmap-cert-filter__heading {
	margin: 0 0 12px 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
	color: #23471c;
}

.msmap-cert-filter__count {
	margin: 0 0 14px 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.35;
	color: #333;
}

.msmap-cert-filter__count--empty {
	color: #c24f0e;
}

.msmap-cert-filter__loading {
	display: block;
	font-size: 15px;
	color: #888;
	font-style: italic;
}

/* --- option rows --- */
.msmap-cert-filter__list {
	display: grid;
	grid-template-columns: auto auto;
	justify-content: start;
	column-gap: 40px;
	row-gap: 10px;
	align-items: start;
}

/* Collapse to a single column on narrow viewports. */
@media (max-width: 600px) {
	.msmap-cert-filter__list {
		grid-template-columns: 1fr;
	}
}

.msmap-cert-opt {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 0;
	cursor: pointer;
}

/*
 * Defensive: the 1🌱 Divi Machine AND Filter Fix plugin runs site-wide and tags
 * any checkbox whose surrounding module mentions "certification", injecting its
 * own count span. Inside this panel that duplicates our own count, so hide the
 * foreign one here (this rule only loads on pages using this filter).
 */
.msmap-cert-filter .one-seedling-dm-option-count,
.msmap-cert-filter .one-seedling-dm-current-count,
.msmap-cert-filter .one-seedling-dm-no-results {
	display: none !important;
}

/* Real checkbox: clickable but visually replaced by the square below. */
.msmap-cert-opt > input[type="checkbox"] {
	position: absolute;
	left: 0;
	top: 0;
	width: 22px;
	height: 22px;
	margin: 0;
	padding: 0;
	opacity: 0;
	z-index: 3;
	cursor: pointer;
}

/* Visible square. */
.msmap-cert-opt > .msmap-cert-box {
	position: relative;
	z-index: 1;
	flex: 0 0 22px;
	width: 22px;
	height: 22px;
	min-width: 22px;
	margin: 0;
	background: #ffffff;
	border: 2px solid #777777;
	border-radius: 3px;
	pointer-events: none;
	transition: background-color .12s ease, border-color .12s ease;
}

/* Label. */
.msmap-cert-opt > .msmap-cert-label {
	color: #666666;
	font-size: 15px;
	line-height: 1.4;
	cursor: pointer;
}

.msmap-cert-count {
	color: inherit;
	opacity: .7;
	font-weight: 600;
}

/* Checked square. */
.msmap-cert-opt > input[type="checkbox"]:checked + .msmap-cert-box {
	background: #1d441f;
	border-color: #1d441f;
}

/* CSS-drawn tick. */
.msmap-cert-opt > input[type="checkbox"]:checked + .msmap-cert-box::after {
	content: "";
	position: absolute;
	left: 6px;
	top: 2px;
	width: 6px;
	height: 12px;
	border: solid #ffffff;
	border-width: 0 3px 3px 0;
	transform: rotate(45deg);
	box-sizing: border-box;
}

/* Checked label. */
.msmap-cert-opt > input[type="checkbox"]:checked ~ .msmap-cert-label {
	font-weight: 600;
	color: #1d441f;
}

.msmap-cert-opt:hover > .msmap-cert-box {
	border-color: #1d441f;
}

/* Focus ring for keyboard users. */
.msmap-cert-opt > input[type="checkbox"]:focus-visible + .msmap-cert-box {
	outline: 2px solid #23471c;
	outline-offset: 2px;
}

/* --- clear button --- */
.msmap-cert-filter__clear {
	margin: 6px 0 0 0;
	padding: 8px 16px;
	background: #c24f0e;
	color: #ffffff;
	border: 0;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color .12s ease;
}

.msmap-cert-filter__clear:hover {
	background: #a53f08;
}

.msmap-cert-filter__clear[hidden] {
	display: none !important;
}
