/**
 * TendoNova Doctor Finder — public map.
 *
 * BEM-ish class names, all scoped under `.tnd-` so the plugin doesn't fight the host theme.
 * Brand tokens scoped to the component, not :root, so they don't leak.
 */

.tnd-map {
	--tnd-purple: #592e6d;
	--tnd-purple-dark: #43214f;
	--tnd-purple-light: #8B5FBF;
	--tnd-purple-50: #F4EDFB;
	--tnd-purple-100: #E5D4F4;
	--tnd-green: #9AC44E;
	--tnd-green-dark: #7BA63D;
	--tnd-ink: #1a1a2e;
	--tnd-ink-soft: #4a4a5e;
	--tnd-ink-mute: #8888a0;
	--tnd-line: #e8e8ef;
	--tnd-line-soft: #f3f3f7;
	--tnd-bg: #fafafd;
	--tnd-warn: #d49b3c;
	--tnd-warn-bg: #fef9e7;
	--tnd-map-water: #d4e6f1;
	--tnd-map-border: #b5a989;

	--tnd-radius: 14px;          /* match region */
	--tnd-radius-sm: 8px;        /* match region */
	--tnd-shadow-sm: 0 1px 3px rgba(26, 26, 46, 0.05);   /* match region */
	--tnd-shadow-md: 0 6px 22px rgba(94, 44, 142, 0.10); /* match region */

	font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--tnd-ink);
	max-width: 1200px;   /* match the doctor/region container + the nav */
	margin: 0 auto;
	padding: 0;   /* no top padding — header stacks under the nav */
	line-height: 1.45;   /* match region */
}
@media (max-width: 782px) {
	.tnd-map { padding-left: 16px; padding-right: 16px; }
}

.tnd-map *,
.tnd-map *::before,
.tnd-map *::after { box-sizing: border-box; }
/* Force every descendant onto the widget font — overrides the theme's monospace
   `code{}` styling that otherwise leaks into the map markup. */
.tnd-map * { font-family: inherit !important; }
/* Element resets — mirror region.css exactly so buttons and icons render identically
   (without these, UA defaults make the chips taller and the icons display:inline). */
.tnd-map button {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	font-family: inherit;
	line-height: 1.2;
	cursor: pointer;
}
.tnd-map svg { display: inline-block; vertical-align: middle; }

/* --- Header banner (matches the doctor/region banners: solid #592e6d, 35px). --- */
.tnd-map__header {
	background: #592e6d;
	border-radius: 35px;
	padding: 30px 40px;
	margin-bottom: 24px;
	color: #fff;
}
.tnd-map__title {
	font-size: clamp(26px, 3.4vw, 40px);
	font-weight: 800 !important;
	margin: 0;
	letter-spacing: -0.4px;
	color: #fff !important;
}
.tnd-map__subtitle {
	color: rgba(255, 255, 255, 0.92) !important;
	font-size: 15px;
	margin: 0;
}
.tnd-map__subtitle strong { color: #fff !important; }

/* --- Search --- */
.tnd-map__search {
	background: #fff;
	border: 1px solid var(--tnd-line);
	border-radius: var(--tnd-radius);
	padding: 18px;
	box-shadow: var(--tnd-shadow-sm);
	margin-bottom: 14px;
}
.tnd-map__search-row {
	display: grid;
	grid-template-columns: 1fr 1fr auto;
	gap: 12px;
	align-items: end;
}
@media (max-width: 700px) {
	.tnd-map__search-row { grid-template-columns: 1fr; }
}
.tnd-map__search-field { position: relative; min-width: 0; }
.tnd-map__search-field label {
	display: block;
	font-size: 11px;
	font-weight: 700;
	color: var(--tnd-ink-mute);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 6px;
}
/* ZIP label + per-search radius selector share one row above the input. */
.tnd-map__field-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 6px;
	min-height: 17px;
}
.tnd-map__field-head label { margin-bottom: 0; }
.tnd-map__radius {
	border: 1px solid var(--tnd-line);
	border-radius: 999px;
	background: #fff;
	color: var(--tnd-purple);
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	line-height: 1.4;
	cursor: pointer;
	max-width: 55%;
	text-transform: none;
	letter-spacing: 0;
}
.tnd-map__radius:focus-visible { outline: 2px solid var(--tnd-purple); outline-offset: 1px; }
.tnd-map__input-wrap { position: relative; }
.tnd-map__input-wrap > svg {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	width: 16px;
	height: 16px;
	color: var(--tnd-ink-mute);
	pointer-events: none;
}
.tnd-map__search-field input {
	width: 100%;
	border: 1px solid var(--tnd-line);
	border-radius: 999px;
	padding: 11px 16px 11px 38px;
	font-size: 14px;
	outline: none;
	color: var(--tnd-ink);
	background: #fff;
	transition: border-color 0.15s, box-shadow 0.15s;
}
.tnd-map__search-field input:focus {
	border-color: var(--tnd-purple);
	box-shadow: 0 0 0 3px rgba(94, 44, 142, 0.12);
}
.tnd-map__search-actions {
	display: flex;
	gap: 8px;
	align-items: end;
	justify-content: flex-end;
}
.tnd-btn--search, .tnd-btn--near-me { min-height: 44px; white-space: nowrap; }
/* On phones the row collapses to one column — let the two buttons share the width. */
@media (max-width: 700px) {
	.tnd-map__search-actions { width: 100%; }
	.tnd-map__search-actions .tnd-btn { flex: 1 1 0; }
}

