/**
 * Newfield Coach Directory
 * Colours come from Settings → Coach Directory (CSS variables on .nnf-dir);
 * the Elementor widget's Style tab overrides them per widget.
 */

.nnf-dir {
	--nnf-dir-cols: var(--nnf-dir-cols-d, 4);
	--nnf-dir-gap: 20px;
	--nnf-dir-radius: 6px;
	--nnf-dir-line: rgba(75, 74, 107, 0.25);
	position: relative;
	color: var(--nnf-dir-name, #4b4a6b);
}

@media (max-width: 1024px) {
	.nnf-dir { --nnf-dir-cols: var(--nnf-dir-cols-t, 2); }
}

@media (max-width: 767px) {
	.nnf-dir { --nnf-dir-cols: var(--nnf-dir-cols-m, 1); }
}

.nnf-dir *,
.nnf-dir *::before,
.nnf-dir *::after {
	box-sizing: border-box;
}

.nnf-dir [hidden] {
	display: none !important;
}

.nnf-dir .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Filter bar ---------- */

.nnf-dir__filters {
	margin: 0 0 18px;
	padding: 18px;
	background: #fff;
	border: 1px solid var(--nnf-dir-line);
	border-radius: var(--nnf-dir-radius);
}

.nnf-dir__fields {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 14px 16px;
	align-items: end;
}

/* "Filters & sort" toggle — phones only */
.nnf-dir__toggle {
	display: none;
	width: 100%;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	color: var(--nnf-dir-name, #4b4a6b);
	background: #fff;
	border: 1px solid var(--nnf-dir-line);
	border-radius: 4px;
	cursor: pointer;
}

.nnf-dir__badge {
	min-width: 22px;
	margin-left: auto;
	padding: 1px 7px;
	font-size: 12px;
	line-height: 20px;
	text-align: center;
	color: #fff;
	background: var(--nnf-dir-name, #4b4a6b);
	border-radius: 999px;
}

.nnf-dir__toggle::after {
	content: "";
	width: 10px;
	height: 10px;
	margin-left: 12px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-3px) rotate(45deg);
	transition: transform 0.2s ease;
}

.nnf-dir__filters.is-open .nnf-dir__toggle::after {
	transform: translateY(2px) rotate(-135deg);
}

.nnf-dir__field {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.nnf-dir__field > label,
.nnf-dir__label {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--nnf-dir-name, #4b4a6b);
}

.nnf-dir__field select,
.nnf-dir__field input[type="search"],
.nnf-dir-ms summary {
	width: 100%;
	min-height: 42px;
	margin: 0;
	padding: 8px 36px 8px 12px;
	font: inherit;
	font-size: 14px;
	line-height: 1.4;
	color: #2b2a3d;
	background-color: #fff;
	border: 1px solid var(--nnf-dir-line);
	border-radius: 4px;
	box-shadow: none;
}

.nnf-dir__field input[type="search"] {
	padding-right: 12px;
}

.nnf-dir__field select,
.nnf-dir-ms summary {
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%234b4a6b' stroke-width='1.6' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	cursor: pointer;
}

.nnf-dir__field select:focus-visible,
.nnf-dir__field input[type="search"]:focus-visible,
.nnf-dir-ms summary:focus-visible,
.nnf-dir button:focus-visible,
.nnf-dir a:focus-visible {
	outline: 2px solid var(--nnf-dir-subtitle, #c39a4a);
	outline-offset: 2px;
}

/* Multi-select dropdown (details/summary) */

.nnf-dir-ms {
	position: relative;
}

.nnf-dir-ms summary {
	display: flex;
	align-items: center;
	list-style: none;
}

.nnf-dir-ms__value {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.nnf-dir-ms summary::-webkit-details-marker {
	display: none;
}

.nnf-dir-ms.has-value summary {
	border-color: var(--nnf-dir-name, #4b4a6b);
	font-weight: 600;
}

.nnf-dir-ms__panel {
	position: absolute;
	z-index: 50;
	top: calc(100% + 4px);
	left: 0;
	width: max(100%, 240px);
	max-height: 300px;
	overflow-y: auto;
	padding: 6px;
	background: #fff;
	border: 1px solid var(--nnf-dir-line);
	border-radius: 4px;
	box-shadow: 0 12px 30px rgba(31, 30, 52, 0.15);
	overscroll-behavior: contain;
}

.nnf-dir-ms__opt {
	display: flex;
	gap: 8px;
	align-items: center;
	padding: 7px 8px;
	font-size: 14px;
	line-height: 1.3;
	color: #2b2a3d;
	border-radius: 3px;
	cursor: pointer;
}

.nnf-dir-ms__opt:hover {
	background: #f4efe8;
}

.nnf-dir-ms__opt input {
	flex: none;
	width: 16px;
	height: 16px;
	margin: 0;
	accent-color: var(--nnf-dir-name, #4b4a6b);
}

/* Actions */

.nnf-dir__actions {
	display: flex;
	gap: 10px;
	align-items: center;
	min-height: 42px;
}

.nnf-dir__apply {
	display: none; /* Only needed without JavaScript. */
}

.no-js .nnf-dir__apply,
.nnf-dir:not(.is-ready) .nnf-dir__apply {
	display: inline-block;
}

.nnf-dir__apply,
.nnf-dir__reset {
	padding: 9px 14px;
	font: inherit;
	font-size: 13px;
	color: var(--nnf-dir-button, #4b4a6b);
	background: transparent;
	border: 0;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.nnf-dir__apply {
	text-decoration: none;
	border: 1px solid var(--nnf-dir-button, #4b4a6b);
	border-radius: 3px;
}

.nnf-dir__count {
	margin: 0 0 14px;
	font-size: 14px;
	color: #6d6c80;
}

/* ---------- Grid ---------- */

.nnf-dir__grid {
	display: grid;
	grid-template-columns: repeat(var(--nnf-dir-cols), minmax(0, 1fr));
	gap: var(--nnf-dir-gap);
	transition: opacity 0.15s ease;
}

.nnf-dir[aria-busy="true"] .nnf-dir__grid {
	opacity: 0.45;
	pointer-events: none;
}

/* ---------- Card ---------- */

.nnf-dir-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	overflow: hidden;
	background: var(--nnf-dir-card-bg, #f4efe8);
	border-radius: var(--nnf-dir-radius);
	box-shadow: 0 2px 10px rgba(31, 30, 52, 0.08);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.nnf-dir-card:hover {
	box-shadow: 0 8px 24px rgba(31, 30, 52, 0.14);
	transform: translateY(-2px);
}

.nnf-dir-card__media {
	display: block;
	aspect-ratio: var(--nnf-dir-ratio, 8/7);
	overflow: hidden;
	background: #e9e3da;
}

.nnf-dir-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	object-position: center 25%;
	border-radius: 0;
}

.nnf-dir-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: flex-start;
	padding: 22px 16px 28px;
}

.nnf-dir-card__name {
	margin: 0 0 24px;
	font-size: 20px;
	font-weight: 400;
	line-height: 1.25;
	color: var(--nnf-dir-name, #4b4a6b);
}

.nnf-dir-card__name a {
	color: inherit;
	text-decoration: none;
}

.nnf-dir-card__name a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.nnf-dir-card__title {
	margin: -18px 0 24px;
	font-size: 12px;
	line-height: 1.45;
	color: var(--nnf-dir-subtitle, #c39a4a);
}

.nnf-dir-card__btn {
	display: inline-block;
	margin-top: auto;
	padding: 6px 15px;
	font-size: 13px;
	line-height: 1.4;
	color: var(--nnf-dir-button, #4b4a6b);
	text-decoration: none;
	background: transparent;
	border: 1px solid var(--nnf-dir-button, #4b4a6b);
	border-radius: 2px;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.nnf-dir-card__btn:hover,
.nnf-dir-card__btn:focus-visible {
	color: #fff;
	background: var(--nnf-dir-button, #4b4a6b);
}

/* ---------- Empty + Load more ---------- */

.nnf-dir__empty {
	margin: 24px 0;
	padding: 28px;
	text-align: center;
	background: #faf8f4;
	border: 1px dashed var(--nnf-dir-line);
	border-radius: var(--nnf-dir-radius);
}

.nnf-dir__more {
	display: flex;
	justify-content: center;
	margin-top: 32px;
}

.nnf-dir__load {
	display: inline-block;
	min-width: 180px;
	padding: 12px 28px;
	font-size: 15px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	color: #fff;
	background: var(--nnf-dir-button, #4b4a6b);
	border: 1px solid var(--nnf-dir-button, #4b4a6b);
	border-radius: 3px;
	cursor: pointer;
}

.nnf-dir__load:hover {
	color: #fff;
	opacity: 0.9;
}

.nnf-dir__load.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

/* ---------- Small screens ---------- */

@media (max-width: 767px) {
	.nnf-dir__filters {
		padding: 0;
		border: 0;
		background: transparent;
	}

	.nnf-dir.is-ready .nnf-dir__toggle {
		display: flex;
	}

	.nnf-dir.is-ready .nnf-dir__fields {
		display: none;
	}

	.nnf-dir.is-ready .nnf-dir__filters.is-open .nnf-dir__fields {
		display: grid;
		margin-top: 10px;
		padding: 14px;
		background: #fff;
		border: 1px solid var(--nnf-dir-line);
		border-radius: 4px;
	}

	.nnf-dir__fields {
		grid-template-columns: 1fr 1fr;
	}

	.nnf-dir__field--search,
	.nnf-dir__actions {
		grid-column: 1 / -1;
	}

	.nnf-dir-ms__panel {
		width: 100%;
	}

	.nnf-dir-card__name {
		font-size: 18px;
	}
}

@media (max-width: 420px) {
	.nnf-dir__fields {
		grid-template-columns: 1fr;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nnf-dir-card,
	.nnf-dir__grid,
	.nnf-dir-card__btn {
		transition: none;
	}

	.nnf-dir-card:hover {
		transform: none;
	}
}
