/* Khối Vị trí – map-distances. Mobile trước, mốc 640px / 1024px. Bản đồ tĩnh vẽ bằng biến màu, không ảnh ngoài. */

/* Mobile theo thứ tự DOM: địa chỉ → bản đồ → danh sách. Desktop: trái địa chỉ + danh sách, phải bản đồ. */
.vh-location {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--vh-card-gap);
}

.vh-location__addr {
	display: grid;
	gap: 1rem;
	padding: var(--vh-card-pad);
	background: var(--vh-color-card);
	color: var(--vh-color-text);
	border: 1px solid var(--vh-color-border);
	border-radius: var(--vh-radius-card);
}

.vh-location__addr-line {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	margin: 0;
	font-size: var(--vh-fs-lead);
	font-weight: var(--vh-fw-medium);
	line-height: var(--vh-lh-body);
}

/* Biểu tượng trong vòng tròn tint 48px. */
.vh-location__ic {
	flex: none;
	display: inline-grid;
	place-items: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: var(--vh-color-surface);
	color: var(--vh-color-primary);
}

.vh-location__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.vh-location__actions .vh-btn {
	flex: 1 1 10rem;
}

/* ---- Bản đồ tĩnh ---- */
/* width 100%: ô lưới có aspect-ratio không tự giãn, trình duyệt suy bề rộng từ min-height (288 × 4/3 = 384px) và tràn màn hình điện thoại. */
.vh-location__map {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: center;
	width: 100%;
	min-width: 0;
	min-height: 18rem;
	aspect-ratio: 4 / 3;
	padding: var(--vh-card-pad);
	overflow: hidden;
	border: 1px solid var(--vh-color-border);
	border-radius: var(--vh-radius-media);
	background-color: var(--vh-color-surface);
	background-image:
		linear-gradient(var(--vh-color-border) 1px, transparent 1px),
		linear-gradient(90deg, var(--vh-color-border) 1px, transparent 1px);
	background-size: 2rem 2rem;
}

.vh-location__art {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.vh-location__road {
	position: absolute;
	background: var(--vh-color-card);
	border: 1px solid var(--vh-color-border-strong);
}

.vh-location__road--h {
	left: -10%;
	right: -10%;
	top: 46%;
	height: 0.875rem;
	transform: rotate(-5deg);
}

.vh-location__road--v {
	top: -10%;
	bottom: -10%;
	left: 34%;
	width: 0.875rem;
	transform: rotate(9deg);
}

.vh-location__road--d {
	top: -10%;
	bottom: -10%;
	left: 72%;
	width: 0.5rem;
	transform: rotate(-24deg);
}

/* Ghim cam ở giữa, đầu nhọn chạm tâm hộp. */
.vh-location__pin {
	position: absolute;
	left: 50%;
	top: 40%;
	display: grid;
	place-items: center;
	width: 3rem;
	height: 3rem;
	border-radius: 50%;
	background: var(--vh-color-primary);
	color: var(--vh-color-on-primary);
	box-shadow: var(--vh-shadow-card);
	transform: translate(-50%, -50%);
}

.vh-location__pin-label {
	position: absolute;
	left: 50%;
	top: calc(40% + 2rem);
	max-width: calc(100% - 2rem);
	padding: 0.25rem 0.75rem;
	overflow: hidden;
	border-radius: var(--vh-radius-chip);
	background: var(--vh-color-card);
	color: var(--vh-color-text);
	box-shadow: var(--vh-shadow-card);
	font-size: var(--vh-fs-small);
	font-weight: var(--vh-fw-medium);
	white-space: nowrap;
	text-overflow: ellipsis;
	transform: translateX(-50%);
}

.vh-location__map-cta {
	position: relative;
	z-index: 1;
	display: grid;
	justify-items: center;
	gap: 0.5rem;
	width: 100%;
}

.vh-location__map-note {
	margin: 0;
	padding: 0.125rem 0.625rem;
	border-radius: var(--vh-radius-chip);
	background: var(--vh-color-card);
	color: var(--vh-color-muted);
	font-size: var(--vh-fs-small);
	text-align: center;
}

/* iframe do JS chèn khi bấm "Xem bản đồ": hộp là data-vh-iframe-host nên JS xóa hình vẽ và gắn iframe thẳng vào hộp, phủ kín. */
.vh-location__map iframe {
	position: absolute;
	inset: 0;
	z-index: 2;
	width: 100%;
	height: 100%;
	min-height: 0;
	border: 0;
}

.vh-location__map.is-loaded {
	padding: 0;
	background-image: none;
}

/* ---- Danh sách gần đó + di chuyển ---- */
.vh-location__lists {
	display: grid;
	gap: var(--vh-card-gap);
}

.vh-location__group .vh-h3 {
	margin: 0 0 0.5rem;
}

.vh-location__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.vh-location__row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-height: 48px;
	padding: 0.5rem 0;
	border-bottom: 1px solid var(--vh-color-border);
}

