/*
 * Schools directory shortcode styles.
 * Loaded by IMC_Members_Directory only on pages containing the shortcode.
 */

.imc-directory {
	max-width: 1400px;
	margin: 1.5em auto;
	padding: 0 1em;
}

/* Map (full width above the list) */

.imc-directory__map-wrap {
	margin-bottom: 1.5em;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.imc-directory__map {
	height: 480px;
	width: 100%;
	background: #eef2f5;
}

/* Desktop: full-width map on top, sticks below fixed site header (offset via JS) */
@media (min-width: 901px) {
	.imc-directory__map-wrap {
		position: sticky;
		top: var(--imc-directory-sticky-top, 0px);
		z-index: 90;
		margin-bottom: 1.5em;
		background: #fff;
		box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	}

	.imc-directory__map {
		height: min(42vh, 440px);
		min-height: 280px;
	}
}

.imc-directory__noscript {
	padding: 1em;
	text-align: center;
	color: #555;
}

/* Filter row */

.imc-directory__filters {
	display: grid;
	grid-template-columns: 2fr 1fr 1fr 1fr auto;
	gap: 1em;
	margin-bottom: 1em;
	padding: 1em;
	background: #f7f8fa;
	border-radius: 8px;
}

@media (max-width: 900px) {
	.imc-directory__filters {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 560px) {
	.imc-directory__filters {
		grid-template-columns: 1fr;
	}
}

.imc-directory__filter-label {
	display: block;
	font-size: 0.85em;
	font-weight: 600;
	color: #555;
	margin-bottom: 0.35em;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.imc-directory__filter--search .facetwp-search {
	width: 100%;
	padding: 0.55em 0.75em;
	border: 1px solid #ccd2d8;
	border-radius: 4px;
	font-size: 1em;
}

.imc-directory__filter--reset {
	display: flex;
	align-items: flex-end;
}

.facetwp-reset {
	padding: 0.55em 0.9em;
	background: transparent;
	border: 1px solid #ccd2d8;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.9em;
	color: #444;
}

.facetwp-reset:hover {
	background: #e9ecef;
}

/* Summary line */

.imc-directory__summary {
	margin: 0 0 1em;
	color: #666;
	font-size: 0.9em;
}

/* Results list */

.imc-directory__results {
	min-height: 200px;
}

.imc-directory__country-group {
	margin-bottom: 2rem;
}

.imc-directory__country-group:last-child {
	margin-bottom: 0;
}

.imc-directory__country-heading {
	display: flex;
	align-items: baseline;
	gap: 0.5em;
	margin: 0 0 0.85em;
	padding-bottom: 0.45em;
	border-bottom: 2px solid #e3e6ea;
	font-size: 1.35rem;
	font-weight: 700;
	color: #222;
}

.imc-directory__country-count {
	font-size: 0.75em;
	font-weight: 600;
	color: #666;
}

.imc-directory__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1em;
}

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

@media (max-width: 560px) {
	.imc-directory__grid {
		grid-template-columns: 1fr;
	}
}

.imc-directory__card {
	background: #fff;
	border: 1px solid #e3e6ea;
	border-radius: 8px;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.imc-directory__card:hover {
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.07);
	transform: translateY(-1px);
}

.imc-directory__card-link {
	display: flex;
	gap: 0.85em;
	padding: 0.9em;
	text-decoration: none;
	color: inherit;
}

.imc-directory__card-logo {
	flex-shrink: 0;
	width: 64px;
	height: 64px;
	border-radius: 6px;
	background: #f1f3f5;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.imc-directory__card-logo img {
	max-width: 100%;
	max-height: 100%;
	height: auto;
	width: auto;
	display: block;
}

.imc-directory__card-logo-placeholder {
	font-size: 1.6em;
	font-weight: 700;
	color: #8b949e;
}

.imc-directory__card-body {
	flex: 1;
	min-width: 0;
}

.imc-directory__card-name {
	margin: 0 0 0.2em;
	font-size: 1em;
	font-weight: 600;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.imc-directory__card-location {
	margin: 0 0 0.45em;
	font-size: 0.85em;
	color: #666;
}

.imc-directory__card-types,
.imc-directory__card-ages {
	margin: 0.3em 0 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em;
}

.imc-directory__chip {
	display: inline-block;
	padding: 0.15em 0.5em;
	border-radius: 999px;
	font-size: 0.72em;
	line-height: 1.4;
	white-space: nowrap;
}

.imc-directory__chip--type {
	background: #eef5ff;
	color: #1e4a8a;
}

.imc-directory__chip--age {
	background: #f0f7ed;
	color: #2f6b21;
}

/* Accredited type chip: black text on yellow, with the gold seal inline. */
.imc-directory__chip--accredited {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	background: #f6c945;
	color: #1a1a1a;
	font-weight: 600;
}

.imc-directory__chip--accredited .imc-directory__accredited {
	margin: 0;
}

.imc-directory__chip--accredited .imc-directory__accredited svg {
	width: 1em;
	height: 1em;
}

/* Empty + pagination */

.imc-directory__empty {
	text-align: center;
	padding: 3em 1em;
	color: #666;
}

.imc-directory__pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 1em;
	margin-top: 1.5em;
}

/* Popup */

.imc-directory-popup {
	display: flex;
	gap: 0.75em;
	min-width: 200px;
}

.imc-directory-popup__logo {
	width: 50px;
	height: 50px;
	object-fit: contain;
	border-radius: 4px;
	flex-shrink: 0;
}

.imc-directory-popup__name {
	display: block;
	font-size: 0.95em;
	margin-bottom: 0.15em;
}

.imc-directory-popup__location {
	font-size: 0.8em;
	color: #666;
	margin-bottom: 0.45em;
}

.imc-directory-popup__link {
	font-size: 0.85em;
	font-weight: 500;
}

/* Accredited badge shown next to the school name in listing cards. */
.imc-directory__accredited {
	display: inline-flex;
	vertical-align: middle;
	margin-left: 0.35em;
	line-height: 0;
}

.imc-directory__accredited svg {
	width: 1.1em;
	height: 1.1em;
	filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

/* Custom SVG markers (Leaflet divIcon). Strip the default .leaflet-div-icon
   white box/border so only the SVG pin/star shows. */
.imc-marker {
	background: transparent;
	border: 0;
}

.imc-marker__svg {
	display: block;
	filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.4));
}

/* Map legend: accredited (gold star) vs member (blue pin) */
.imc-directory-legend {
	background: rgba(255, 255, 255, 0.95);
	border-radius: 6px;
	padding: 7px 10px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
	font-size: 0.8rem;
	line-height: 1.2;
	color: #1f2937;
}

.imc-directory-legend__item {
	display: flex;
	align-items: center;
	gap: 6px;
}

.imc-directory-legend__item + .imc-directory-legend__item {
	margin-top: 4px;
}

.imc-directory-legend__icon {
	display: inline-flex;
	width: 22px;
	justify-content: center;
}

.imc-directory-legend__icon svg {
	width: auto;
	height: 22px;
}

/* Hover affordance from card → marker (no transform — Leaflet positions via transform) */

.leaflet-marker-icon.imc-directory-marker--highlight {
	z-index: 10000 !important;
	filter:
		hue-rotate(165deg) saturate(2.4) brightness(1.08) contrast(1.1)
		drop-shadow(0 0 0 6px rgba(230, 81, 0, 0.95))
		drop-shadow(0 0 18px rgba(255, 152, 0, 0.95))
		drop-shadow(0 5px 10px rgba(0, 0, 0, 0.45));
	animation: imc-directory-marker-pulse 1.1s ease-in-out infinite;
}

@keyframes imc-directory-marker-pulse {
	0%,
	100% {
		filter:
			hue-rotate(165deg) saturate(2.4) brightness(1.08) contrast(1.1)
			drop-shadow(0 0 0 5px rgba(230, 81, 0, 0.9))
			drop-shadow(0 0 14px rgba(255, 152, 0, 0.85))
			drop-shadow(0 5px 10px rgba(0, 0, 0, 0.4));
	}
	50% {
		filter:
			hue-rotate(165deg) saturate(2.6) brightness(1.15) contrast(1.15)
			drop-shadow(0 0 0 9px rgba(230, 81, 0, 1))
			drop-shadow(0 0 24px rgba(255, 193, 7, 1))
			drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
	}
}

/* Pulsing ring drawn under the pin while a school is focused */
.imc-directory-marker-ring {
	animation: imc-directory-ring-pulse 1.1s ease-in-out infinite;
}

@keyframes imc-directory-ring-pulse {
	0%,
	100% {
		stroke-width: 4;
		stroke-opacity: 1;
		fill-opacity: 0.28;
	}
	50% {
		stroke-width: 6;
		stroke-opacity: 1;
		fill-opacity: 0.42;
	}
}

/* Tie the active list card to the highlighted pin */
.imc-directory__card.is-map-focused {
	border-color: #e65100;
	box-shadow: 0 0 0 2px rgba(230, 81, 0, 0.35), 0 6px 16px rgba(230, 81, 0, 0.18);
}

/* ---------- Modal ---------- */

body.imc-directory-modal-open {
	overflow: hidden;
}

.imc-directory__card {
	cursor: pointer;
}

.imc-directory-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.imc-directory-modal[hidden] {
	display: none;
}

.imc-directory-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(20, 20, 30, 0.65);
	backdrop-filter: blur(2px);
	animation: imc-modal-fade 160ms ease-out;
}

