/**
 * Interactive Maps — frontend styles.
 *
 * Fully self-contained: no theme variables, no external fonts. A single accent
 * custom property keeps popups on-brand and easy to override from a theme.
 *
 * @package CGMB
 */

.cgmb-map-wrapper {
	--cgmb-accent: #009fe3;
	--cgmb-accent-dark: #007bb2;
	--cgmb-text: #1a1a1a;
	--cgmb-radius: 16px;

	width: 100%;
	max-width: 100%;
	margin: 0 auto;
	border-radius: var(--cgmb-radius);
	overflow: hidden;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
	background: #eef1f4;
}

.cgmb-map {
	width: 100%;
	height: clamp(320px, 58vh, 560px);
	min-height: 320px;
	position: relative;
	z-index: 1; /* Stay under sticky headers. */
}

.cgmb-map__loading {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	margin: 0;
	color: #6b7280;
	font-size: 14px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Leaflet container font, kept independent from the active theme. */
.cgmb-map .leaflet-container {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	background: #eef1f4;
}

/* --- Popup --------------------------------------------------------------- */

.cgmb-popup {
	min-width: 180px;
	max-width: 260px;
	padding: 4px 2px;
	color: var(--cgmb-text);
}

.cgmb-popup__title {
	display: block;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--cgmb-accent);
	margin: 0 0 4px;
}

.cgmb-popup__address {
	font-size: 13px;
	line-height: 1.45;
	color: var(--cgmb-text);
	margin: 0 0 10px;
}

.cgmb-popup__link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	font-weight: 600;
	color: var(--cgmb-accent);
	text-decoration: none;
	transition: color 0.2s ease;
}

.cgmb-popup__link:hover,
.cgmb-popup__link:focus-visible {
	color: var(--cgmb-accent-dark);
	text-decoration: underline;
}

/* Round Leaflet's popup frame to match the plugin's design language. */
.cgmb-popup-frame .leaflet-popup-content-wrapper {
	border-radius: 12px;
	box-shadow: 0 6px 22px rgba(0, 0, 0, 0.14);
	padding: 6px;
}

.cgmb-popup-frame .leaflet-popup-content {
	margin: 10px 12px;
}

.cgmb-popup-frame .leaflet-popup-tip {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Compact, unobtrusive attribution. */
.cgmb-map-wrapper .leaflet-control-attribution {
	font-size: 10px;
	opacity: 0.75;
}

/* Clear focus outline for keyboard users on interactive controls. */
.cgmb-map .leaflet-marker-icon:focus-visible,
.cgmb-map .leaflet-control a:focus-visible {
	outline: 2px solid var(--cgmb-accent);
	outline-offset: 2px;
}

@media (max-width: 600px) {
	.cgmb-map {
		height: clamp(280px, 60vh, 420px);
	}
}