.tnd-map__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid var(--tnd-line-soft);
	align-items: center;
}
.tnd-map__chip-label {
	font-size: 11px;
	font-weight: 700;
	color: var(--tnd-ink-mute);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-right: 2px;
}
.tnd-chip {
	padding: 7px 14px;
	border-radius: 999px;
	border: 1px solid var(--tnd-line);
	background: #fff;
	font-size: 13px;
	cursor: pointer;
	transition: all 0.15s;
	color: var(--tnd-ink-soft);
}
.tnd-chip:hover { border-color: var(--tnd-purple); color: var(--tnd-purple); }
.tnd-chip:focus-visible { outline: 2px solid var(--tnd-purple); outline-offset: 2px; }
.tnd-chip--active { background: var(--tnd-purple); color: white; border-color: var(--tnd-purple); }
/* Hovering an active (filled) chip must keep white text — .tnd-chip:hover is more
   specific than .tnd-chip--active, so without this the hover's purple text would
   win over the white and vanish against the purple fill. Darken the fill for feedback. */
.tnd-chip--active:hover { background: var(--tnd-purple-dark); color: #fff; border-color: var(--tnd-purple-dark); }

/* --- Filter bar --- */
.tnd-map__filter-bar {
	background: var(--tnd-purple-50);
	border-radius: var(--tnd-radius-sm);
	padding: 12px 16px;
	margin-bottom: 12px;
	display: none;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	font-size: 13px;
}
.tnd-map__filter-bar--active { display: flex; }
.tnd-filter-bar__label {
	color: var(--tnd-purple);
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}
.tnd-filter-pill {
	background: white;
	border: 1px solid var(--tnd-purple-100);
	color: var(--tnd-purple);
	padding: 4px 10px;
	border-radius: 12px;
	font-size: 12px;
	font-weight: 500;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.tnd-filter-pill button {
	background: transparent;
	border: none;
	color: var(--tnd-purple);
	cursor: pointer;
	font-size: 14px;
	padding: 0;
	line-height: 1;
}
.tnd-filter-bar__count { color: var(--tnd-ink-soft); margin-left: auto; }
.tnd-btn-link {
	background: transparent;
	color: var(--tnd-ink-mute);
	border: none;
	font-size: 12px;
	cursor: pointer;
	text-decoration: underline;
	padding: 4px 8px;
	font-family: inherit;
}
.tnd-btn-link:hover { color: var(--tnd-ink); }

.tnd-map__search-error {
	color: #c2553d;
	font-size: 13px;
	min-height: 18px;
	padding: 0 4px;
}

/* --- Breadcrumb --- */
.tnd-map__breadcrumb {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
	font-size: 13px;
	color: var(--tnd-ink-soft);
	min-height: 20px;
}
/* Force every breadcrumb segment — the "All Regions" link, the current-page
   span, and the separator — to the same font in both the overview ("All Regions"
   alone) and region ("All Regions › Midwest") states. Without this the themed
   <a> renders at a different size/weight than the adjacent <span>. */
.tnd-map__breadcrumb,
.tnd-map__breadcrumb a,
.tnd-map__breadcrumb span {
	font-family: inherit !important;
	font-size: 13px !important;
	font-weight: 500 !important;
	line-height: 1.4 !important;
}
.tnd-map__breadcrumb a {
	color: var(--tnd-purple);
	text-decoration: none;
	cursor: pointer;
}
.tnd-map__breadcrumb a:hover { text-decoration: underline; }
.tnd-bc__sep { color: var(--tnd-line); }

/* --- Map wrapper --- */
.tnd-map__wrapper {
	background: var(--tnd-map-water);
	border-radius: var(--tnd-radius);
	padding: 20px;
	box-shadow: var(--tnd-shadow-sm), inset 0 0 60px rgba(255, 255, 255, 0.4);
	position: relative;
	min-height: 560px;
	background-image:
		radial-gradient(ellipse at top left, rgba(255, 255, 255, 0.5) 0%, transparent 50%),
		radial-gradient(ellipse at bottom right, rgba(94, 44, 142, 0.04) 0%, transparent 50%);
}
.tnd-map__instructions {
	text-align: center;
	color: var(--tnd-ink-soft);
	font-size: 13px;
	background: white;
	padding: 6px 14px;
	border-radius: 20px;
	box-shadow: 0 1px 3px rgba(60, 60, 60, 0.08);
	position: absolute;
	top: 16px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 4;
	white-space: nowrap;
	max-width: calc(100% - 32px);
	overflow: hidden;
	text-overflow: ellipsis;
}
.tnd-map__svg {
	width: 100%;
	height: 520px;
	display: block;
	margin-top: 8px;
}
.tnd-map__back-btn {
	position: absolute;
	top: 16px;
	left: 16px;
	background: white;
	border: 1px solid var(--tnd-line);
	border-radius: 24px;
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	display: none;
	align-items: center;
	gap: 6px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	z-index: 5;
	color: var(--tnd-purple);
	font-family: inherit;
}
.tnd-map__back-btn:hover { background: var(--tnd-purple-50); }
.tnd-map__back-btn--visible { display: flex; }
.tnd-map__empty {
	text-align: center;
	color: var(--tnd-ink-mute);
	padding: 60px 20px;
}

/* --- Map SVG layers --- */
.tnd-region { cursor: pointer; transition: opacity 0.2s, fill 0.2s; }
.tnd-region:hover { opacity: 1; }
.tnd-region.tnd-dimmed { opacity: 0.3; pointer-events: none; }
.tnd-region:focus { outline: none; }
.tnd-region:focus-visible { stroke: var(--tnd-purple); stroke-width: 2; }

.tnd-region-outline { transition: opacity 0.2s, stroke 0.2s; }
.tnd-region-outline.tnd-dimmed { opacity: 0.15; }

.tnd-pin { cursor: pointer; }
.tnd-pin__shape {
	transition: transform 0.15s ease-out, filter 0.15s ease-out;
	transform-origin: center;
	transform-box: fill-box;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}
.tnd-pin:hover .tnd-pin__shape,
.tnd-pin--active .tnd-pin__shape {
	transform: scale(1.15);
	filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}
.tnd-pin--active .tnd-pin__body { stroke: var(--tnd-ink); stroke-width: 1.5; }
.tnd-pin__count {
	font-weight: 700;
	text-anchor: middle;
	fill: white;
	pointer-events: none;
}
.tnd-pin:focus-visible .tnd-pin__body { stroke: var(--tnd-ink); stroke-width: 2; }

.tnd-region-label {
	pointer-events: none;
	fill: var(--tnd-purple);
	font-size: 12px;
	font-weight: 700;
	text-anchor: middle;
	letter-spacing: -0.2px;
}
.tnd-region-count {
	pointer-events: none;
	fill: var(--tnd-ink-soft);
	font-size: 10px;
	text-anchor: middle;
	font-weight: 500;
}
.tnd-state-code {
	pointer-events: none;
	fill: var(--tnd-map-border);
	font-size: 10px;
	font-weight: 600;
	text-anchor: middle;
	letter-spacing: 0.5px;
	user-select: none;
}

/* --- Mobile list --- */
.tnd-map__mobile-list { display: none; margin-top: 12px; }
@media (max-width: 700px) {
	.tnd-map__svg { height: 360px; }
	.tnd-map__mobile-list { display: block; }
}
.tnd-mobile__region {
	background: white;
	border-radius: 8px;
	margin-bottom: 8px;
	box-shadow: var(--tnd-shadow-sm);
}
.tnd-mobile__region-header {
	width: 100%;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 18px;
	background: transparent;
	border: none;
	font-size: 15px;
	font-weight: 600;
	color: var(--tnd-purple);
	cursor: pointer;
	text-align: left;
	font-family: inherit;
}
.tnd-mobile__region-count { color: var(--tnd-ink-mute); font-size: 13px; font-weight: 500; }

/* --- Drawer --- */
.tnd-drawer-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(26, 26, 46, 0.4);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s;
	z-index: 100;
}
.tnd-drawer-backdrop--open { opacity: 1; pointer-events: auto; }

.tnd-drawer {
	position: fixed;
	top: 0; right: 0; bottom: 0;
	width: 460px;
	max-width: 100vw;
	background: white;
	transform: translateX(100%);
	transition: transform 0.3s ease;
	z-index: 101;
	overflow-y: auto;
	box-shadow: -4px 0 16px rgba(0, 0, 0, 0.08);
	display: flex;
	flex-direction: column;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.tnd-drawer--open { transform: translateX(0); }
@media (max-width: 700px) { .tnd-drawer { width: 100vw; } }

.tnd-drawer__header {
	padding: 16px 24px 12px;
	border-bottom: 1px solid #e8e8ef;
	position: sticky;
	top: 0;
	background: white;
	z-index: 2;
}
.tnd-drawer__close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: none;
	background: #f3f3f7;
	font-size: 18px;
	cursor: pointer;
	color: #4a4a5e;
	line-height: 1;
}
.tnd-drawer__close:hover { background: #e8e8ef; }
.tnd-drawer__close:focus-visible { outline: 2px solid #5E2C8E; outline-offset: 2px; }
.tnd-drawer__eyebrow {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #5E2C8E;
	margin: 0 0 4px;
}
.tnd-drawer__title {
	font-size: 20px;
	font-weight: 700;
	padding-right: 32px;
	line-height: 1.3;
	color: #1a1a2e;
	margin: 0;
}
.tnd-drawer__meta {
	color: #4a4a5e;
	font-size: 13px;
	margin: 4px 0 0;
	line-height: 1.4;
}
.tnd-drawer__pill {
	display: inline-block;
	padding: 3px 10px;
	background: #E5D4F4;
	color: #5E2C8E;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 600;
	margin-left: 6px;
	vertical-align: middle;
}
.tnd-drawer__body { flex: 1; overflow-y: auto; }
.tnd-drawer__empty { padding: 32px 24px; text-align: center; color: var(--tnd-ink-mute); }
.tnd-drawer__empty h3 { margin: 0 0 6px; font-size: 15px; color: var(--tnd-ink); }
.tnd-drawer__empty p { margin: 0; font-size: 13px; line-height: 1.5; }
.tnd-drawer__city-header {
	padding: 9px 24px 7px;
	background: #F4EDFB;
	border-top: 1px solid #E5D4F4;
	border-bottom: 1px solid #E5D4F4;
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 8px;
	position: sticky;
	top: 0;
	z-index: 1;
}
.tnd-drawer__city-name {
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #5E2C8E;
}
.tnd-drawer__city-count { font-size: 11px; color: #8888a0; font-weight: 500; }

/* --- Doctor card --- */
.tnd-doctor-card {
	padding: 12px 24px;
	border-bottom: 1px solid #f3f3f7;
	display: flex;
	gap: 12px;
	transition: background 0.15s;
}
.tnd-doctor-card:last-child { border-bottom: none; }
.tnd-doctor-card:hover { background: #F4EDFB; }
.tnd-doctor-card__photo {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	flex-shrink: 0;
	overflow: hidden;
	object-fit: cover;
}
.tnd-doctor-card__photo--initials {
	background: linear-gradient(135deg, #8B5FBF, #5E2C8E);
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-weight: 700;
	font-size: 20px;
}
.tnd-doctor-card__info { flex: 1; min-width: 0; }
.tnd-doctor-card__name {
	font-size: 15px;
	font-weight: 600;
	color: #1a1a2e;
	margin: 0 0 2px;
}
.tnd-doctor-card__areas {
	font-size: 13px;
	color: #4a4a5e;
	margin: 0 0 4px;
}
.tnd-doctor-card__office {
	font-size: 12px;
	line-height: 1.4;   /* explicit so the pin offset is deterministic, not inherited (1.45) */
	color: #8888a0;
	margin: 0 0 8px;
	display: flex;
	align-items: flex-start;
	gap: 4px;
}
.tnd-doctor-card__office svg {
	width: 12px;
	height: 12px;
	flex-shrink: 0;
	margin-top: 2px;
}
.tnd-doctor-card__ctas { display: flex; gap: 6px; flex-wrap: wrap; }
/* Toned-down CTA buttons — applies ONLY to the drawer + the "doctors near"
   listing (both render .tnd-doctor-card); the region cards use .tnd-rcard and
   are untouched. Pins Poppins so the drawer buttons (which sit in <body>, outside
   .tnd-map) match the listing, which already inherits Poppins. */
.tnd-doctor-card__ctas .tnd-btn,
.tnd-doctor-card__ctas .tnd-btn:hover,
.tnd-doctor-card__ctas .tnd-btn:focus {
	font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 13px;
	padding: 8px 15px;
}
.tnd-doctor-card__distance {
	display: inline-block;
	padding: 2px 8px;
	background: #E5D4F4;
	color: #5E2C8E;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 600;
	margin-left: 6px;
}

/* --- Buttons (values match region.css exactly) --- */
.tnd-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 10px 18px;
	border-radius: 999px;
	border: 1px solid transparent;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.tnd-btn svg { width: 15px; height: 15px; }
.tnd-btn:focus-visible { outline: 2px solid var(--tnd-purple); outline-offset: 2px; }
/* color is !important so the theme's content link color can't override the button text. */
.tnd-btn--primary { background: #592e6d !important; color: #fff !important; border-color: #592e6d; }
.tnd-btn--primary:hover { background: #43214f !important; color: #fff !important; }
.tnd-btn--secondary { background: #fff !important; color: #592e6d !important; border-color: #592e6d; }
.tnd-btn--secondary:hover { background: #F4EDFB !important; color: #592e6d !important; }
.tnd-btn--outline { background: white; color: #5E2C8E; border-color: #5E2C8E; }
.tnd-btn--outline:hover { background: #F4EDFB; }
.tnd-btn--loading svg { animation: tnd-spin 1s linear infinite; }
@keyframes tnd-spin { to { transform: rotate(360deg); } }

/* --- Listing view --- */
.tnd-map__listing {
	background: white;
	border-radius: var(--tnd-radius);
	padding: 24px;
	box-shadow: var(--tnd-shadow-sm);
	display: none;
}
.tnd-map--listing .tnd-map__listing { display: block; }
.tnd-map--listing .tnd-map__wrapper { display: none; }
.tnd-map__listing-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 8px;
	flex-wrap: wrap;
	gap: 12px;
}
.tnd-map__listing-header h2 { font-size: 22px; font-weight: 700; margin: 0; color: #1a1a2e; }
.tnd-map__listing-count { color: #4a4a5e; font-size: 14px; margin-bottom: 20px; }
.tnd-map__listing-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
	gap: 16px;
}
.tnd-map__no-results {
	grid-column: 1 / -1;
	text-align: center;
	padding: 60px 20px;
	color: #4a4a5e;
}
.tnd-map__no-results h3 { font-size: 18px; margin-bottom: 8px; color: #1a1a2e; }

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
	.tnd-map *, .tnd-drawer *, .tnd-region, .tnd-region-outline, .tnd-pin__shape {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}
