/* ==========================================================================
   WalkTheDock Route Map — route-map.css
   Version: 1.4.2
   --------------------------------------------------------------------------
   Map markers + popups for the Route Map widget. Leaflet defaults are
   overridden to match the Route Itinerary timeline visual language so the
   map and the timeline read as one connected view.
   ========================================================================== */

.wtd-route-map-wrap {
	width: 100%;
	/* Perspective lives on the OUTER wrap so the inner .wtd-route-map
	   (the actual Leaflet container) can rotate in 3D space without
	   Leaflet's inline transforms on .leaflet-map-pane fighting us. */
	perspective: 1600px;
	perspective-origin: 50% 100%;
}

.wtd-route-map {
	width: 100%;
	height: 600px;
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid #e2e8f0;
	background: #e6f0f5;
	/* Birds-eye tilt — controlled by the Elementor `Tilt` slider, which
	   inlines the rotateX transform directly (with !important) so it beats
	   any Leaflet / Voxel theme rules that might reset transform here.
	   This static fallback keeps the default 0deg state explicit. */
	transform: rotateX(var(--wtd-route-map-tilt, 0deg));
	transform-origin: 50% 100%;
	transform-style: preserve-3d;
	transition: transform 0.3s ease;
}

/* Counter-rotate marker icons so they don't tip backward with the
   terrain — they sit "facing the camera" in the tilted scene.
   Note: only rotate the inner wrap, not the .leaflet-marker-icon
   itself (which carries Leaflet's positioning translate3d). */
.wtd-route-map .wtd-route-map-marker-wrap {
	transform: translateX(-50%) translateY(-50%) rotateX(calc(var(--wtd-route-map-tilt, 0deg) * -1));
	transform-origin: 50% 50%;
}

/* Counter-rotate popups so they stay readable when tilted. */
.wtd-route-map .leaflet-popup {
	transform-origin: 50% 100%;
	transform: rotateX(calc(var(--wtd-route-map-tilt, 0deg) * -1));
}

/* Counter-rotate Leaflet's control container (zoom buttons, attribution)
   so they stay flat against the camera. */
.wtd-route-map .leaflet-control-container {
	transform: rotateX(calc(var(--wtd-route-map-tilt, 0deg) * -1));
	transform-origin: 50% 0;
}

/* ── Polyline / SVG overlay safety ──────────────────────────────
   Some themes set `svg path { fill: <color> }` globally, which
   turns Leaflet's stroke-only polyline into a filled wedge.
   Force fill:none on Leaflet's overlay paths to prevent that. */
.wtd-route-map .leaflet-overlay-pane svg path {
	fill: none;
}
/* Restore fill for the popup tip (which IS a filled path). */
.leaflet-popup-tip {
	background: #ffffff;
}

/* ── Omitted-stops notice (above the map) ───────────────────────── */
.wtd-route-map-omitted {
	margin-bottom: 8px;
	padding: 8px 12px;
	background: #fffbeb;
	border: 1px solid #fde68a;
	border-radius: 6px;
	font-size: 13px;
	color: #92400e;
}

.wtd-route-map-omitted span[aria-hidden] {
	margin-right: 6px;
}

/* ── Marker (custom HTML divIcon — strip Leaflet's defaults) ────── */
.wtd-route-map-divicon {
	background: transparent !important;
	border: none !important;
}

.wtd-route-map-marker-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	transform: translateX(-50%) translateY(-50%);
	position: relative;
	top: 50%;
	left: 50%;
}

.wtd-route-map-marker {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: #0A4D8C;
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 2px solid #fff;
	box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	cursor: pointer;
}

.wtd-route-map-marker:hover {
	transform: scale(1.08);
	box-shadow: 0 4px 10px rgba(15, 23, 42, 0.35);
}

.wtd-route-map-marker__letter {
	font-family: 'Roboto Slab', Georgia, serif;
	font-weight: 700;
	font-size: 14px;
	line-height: 1;
}

.wtd-route-map-marker__icon {
	width: 55%;
	height: 55%;
}

.wtd-route-map-marker__day {
	display: inline-block;
	margin-top: 2px;
	padding: 2px 6px;
	font-family: 'Roboto', system-ui, sans-serif;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #0F172A;
	background: rgba(255, 255, 255, 0.92);
	border-radius: 4px;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
	white-space: nowrap;
	pointer-events: none;
}

/* ── Popup wrap — override Leaflet's default chrome ──────────────── */
/* Apply the interior padding on the WRAPPER (not the content) so Voxel
   theme rules targeting .leaflet-popup-content margins can't undo it. */
.wtd-route-map-popup-wrap .leaflet-popup-content-wrapper {
	border-radius: 12px;
	box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
	padding: 28px 28px 26px !important;
	background: #ffffff;
	position: relative;
}

.wtd-route-map-popup-wrap .leaflet-popup-content {
	margin: 0 !important;
	padding: 0 !important;
	min-width: 240px;
	max-width: 320px;
	font-family: 'Open Sans', system-ui, sans-serif;
	line-height: 1.45;
}

