﻿.sn-terminals-map {
	--sn-red: #C60E0E;
	--sn-yellow: #FFDB03;
	--sn-ink: #00001C;
	--sn-ink-soft: #1A1A1A;
	--sn-muted: #7F7F7F;
	--sn-line: #EDEDED;
	--sn-side: 300px;

	display: flex;
	width: 100%;
	max-width: 100%;
	height: min(720px, 80vh);
	min-height: 520px;
	margin: 0 auto;
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 4px 4px 32px rgba(0, 0, 0, 0.12);
	font-family: inherit;
	color: var(--sn-ink-soft);
	isolation: isolate;
}

.sn-terminals-map__stage {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
}

.sn-terminals-map__canvas {
	width: 100%;
	height: 100%;
	background: #dbe4ea;
	z-index: 1;
}

.sn-terminals-map__compass {
	/* Sit below Leaflet zoom (+/−) so controls stay clickable */
	position: absolute;
	top: 86px;
	left: 10px;
	z-index: 450;
	width: 96px;
	height: 96px;
	pointer-events: none;
	filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.sn-terminals-map__compass svg {
	display: block;
	width: 100%;
	height: 100%;
}

.sn-terminals-map__legend {
	position: absolute;
	left: 12px;
	bottom: 12px;
	z-index: 500;
	padding: 10px 12px;
	background: rgba(255, 255, 255, 0.95);
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	font-size: 11px;
	font-weight: 600;
	color: var(--sn-ink);
	pointer-events: none;
}

.sn-terminals-map__legend-title {
	margin: 0 0 6px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.sn-terminals-map__legend-row {
	display: flex;
	align-items: center;
	gap: 8px;
}

.sn-terminals-map__legend-pin {
	display: block;
	width: 18px;
	height: 26px;
	object-fit: contain;
	flex: none;
}

.sn-terminals-map__sidebar {
	flex: 0 0 var(--sn-side);
	width: var(--sn-side);
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 20px 14px 16px;
	background: #fff;
	box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
	z-index: 2;
}

.sn-terminals-map__side-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 4px 4px;
}

.sn-terminals-map__bus {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--sn-yellow);
	color: var(--sn-ink);
	flex: none;
}

.sn-terminals-map__title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: var(--sn-ink);
	line-height: 1.2;
}

.sn-terminals-map__count {
	display: inline-block;
	margin-top: 2px;
	padding: 2px 8px;
	border-radius: 999px;
	background: #fff3c4;
	color: var(--sn-ink);
	font-size: 11px;
	font-weight: 600;
}

.sn-terminals-map__list {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding-right: 8px;
	scrollbar-width: thin;
	scrollbar-color: var(--sn-ink) var(--sn-line);
}

.sn-terminals-map__list::-webkit-scrollbar { width: 4px; }
.sn-terminals-map__list::-webkit-scrollbar-thumb { background: var(--sn-ink); border-radius: 99px; }

/* Accordion items (match Cubao-style open panel) */
.sn-terminals-map__item {
	border-bottom: 0.5px solid var(--sn-muted);
	margin-bottom: 4px;
}

.sn-terminals-map__header {
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	margin: 0 !important;
	padding: 10px 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	color: var(--sn-ink) !important;
	font: inherit !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1.4 !important;
	text-align: left !important;
	cursor: pointer;
	box-shadow: none !important;
}

.sn-terminals-map__item.is-open .sn-terminals-map__header {
	color: var(--sn-red) !important;
}

.sn-terminals-map__header-label {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.sn-terminals-map__num {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--sn-yellow);
	color: var(--sn-ink);
	font-size: 11px;
	font-weight: 700;
}

.sn-terminals-map__item-name {
	font-weight: 700;
}

.sn-terminals-map__chev {
	display: inline-flex;
	width: 18px;
	height: 18px;
	flex: none;
	color: inherit;
	transition: transform 0.25s ease;
}

.sn-terminals-map__item.is-open .sn-terminals-map__chev {
	transform: rotate(180deg);
	color: var(--sn-red);
}

.sn-terminals-map__body {
	overflow: hidden;
	max-height: 0;
	transition: max-height 0.35s ease;
}