.vh-location__row:last-child {
	border-bottom: 0;
}

.vh-location__row--transport {
	align-items: flex-start;
}

.vh-location__row-ic {
	flex: none;
	display: inline-flex;
	color: var(--vh-color-muted);
}

.vh-location__row--transport .vh-location__row-ic {
	padding-top: 0.125rem;
}

.vh-location__row-body {
	display: grid;
	flex: 1 1 auto;
	min-width: 0;
}

.vh-location__row-name {
	flex: 1 1 auto;
	min-width: 0;
	font-weight: var(--vh-fw-medium);
	color: var(--vh-color-text);
}

.vh-location__row-text {
	color: var(--vh-color-muted);
	font-size: var(--vh-fs-small);
}

/* Giá/khoảng cách co và xuống dòng trong tối đa nửa hàng, không đè lên tên điểm (giá dài như "260.000 ₫/xe 7 chỗ, …"). */
.vh-location__row-dist {
	flex: 0 1 auto;
	min-width: 0;
	max-width: 50%;
	overflow-wrap: break-word;
	margin-left: auto;
	color: var(--vh-color-muted);
	font-size: var(--vh-fs-small);
	font-variant-numeric: tabular-nums;
	text-align: right;
}

/* Điện thoại hẹp: giá của hàng di chuyển xuống dưới tên, thẳng cột chữ (không bóp tên còn một chữ mỗi dòng). */
@media (max-width: 479.98px) {
	.vh-location__row--route {
		flex-wrap: wrap;
		row-gap: 0.125rem;
	}

	.vh-location__row--route .vh-location__row-dist {
		flex-basis: 100%;
		max-width: none;
		margin-left: calc(20px + 0.75rem);
		text-align: left;
	}
}

/* Điện thoại: nhãn tên trên bản đồ tĩnh nằm trên ghim, không bị nút "Xem bản đồ" che giữa tên. */
@media (max-width: 639.98px) {
	.vh-location__pin-label {
		top: auto;
		bottom: calc(60% + 2rem);
	}
}