/* Allow the triangle pseudo-element to overflow Leaflet's containers.
   Without this, the triangle is clipped by the popup pane. Same technique
   used by voxel-poi-map for its hover tooltips. */
.wtd-route-map .leaflet-popup-pane,
.wtd-route-map-popup-wrap,
.wtd-route-map-popup-wrap .leaflet-popup,
.wtd-route-map-popup-wrap .leaflet-popup-content-wrapper {
	overflow: visible !important;
}

/* Hide Leaflet's built-in tip — Voxel's CSS keeps overriding it. We
   draw our own triangle via a ::after on the popup wrapper instead. */
.wtd-route-map-popup-wrap .leaflet-popup-tip-container,
.wtd-route-map-popup-wrap .leaflet-popup-tip {
	display: none !important;
}

/* Custom triangle — pure CSS border trick on a pseudo-element of the
   bubble. Identical pattern to voxel-poi-map's .vxpoi-tooltip::after. */
.wtd-route-map-popup-wrap .leaflet-popup-content-wrapper::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border: 10px solid transparent;
	border-top-color: #ffffff;
	filter: drop-shadow(0 4px 6px rgba(15, 23, 42, 0.15));
	pointer-events: none;
}

/* ── Popup content ───────────────────────────────────────────────── */
.wtd-route-map-popup__pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 12px;
	align-items: center;
}

/* Re-assert pill styling inside popups (themes may reset spans).
   Tighter padding + smaller font + stronger background tint so the
   pill colors are clearly recognizable at a glance. */
.wtd-route-map-popup .wtd-pill {
	display: inline-flex;
	align-items: center;
	padding: 3px 9px !important;
	border-radius: 999px;
	font-size: 10px !important;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	line-height: 1.4;
	white-space: nowrap;
}
.wtd-route-map-popup .wtd-pill--bouy       { background: rgba(242,100,25,0.22) !important;  color: #A03D14 !important; }
.wtd-route-map-popup .wtd-pill--deep-ocean { background: rgba(10,77,140,0.20)  !important;  color: #06376A !important; }
.wtd-route-map-popup .wtd-pill--wave       { background: rgba(42,166,160,0.24) !important;  color: #0F605C !important; }
.wtd-route-map-popup .wtd-pill--sky        { background: rgba(136,207,239,0.45) !important; color: #154D6F !important; }
.wtd-route-map-popup .wtd-pill--seafoam    { background: rgba(162,213,198,0.50) !important; color: #2E614F !important; }
.wtd-route-map-popup .wtd-pill--charcoal   { background: rgba(13,13,13,0.12)   !important;  color: #0D0D0D !important; }
.wtd-route-map-popup .wtd-pill--amber      { background: rgba(234,179,8,0.28)  !important;  color: #7A4708 !important; }

/* Reset h3/p browser/theme defaults inside the popup so our margins win. */
.wtd-route-map-popup h3.wtd-route-map-popup__name,
.wtd-route-map-popup p.wtd-route-map-popup__meta,
.wtd-route-map-popup p.wtd-route-map-popup__note {
	margin-block-start: 0;
	margin-block-end: 0;
	padding: 0;
}

.wtd-route-map-popup h3.wtd-route-map-popup__name {
	font-family: 'Roboto Slab', Georgia, serif !important;
	font-size: 20px !important;
	font-weight: 700 !important;
	line-height: 1.2 !important;
	color: #0f172a !important;
	margin: 0 0 2px !important;
}

.wtd-route-map-popup p.wtd-route-map-popup__meta {
	margin: 0 0 10px !important;
	font-size: 13px !important;
	color: #475569 !important;
	line-height: 1.4 !important;
}

.wtd-route-map-popup p.wtd-route-map-popup__note {
	margin: 6px 0 12px !important;
	font-size: 14px !important;
	line-height: 1.45 !important;
	color: #334155 !important;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wtd-route-map-popup__cta {
	display: inline-block;
	color: #F26419;
	font-weight: 600;
	font-size: 14px;
	text-decoration: none;
	margin-top: 4px;
}

.wtd-route-map-popup__cta:hover {
	text-decoration: underline;
}

.wtd-route-map-popup__cta span {
	margin-left: 4px;
}

/* ── Reset-view button (corner control) ──────────────────────────── */
.wtd-route-map-reset-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	background: #fff;
	border: 1px solid rgba(15, 23, 42, 0.15);
	border-radius: 6px;
	box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
	cursor: pointer;
	font-size: 16px;
	color: #475569;
	margin-top: 8px;
	margin-left: 8px;
}

.wtd-route-map-reset-btn:hover {
	background: #f8fafc;
	color: #0A4D8C;
}

/* ── Editor empty-state placeholder ──────────────────────────────── */
.wtd-route-map-wrap .wtd-route-empty {
	padding: 16px;
	border: 1px dashed #cbd5e1;
	border-radius: 8px;
	color: #64748b;
	font-style: italic;
	text-align: center;
}