.sn-terminals-map__item.is-open .sn-terminals-map__body {
	max-height: 520px;
}

.sn-terminals-map__body-inner {
	padding: 0 0 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sn-terminals-map__photo {
	width: 100%;
	height: 140px;
	border-radius: 5px;
	object-fit: cover;
	display: block;
	background: var(--sn-line);
}

.sn-terminals-map__meta {
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-size: 12px;
	line-height: 1.6;
	color: var(--sn-ink-soft);
}

.sn-terminals-map__meta b {
	font-weight: 700;
	color: var(--sn-ink);
}

.sn-terminals-map__cta {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	margin-top: 4px;
	padding: 8px 10px !important;
	border-radius: 5px !important;
	background: var(--sn-ink) !important;
	color: #fff !important;
	font-size: 12px !important;
	font-weight: 700 !important;
	text-decoration: none !important;
	border: 0 !important;
	box-shadow: none !important;
}

.sn-terminals-map__cta:hover {
	background: var(--sn-red) !important;
	color: #fff !important;
}

/* Leaflet compass marker + label */
.sn-map-marker {
	background: transparent !important;
	border: 0 !important;
	cursor: pointer;
}

.sn-map-marker__wrap {
	position: relative;
	width: 22px !important;
	height: 30px !important;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: visible;
}

.sn-map-marker__pin {
	display: block !important;
	width: 22px !important;
	height: 30px !important;
	max-width: 22px !important;
	max-height: 30px !important;
	object-fit: contain !important;
	/* Drop black PNG background on the map */
	mix-blend-mode: screen;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
	transition: transform 0.2s ease;
	pointer-events: none;
}

.sn-map-marker.is-active .sn-map-marker__pin {
	transform: scale(1.2);
}

.sn-map-marker__pulse {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
	height: 18px;
	margin: -9px 0 0 -9px;
	border-radius: 50%;
	background: rgba(198, 14, 14, 0.35);
	opacity: 0;
	pointer-events: none;
}

.sn-map-marker.is-active .sn-map-marker__pulse {
	animation: sn-map-pulse 1.6s ease-out infinite;
}

@keyframes sn-map-pulse {
	0% { transform: scale(0.6); opacity: 0.7; }
	100% { transform: scale(2.4); opacity: 0; }
}

.sn-map-marker__label {
	position: absolute;
	padding: 3px 8px;
	border-radius: 3px;
	background: var(--sn-ink);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	white-space: nowrap;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
	pointer-events: none;
	z-index: 2;
	/* Hidden until zoomed in or (desktop) hovered — reduces Metro Manila clutter */
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.15s ease, visibility 0.15s ease;
}

/* Permanent labels only when zoomed in enough (.is-labels-on from JS) */
.sn-terminals-map.is-labels-on .sn-map-marker:not(.is-active) .sn-map-marker__label {
	opacity: 1;
	visibility: visible;
}

/* Desktop / fine pointer: reveal name on hover at any zoom */
@media (hover: hover) and (pointer: fine) {
	.sn-map-marker:not(.is-active):hover .sn-map-marker__label {
		opacity: 1;
		visibility: visible;
	}
}

.sn-map-marker__label--top {
	left: 50%;
	top: 0;
	transform: translate(-50%, -110%);
}

.sn-map-marker__label--top-far {
	left: 50%;
	top: 0;
	transform: translate(-50%, -175%);
}

.sn-map-marker__label--top-left {
	left: 0;
	top: 0;
	transform: translate(-100%, -110%);
	margin-left: -4px;
}

.sn-map-marker__label--top-right {
	left: 100%;
	top: 0;
	transform: translate(0, -110%);
	margin-left: 4px;
}

.sn-map-marker__label--left {
	left: 0;
	top: 50%;
	transform: translate(-100%, -50%);
	margin-left: -6px;
}

.sn-map-marker__label--right {
	left: 100%;
	top: 50%;
	transform: translate(0, -50%);
	margin-left: 6px;
}

.sn-map-marker.is-active .sn-map-marker__label {
	display: none;
}

/* Popup card — flush photo to top (no Leaflet margin/whitespace gap) */
.sn-map-popup .leaflet-popup-content-wrapper {
	border-radius: 10px;
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
	padding: 0 !important;
	overflow: hidden;
}

.sn-map-popup .leaflet-popup-content {
	margin: 0 !important;
	padding: 0 !important;
	min-width: 220px;
	max-width: 260px;
	line-height: 0; /* kills gap above first <img> */
	width: auto !important;
}

.sn-map-popup .leaflet-popup-tip {
	box-shadow: none;
}

.sn-map-popup .leaflet-popup-close-button {
	top: 6px !important;
	right: 6px !important;
	width: 24px !important;
	height: 24px !important;
	z-index: 2;
	background: rgba(0, 0, 0, 0.45) !important;
	color: #fff !important;
	border-radius: 50%;
	font-size: 18px !important;
	line-height: 22px !important;
	text-align: center;
	padding: 0 !important;
}

.sn-map-card__media {
	position: relative;
	display: block;
	margin: 0;
	padding: 0;
	line-height: 0;
	overflow: hidden;
	aspect-ratio: 16 / 10;
	background: transparent;
}

.sn-map-card__photo {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	object-fit: cover;
	object-position: center center;
}

.sn-map-card__body {
	padding: 12px 14px 14px;
	line-height: 1.4;
}

.sn-map-card__name {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: var(--sn-ink);
	line-height: 1.25;
}

.sn-map-card__loc {
	margin: 2px 0 8px;
	font-size: 12px;
	color: var(--sn-muted);
	font-weight: 500;
}

.sn-map-card__meta {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	margin: 0 0 6px;
	font-size: 11px;
	line-height: 1.4;
	color: var(--sn-ink-soft);
}

.sn-map-card__meta svg {
	flex: none;
	margin-top: 1px;
	color: var(--sn-yellow);
	fill: currentColor;
}

.sn-map-card__routes-label {
	margin: 8px 0 4px;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--sn-muted);
}