.imc-directory-modal__dialog {
	position: relative;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
	max-width: 720px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	animation: imc-modal-pop 180ms ease-out;
}

@keyframes imc-modal-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes imc-modal-pop {
	from { opacity: 0; transform: translateY(8px) scale(0.98); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

.imc-directory-modal__close {
	position: sticky;
	top: 8px;
	float: right;
	margin: 8px 8px 0 0;
	width: 36px;
	height: 36px;
	font-size: 24px;
	line-height: 1;
	border: 0;
	background: rgba(255, 255, 255, 0.95);
	border-radius: 50%;
	cursor: pointer;
	color: #333;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
}

.imc-directory-modal__close:hover,
.imc-directory-modal__close:focus {
	background: #fff;
	color: #000;
	outline: 2px solid #4a90e2;
	outline-offset: 2px;
}

.imc-directory-modal__content {
	padding: 1.5rem 1.75rem 1.75rem;
	clear: both;
}

.imc-directory-modal__loading,
.imc-directory-modal__error {
	text-align: center;
	color: #666;
	padding: 2rem 0;
}

.imc-directory-modal__error {
	color: #b00020;
}

/* Profile content */

.imc-directory-profile__header {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1.25rem;
	padding-right: 2.5rem; /* breathing room next to close button */
}

.imc-directory-profile__logo img {
	max-width: 90px;
	height: auto;
	border-radius: 6px;
	display: block;
}

.imc-directory-profile__title {
	margin: 0;
	font-size: 1.5rem;
	line-height: 1.2;
}

.imc-directory-profile__details {
	margin: 0 0 1.25rem;
}

.imc-directory-profile__details-list {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.45rem 1rem;
	margin: 0;
}

.imc-directory-profile__details-list dt {
	font-weight: 600;
	color: #555;
}

.imc-directory-profile__details-list dd {
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35em;
}

.imc-directory-profile__description {
	margin: 0 0 1.5rem;
	color: #333;
	line-height: 1.55;
}

.imc-directory-profile__description p:last-child {
	margin-bottom: 0;
}

.imc-directory-profile__section-title {
	font-size: 1rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #555;
	margin: 0 0 0.5rem;
}

.imc-directory-profile__map {
	width: 100%;
	height: 280px;
	margin: 0 0 1.25rem;
	border-radius: 6px;
	overflow: hidden;
	background: #f5f5f5;
}

.imc-directory-profile__contact {
	border-top: 1px solid #eee;
	padding-top: 1rem;
	margin-bottom: 1.25rem;
}

.imc-directory-profile__contact-list {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.4rem 1rem;
	margin: 0;
}

.imc-directory-profile__contact-list dt {
	font-weight: 600;
	color: #555;
}

.imc-directory-profile__contact-list dd {
	margin: 0;
	color: #222;
	word-break: break-word;
}

.imc-directory-profile__permalink {
	margin: 0;
	font-size: 0.9rem;
	text-align: right;
}

@media (max-width: 540px) {
	.imc-directory-modal {
		padding: 0;
	}
	.imc-directory-modal__dialog {
		border-radius: 0;
		max-height: 100vh;
		height: 100vh;
	}
	.imc-directory-modal__content {
		padding: 1.25rem;
	}
	.imc-directory-profile__contact-list {
		grid-template-columns: 1fr;
		gap: 0.1rem 0;
	}
	.imc-directory-profile__contact-list dt {
		margin-top: 0.5rem;
	}
	.imc-directory-profile__map {
		height: 220px;
	}
}
