/* 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);
}

.vh-location__row-dist {
	flex: none;
	margin-left: auto;
	color: var(--vh-color-muted);
	font-size: var(--vh-fs-small);
	font-variant-numeric: tabular-nums;
	text-align: right;
}

@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;
	}
}