.sn-map-card__routes {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0 0 10px;
}

.sn-map-card__pill {
	display: inline-block;
	padding: 3px 8px;
	border-radius: 999px;
	background: #e8f4ff;
	color: #1a3a6b;
	font-size: 10px;
	font-weight: 600;
}

.sn-map-card__cta {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	padding: 9px 12px !important;
	border: 0 !important;
	border-radius: 6px !important;
	background: var(--sn-ink) !important;
	color: #fff !important;
	font-size: 12px !important;
	font-weight: 700 !important;
	text-decoration: none !important;
	box-shadow: none !important;
}

.sn-map-card__cta:hover {
	background: var(--sn-red) !important;
	color: #fff !important;
}

.sn-terminals-map .leaflet-control-zoom a {
	border-radius: 4px !important;
	color: var(--sn-ink) !important;
}

@media (max-width: 900px) {
	.sn-terminals-map {
		flex-direction: column;
		height: auto;
		min-height: 0;
	}
	.sn-terminals-map__stage {
		height: min(52vh, 420px);
		min-height: 280px;
	}
	.sn-terminals-map__sidebar {
		width: 100%;
		flex-basis: auto;
		max-height: 360px;
		box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
	}
	.sn-terminals-map__compass {
		top: 78px;
		left: 8px;
		width: 72px;
		height: 72px;
	}
	/* Compact permanent labels on phones when zoomed in */
	.sn-terminals-map.is-labels-on .sn-map-marker__label {
		font-size: 9px;
		padding: 2px 6px;
	}
	.sn-terminals-map .leaflet-control-zoom a {
		width: 36px !important;
		height: 36px !important;
		line-height: 36px !important;
		font-size: 18px !important;
	}
	.sn-map-popup .leaflet-popup-content {
		min-width: 0;
		max-width: min(260px, calc(100vw - 48px));
	}
}

@media (max-width: 480px) {
	.sn-terminals-map__compass {
		top: 74px;
		left: 6px;
		width: 60px;
		height: 60px;
	}
	.sn-terminals-map__legend {
		padding: 8px 10px;
		font-size: 10px;
	}
	.sn-terminals-map__stage {
		height: min(48vh, 360px);
	}
}
