/*
 * Dentist Locator front-end.
 *
 * Designed to sit inside an Elementor theme without either fighting it or
 * being mangled by it. Two rules of thumb:
 *
 * 1. Sizes are absolute px, never em. Themes commonly set a large body
 *    font-size (innerview.ai uses 22px) and em-based widgets balloon.
 * 2. Layout-critical properties are !important and scoped to .ivdl, purely to
 *    neutralise theme rules that force width:100%, monospace fallbacks and
 *    oversized button padding onto every control on the page.
 *
 * Colours follow the host theme: the accent defaults to Elementor's global
 * primary colour when one exists, and the admin Accent setting overrides it.
 * The sky secondary (#25ade3) fails WCAG contrast on white (2.6:1), so it is
 * used only decoratively — focus rings, highlight borders. Interactive states
 * that carry text use --ivdl-accent-deep, a darkened sky that passes AA.
 */

.ivdl {
	--ivdl-accent: var(--e-global-color-primary, #00406e);
	--ivdl-accent-soft: var(--e-global-color-secondary, #25ade3);
	--ivdl-accent-deep: #0c6f9b;
	--ivdl-text: var(--e-global-color-text, #4d4d4d);
	--ivdl-muted: #5b6572;
	--ivdl-field: #f5f5f5;
	--ivdl-border: #e1e8ef;
	--ivdl-tint: #f2f8fd;
	--ivdl-map-h: 420px;
	--ivdl-card-min: 320px;
	--ivdl-radius: 12px;
	--ivdl-pill: 50px;
	--ivdl-shadow: 0 1px 3px rgba(0, 64, 110, 0.08);
	--ivdl-shadow-up: 0 6px 18px rgba(0, 64, 110, 0.14);

	max-width: 1080px;
	margin: 0 auto;
	font-size: 16px;
	line-height: 1.5;
	color: var(--ivdl-text);
	text-align: left;
	/* Lay out against the container we're dropped into (page, homepage
	   section, sidebar, Elementor column) rather than the viewport. */
	container-type: inline-size;
	container-name: ivdl;
}

/*
 * Typeface. Some themes force `font-family: monospace, monospace` onto every
 * descendant of a widget container, and `inherit` faithfully inherits the
 * mangled value, so the stack is stated outright: the theme's own Elementor
 * body font first, then a neutral system fallback.
 */
.ivdl,
.ivdl * {
	font-family:
		var(--ivdl-font, var(--e-global-typography-text-font-family, ui-sans-serif)),
		-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

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

/* ---------- Search bar ---------- */

.ivdl .ivdl-form {
	margin: 0 0 14px;
}

.ivdl .ivdl-label {
	display: block;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.4;
	text-transform: none;
	margin: 0 0 10px;
	padding: 0;
	color: var(--ivdl-accent);
}

.ivdl .ivdl-controls {
	display: flex !important;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 10px;
	margin: 0;
	padding: 0;
}

/* Shared reset — themes restyle inputs, selects and buttons aggressively. */
.ivdl .ivdl-input,
.ivdl .ivdl-radius,
.ivdl .ivdl-btn {
	font-size: 16px !important;
	font-weight: 400 !important;
	line-height: 1.4 !important;
	text-transform: none !important;
	height: auto !important;
	min-height: 44px !important; /* comfortable touch target */
	max-width: none !important;
	margin: 0 !important;
	box-shadow: none !important;
	border-width: 1px !important;
	border-style: solid !important;
	appearance: none;
	-webkit-appearance: none;
}

.ivdl .ivdl-input,
.ivdl .ivdl-radius {
	/* Matches the site's own form fields: soft grey, lightly rounded. */
	background-color: var(--ivdl-field) !important;
	border-color: var(--ivdl-border) !important;
	border-radius: 8px !important;
	padding: 12px 16px !important;
	color: var(--ivdl-accent) !important;
}

.ivdl .ivdl-input {
	/* flex-basis, not width — the theme's width:100% would break the row. */
	flex: 1 1 240px !important;
	width: auto !important;
	min-width: 0 !important;
}

.ivdl .ivdl-input::placeholder {
	color: var(--ivdl-muted);
	opacity: 1;
}

.ivdl .ivdl-radius {
	flex: 0 0 auto !important;
	width: auto !important;
	min-width: 170px !important;
	/* Own arrow, since appearance:none removes the native one. */
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%2300406e' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E") !important;
	background-repeat: no-repeat !important;
	background-position: right 14px center !important;
	background-size: 11px !important;
	padding-right: 36px !important;
}

.ivdl .ivdl-input:focus,
.ivdl .ivdl-radius:focus,
.ivdl .ivdl-btn:focus-visible {
	outline: 2px solid var(--ivdl-accent-soft);
	outline-offset: 2px;
}

/* Pill buttons like the site's "Book a Demo", at a sane size. */
.ivdl .ivdl-btn {
	flex: 0 0 auto !important;
	width: auto !important;
	cursor: pointer;
	border-radius: var(--ivdl-pill) !important;
	padding: 10px 26px !important;
	text-decoration: none !important;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.ivdl .ivdl-btn-primary,
.ivdl .ivdl-btn-primary:focus {
	background-color: var(--ivdl-accent) !important;
	border-color: var(--ivdl-accent) !important;
	color: #fff !important;
}

/* Hover keeps white text readable: darkened sky, not raw #25ade3. */
.ivdl .ivdl-btn-primary:hover {
	background-color: var(--ivdl-accent-deep) !important;
	border-color: var(--ivdl-accent-deep) !important;
	color: #fff !important;
}

.ivdl .ivdl-geolocate,
.ivdl .ivdl-geolocate:focus {
	background-color: transparent !important;
	border-color: var(--ivdl-accent) !important;
	color: var(--ivdl-accent) !important;
}

.ivdl .ivdl-geolocate:hover {
	background-color: var(--ivdl-accent) !important;
	color: #fff !important;
}

/* ---------- Status line ---------- */

.ivdl .ivdl-status {
	font-size: 15px !important;
	line-height: 1.5 !important;
	min-height: 1.4em;
	margin: 0 0 14px !important;
	padding: 0 !important;
	color: var(--ivdl-muted) !important;
}

.ivdl .ivdl-status:empty {
	min-height: 0;
	margin-bottom: 0 !important;
}

/* ---------- Map ---------- */

.ivdl .ivdl-map {
	height: var(--ivdl-map-h);
	width: 100%;
	margin: 0 0 18px;
	border: 1px solid var(--ivdl-border);
	border-radius: var(--ivdl-radius);
	background: #e9edf1;
	overflow: hidden;
	/* Keep Leaflet's panes under sticky headers and Elementor overlays. */
	z-index: 0;
	isolation: isolate;
}

/* Leaflet ships its own font stack; match the page instead. */
.ivdl .leaflet-container {
	font-size: 13px;
	background: #e9edf1;
}

.ivdl .leaflet-container a {
	text-decoration: none;
}

/*
 * Mute the default OSM tiles so the branded pins carry the colour. Reads like
 * a purpose-made light basemap without changing tile provider or licensing;
 * the attribution control stays untouched (and must).
 */
.ivdl .leaflet-tile-pane {
	filter: grayscale(0.75) saturate(0.6) brightness(1.04) contrast(0.96);
}

/* Leaflet's zoom buttons are 30px — small for older hands. */
.ivdl .leaflet-control-zoom a {
	width: 40px !important;
	height: 40px !important;
	line-height: 38px !important;
	font-size: 20px !important;
	color: var(--ivdl-accent) !important;
}

/* Branded popups: white card, navy title, no serif surprises. */
.ivdl .leaflet-popup-content-wrapper {
	border-radius: 10px;
	box-shadow: var(--ivdl-shadow-up);
	color: var(--ivdl-text);
}

.ivdl .leaflet-popup-content {
	font-size: 14px;
	line-height: 1.45;
	margin: 12px 16px;
}

.ivdl .leaflet-popup-content strong {
	color: var(--ivdl-accent);
}

/* ---------- Map pins ---------- */

/*
 * Branded teardrop pins drawn in CSS rather than Leaflet's default image, so
 * they follow the accent colour and can be highlighted from the list.
 */
.ivdl .ivdl-pin-wrap {
	background: none;
	border: 0;
}

.ivdl .ivdl-pin {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: 2px solid #fff;
	border-radius: 50% 50% 50% 0;
	transform: rotate(-45deg);
	background: var(--ivdl-accent);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
	transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.ivdl .ivdl-pin-label {
	transform: rotate(45deg);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
}

.ivdl .ivdl-pin-wrap.is-active .ivdl-pin,
.ivdl .ivdl-pin-wrap.is-selected .ivdl-pin,
.ivdl .ivdl-pin-wrap:hover .ivdl-pin {
	background: var(--ivdl-accent-deep);
	transform: rotate(-45deg) scale(1.25);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.ivdl .leaflet-marker-icon {
	cursor: pointer;
}

/* The "you are here" dot pulses gently so it reads as the origin, not a practice. */
.ivdl .ivdl-origin {
	animation: ivdl-pulse 2.4s ease-in-out infinite;
}

@keyframes ivdl-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.55; }
}

/* ---------- Result cards ---------- */

.ivdl .ivdl-results {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	display: grid;
	gap: 14px;
	/* Multi-column on desktop, single column on phones. */
	grid-template-columns: repeat(auto-fill, minmax(var(--ivdl-card-min), 1fr));
}

/* Fixed column counts, for embeds that need to match a surrounding layout. */
.ivdl[data-columns="1"] .ivdl-results {
	grid-template-columns: minmax(0, 1fr);
}

.ivdl[data-columns="2"] .ivdl-results {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ivdl[data-columns="3"] .ivdl-results {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ivdl[data-columns="4"] .ivdl-results {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ivdl .ivdl-results > li::before,
.ivdl .ivdl-results > li::marker {
	content: none !important;
}

.ivdl .ivdl-card {
	display: flex;
	gap: 14px;
	margin: 0 !important;
	padding: 18px !important;
	list-style: none !important;
	border: 1px solid var(--ivdl-border);
	border-radius: var(--ivdl-radius);
	background: #fff;
	box-shadow: var(--ivdl-shadow);
	cursor: pointer;
	transition: box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.ivdl .ivdl-card:hover,
.ivdl .ivdl-card:focus-visible,
.ivdl .ivdl-card.is-active {
	border-color: var(--ivdl-accent-soft);
	box-shadow: var(--ivdl-shadow-up);
}

/* Highlighted from the map: a left edge in the accent, so the link between a
   hovered pin and its card is unmistakable. */
.ivdl .ivdl-card.is-active {
	box-shadow: inset 3px 0 0 var(--ivdl-accent), var(--ivdl-shadow-up);
}

/* Chosen with a click (card or pin): stays marked until another is chosen. */
.ivdl .ivdl-card.is-selected {
	border-color: var(--ivdl-accent);
	background: var(--ivdl-tint);
}

.ivdl .ivdl-card:focus-visible {
	outline: 2px solid var(--ivdl-accent-soft);
	outline-offset: 2px;
}

.ivdl .ivdl-logo {
	flex: 0 0 52px;
	width: 52px;
	height: 52px;
	border-radius: 10px;
	background: #eef4f9;
	color: var(--ivdl-accent);
	font-size: 22px;
	font-weight: 500;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.ivdl .ivdl-logo img {
	width: 100%;
	height: 100%;
	max-width: 100%;
	object-fit: contain;
	margin: 0;
	border-radius: 0;
	box-shadow: none;
}

.ivdl .ivdl-card-body {
	min-width: 0;
	flex: 1 1 auto;
}

.ivdl .ivdl-card-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
}

.ivdl .ivdl-name {
	font-size: 18px !important;
	font-weight: 600 !important;
	line-height: 1.3 !important;
	text-transform: none !important;
	margin: 0 0 4px !important;
	padding: 0 !important;
	color: var(--ivdl-accent) !important;
}

.ivdl .ivdl-distance {
	flex: 0 0 auto;
	font-size: 13px !important;
	font-weight: 500 !important;
	line-height: 1 !important;
	white-space: nowrap;
	color: var(--ivdl-accent-deep) !important;
	background: var(--ivdl-tint);
	border: 1px solid var(--ivdl-border);
	border-radius: var(--ivdl-pill);
	padding: 6px 10px !important;
}

.ivdl .ivdl-meta,
.ivdl .ivdl-doctors,
.ivdl .ivdl-contact {
	font-size: 14px !important;
	line-height: 1.45 !important;
	margin: 0 0 5px !important;
	padding: 0 !important;
	color: var(--ivdl-text) !important;
	overflow-wrap: anywhere;
}

.ivdl .ivdl-meta {
	color: var(--ivdl-muted) !important;
}

/* ---------- Card actions: Call / Directions / Website ---------- */

.ivdl .ivdl-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

.ivdl .ivdl-action {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	min-height: 40px;
	font-size: 14px !important;
	font-weight: 500 !important;
	line-height: 1 !important;
	padding: 10px 16px !important;
	margin: 0 !important;
	border: 1px solid var(--ivdl-border) !important;
	border-radius: var(--ivdl-pill) !important;
	background: #fff !important;
	color: var(--ivdl-accent) !important;
	text-decoration: none !important;
	white-space: nowrap;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ivdl .ivdl-action svg {
	flex: 0 0 auto;
}

/* Calling is the conversion that matters for this audience — make it solid. */
.ivdl .ivdl-action-call {
	background: var(--ivdl-accent) !important;
	border-color: var(--ivdl-accent) !important;
	color: #fff !important;
}

.ivdl .ivdl-action-call:hover {
	background: var(--ivdl-accent-deep) !important;
	border-color: var(--ivdl-accent-deep) !important;
	color: #fff !important;
}

.ivdl .ivdl-action-directions:hover,
.ivdl .ivdl-action-website:hover {
	border-color: var(--ivdl-accent) !important;
	background: var(--ivdl-tint) !important;
	color: var(--ivdl-accent) !important;
}

.ivdl .ivdl-action:focus-visible {
	outline: 2px solid var(--ivdl-accent-soft);
	outline-offset: 2px;
}

/* ---------- Loading skeletons ---------- */

.ivdl .ivdl-skeleton {
	pointer-events: none;
	cursor: default;
}

.ivdl .ivdl-skeleton .ivdl-logo {
	background: #edf1f5;
}

.ivdl .ivdl-shimmer {
	height: 14px;
	margin: 0 0 10px;
	border-radius: 6px;
	background: linear-gradient(90deg, #edf1f5 25%, #f7f9fb 45%, #edf1f5 65%);
	background-size: 200% 100%;
	animation: ivdl-shimmer 1.3s ease-in-out infinite;
}

@keyframes ivdl-shimmer {
	0% { background-position: 180% 0; }
	100% { background-position: -20% 0; }
}

/* ---------- Empty state ---------- */

.ivdl .ivdl-empty {
	grid-column: 1 / -1;
	list-style: none !important;
	margin: 0 !important;
	padding: 28px 20px !important;
	border: 1px dashed var(--ivdl-border);
	border-radius: var(--ivdl-radius);
	background: #fafcfe;
	text-align: center;
}

.ivdl .ivdl-empty p {
	font-size: 15px !important;
	line-height: 1.5 !important;
	margin: 0 0 14px !important;
	color: var(--ivdl-muted) !important;
}

.ivdl .ivdl-empty .ivdl-expand,
.ivdl .ivdl-empty .ivdl-expand:focus {
	background: var(--ivdl-accent) !important;
	border-color: var(--ivdl-accent) !important;
	color: #fff !important;
}

.ivdl .ivdl-empty .ivdl-expand:hover {
	background: var(--ivdl-accent-deep) !important;
	border-color: var(--ivdl-accent-deep) !important;
}

/* ---------- "See all" footer link ---------- */

.ivdl .ivdl-more {
	margin: 18px 0 0;
	text-align: center;
}

.ivdl .ivdl-more-link {
	display: inline-block;
	font-size: 16px !important;
	font-weight: 400 !important;
	line-height: 1.4 !important;
	padding: 12px 26px !important;
	border: 1px solid var(--ivdl-accent) !important;
	border-radius: var(--ivdl-pill) !important;
	background: transparent !important;
	color: var(--ivdl-accent) !important;
	text-decoration: none !important;
}

.ivdl .ivdl-more-link:hover {
	background: var(--ivdl-accent) !important;
	color: #fff !important;
}

/* ---------- Split view: list beside the map on wide containers ---------- */

/*
 * The pattern every serious locator converges on (Airbnb, Zocdoc, pharmacy
 * finders): a scrollable list column beside a tall map, so hovering a card
 * and watching its pin needs no scrolling between the two. Applies only to
 * the full locator — teasers (limit/columns/map-off embeds) keep the grid.
 */
/* A container query can't style the container itself, so the grid goes on an
   inner wrapper. */
@container ivdl (min-width: 900px) {
	.ivdl[data-map="1"][data-limit="0"]:not([data-columns]) .ivdl-inner {
		display: grid;
		grid-template-columns: minmax(340px, 5fr) 7fr;
		grid-template-areas:
			"form form"
			"status status"
			"list map"
			"more more";
		column-gap: 18px;
	}

	.ivdl[data-map="1"][data-limit="0"]:not([data-columns]) .ivdl-form {
		grid-area: form;
	}

	.ivdl[data-map="1"][data-limit="0"]:not([data-columns]) .ivdl-status {
		grid-area: status;
	}

	.ivdl[data-map="1"][data-limit="0"]:not([data-columns]) .ivdl-map {
		grid-area: map;
		height: max(var(--ivdl-map-h), 540px);
		margin: 0;
	}

	.ivdl[data-map="1"][data-limit="0"]:not([data-columns]) .ivdl-results {
		grid-area: list;
		grid-template-columns: minmax(0, 1fr);
		align-content: start;
		overflow-y: auto;
		max-height: max(var(--ivdl-map-h), 540px);
		padding-right: 6px !important;
		scrollbar-width: thin;
	}

	.ivdl[data-map="1"][data-limit="0"]:not([data-columns]) .ivdl-more {
		grid-area: more;
	}
}

/* ---------- Narrow containers ---------- */

/*
 * Keyed on the container, not the viewport, so the locator also collapses
 * correctly inside a narrow homepage column on a wide desktop screen.
 */
@container ivdl (max-width: 940px) {
	.ivdl[data-columns="3"] .ivdl-results,
	.ivdl[data-columns="4"] .ivdl-results {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@container ivdl (max-width: 640px) {
	.ivdl .ivdl-input,
	.ivdl .ivdl-radius,
	.ivdl .ivdl-btn {
		flex: 1 1 100% !important;
		width: 100% !important;
	}

	.ivdl .ivdl-btn {
		text-align: center;
	}

	.ivdl .ivdl-map {
		height: 300px;
	}

	.ivdl .ivdl-results,
	.ivdl[data-columns] .ivdl-results {
		grid-template-columns: minmax(0, 1fr);
	}

	/* Full-width tap targets where thumbs are the pointer. */
	.ivdl .ivdl-actions {
		gap: 10px;
	}

	.ivdl .ivdl-action {
		flex: 1 1 auto;
		justify-content: center;
		min-height: 44px;
	}
}

/* Fallback for browsers without container queries (pre-2023). */
@supports not (container-type: inline-size) {
	@media (max-width: 640px) {
		.ivdl .ivdl-input,
		.ivdl .ivdl-radius,
		.ivdl .ivdl-btn {
			flex: 1 1 100% !important;
			width: 100% !important;
		}

		.ivdl .ivdl-btn {
			text-align: center;
		}

		.ivdl .ivdl-map {
			height: 300px;
		}

		.ivdl .ivdl-results,
		.ivdl[data-columns] .ivdl-results {
			grid-template-columns: minmax(0, 1fr);
		}
	}
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.ivdl .ivdl-origin,
	.ivdl .ivdl-shimmer {
		animation: none;
	}

	.ivdl .ivdl-pin,
	.ivdl .ivdl-card,
	.ivdl .ivdl-action,
	.ivdl .ivdl-btn {
		transition: none;
	}
}