@media (min-width: 640px) {
	.vh-location__lists {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.vh-location__lists > :only-child {
		grid-column: 1 / -1;
	}

	.vh-location__map {
		aspect-ratio: 16 / 9;
	}
}

@media (min-width: 1024px) {
	.vh-location--map {
		grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
		grid-template-areas: "addr map" "lists map";
		grid-template-rows: auto 1fr;
		align-items: start;
	}

	.vh-location--map .vh-location__addr {
		grid-area: addr;
	}

	.vh-location--map .vh-location__lists {
		grid-area: lists;
	}

	.vh-location--map .vh-location__map {
		grid-area: map;
		align-self: stretch;
		aspect-ratio: auto;
		min-height: 26rem;
	}

	/* Cột trái hẹp: hai danh sách xếp chồng. */
	.vh-location--map .vh-location__lists {
		grid-template-columns: minmax(0, 1fr);
	}

	/* Không bản đồ: địa chỉ trên, hai danh sách cạnh nhau. */
	.vh-location:not(.vh-location--map) .vh-location__addr {
		max-width: 40rem;
	}
}

/* =====================================================================
 * Tùy chọn của map-distances (đợt mẫu mới) và phần dùng chung với routes, transit-board. Chỉ thêm lớp mới.
 * ===================================================================== */

/* Dòng mùa/thời tiết dưới địa chỉ. */
.vh-location__season {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin: 0;
	color: var(--vh-color-muted);
	font-size: var(--vh-fs-small);
	line-height: var(--vh-lh-body);
}

.vh-location__season .vh-i {
	flex: none;
	color: var(--vh-color-primary);
}

/* Tông bản đồ tĩnh: chỉ đổi màu nền, đường và ghim bằng biến của mẫu. */
.vh-location__map--sepia {
	background-color: var(--vh-color-surface-2, var(--vh-color-surface));
}

/* Lọc chỉ phần hình vẽ, không lọc nút "Xem bản đồ" (giữ tương phản của nút). */
.vh-location__map--sepia .vh-location__art {
	filter: sepia(0.45);
}

.vh-location__map--ink {
	background-color: var(--vh-color-bg);
	background-image:
		linear-gradient(var(--vh-color-border-strong) 1px, transparent 1px),
		linear-gradient(90deg, var(--vh-color-border-strong) 1px, transparent 1px);
	background-size: 2.5rem 2.5rem;
}

.vh-location__map--ink .vh-location__road {
	background: var(--vh-color-bg);
	border-color: var(--vh-color-text);
}

.vh-location__map--ink .vh-location__pin {
	background: var(--vh-color-text);
	color: var(--vh-color-bg);
	box-shadow: none;
}

.vh-location__map--grayscale .vh-location__art {
	filter: grayscale(1);
}

.vh-location__map--pastel {
	background-color: var(--vh-color-accent);
}

/* Đường đi nét đứt tới ghim (routes). */
.vh-location__route {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.vh-location__route path {
	fill: none;
	stroke: var(--vh-color-primary);
	stroke-width: 0.9;
	stroke-dasharray: 2.4 1.8;
	stroke-linecap: round;
	vector-effect: non-scaling-stroke;
}

.vh-location__map--route .vh-location__route path {
	stroke-width: 3;
}

/* distances: chips. */
.vh-location__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.vh-location__chip {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem 0.5rem;
	min-height: 44px;
	padding: 0.5rem 0.875rem;
	border: 1px solid var(--vh-color-border);
	border-radius: var(--vh-radius-chip);
	background: var(--vh-color-card);
	color: var(--vh-color-text);
	font-size: var(--vh-fs-small);
	line-height: 1.3;
}

.vh-location__chip .vh-i {
	flex: none;
	color: var(--vh-color-primary);
}

.vh-location__chip-name {
	font-weight: var(--vh-fw-medium);
}

.vh-location__chip-dist {
	color: var(--vh-color-muted);
	font-variant-numeric: tabular-nums;
}

/* distances: two-col — danh sách dài chia 2 cột từ 640px. */
@media (min-width: 640px) {
	.vh-location__list--cols {
		column-count: 2;
		column-gap: var(--vh-card-gap);
	}

	.vh-location__list--cols .vh-location__row {
		break-inside: avoid;
	}

	.vh-location__list--cols .vh-location__row:last-child {
		border-bottom: 1px solid var(--vh-color-border);
	}
}

/* two-col trên máy tính: bản đồ trên cùng, hai nhóm cạnh nhau bên dưới (bản đồ + địa chỉ một hàng). */
@media (min-width: 1024px) {
	.vh-location--map:has(.vh-location__lists--two-col) {
		grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
		grid-template-areas: "addr map" "lists lists";
	}

	.vh-location--map .vh-location__lists--two-col {
		grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
	}
}

/* transport: card — khung thẻ có nút đặt xe (A4). */
.vh-location__group--card {
	padding: var(--vh-card-pad);
	border: 1px solid var(--vh-color-border);
	border-radius: var(--vh-radius-card);
	background: var(--vh-color-card);
	box-shadow: var(--vh-shadow-card);
}

.vh-location__transfer {
	width: 100%;
	margin-top: 0.75rem;
}

@media (min-width: 640px) {
	.vh-location__transfer {
		width: auto;
	}
}
