/* VR Tour — frontend */

.vrt-tour {
	--vrt-accent: #c9a24b;
	--vrt-glass: rgba(15, 18, 24, .62);
	--vrt-glass-strong: rgba(15, 18, 24, .86);
	--vrt-text: #fff;
	--vrt-muted: rgba(255, 255, 255, .7);
	--vrt-radius: 10px;
	--vrt-menu-w: 280px;

	position: relative;
	width: 100%;
	height: var(--vrt-height, 70vh);
	min-height: 320px;
	overflow: hidden;
	background: #0b0d12;
	color: var(--vrt-text);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.4;
	isolation: isolate;
}
.vrt-tour *, .vrt-tour *::before, .vrt-tour *::after { box-sizing: border-box; }

.vrt-tour__viewer { position: absolute; inset: 0; }
.vrt-tour__notice { padding: 12px 16px; border: 1px dashed #c3c4c7; color: #50575e; }
.vrt-tour__error { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; padding: 12px 18px; border-radius: var(--vrt-radius); background: var(--vrt-glass-strong); }

/* Trang toàn màn hình */
html:has(body.vrt-page), body.vrt-page { margin: 0; height: 100%; background: #0b0d12; overflow: hidden; }
.vrt-page__main { height: 100vh; height: 100dvh; }
.vrt-tour--page { height: 100%; min-height: 0; }

/* Fullscreen */
.vrt-tour:fullscreen { height: 100%; }
.vrt-tour:-webkit-full-screen { height: 100%; width: 100%; }
.vrt-tour.is-pseudo-fs { position: fixed; inset: 0; z-index: 999999; height: 100%; height: 100dvh; }
html.vrt-lock-scroll, html.vrt-lock-scroll body { overflow: hidden; }

/* Pannellum: điều khiển zoom gọn hơn, đặt lên trên menu */
.vrt-tour .pnlm-controls-container { top: auto; bottom: 120px; left: auto; right: 14px; }
.vrt-tour .pnlm-load-box { background: var(--vrt-glass-strong); border-radius: var(--vrt-radius); }
.vrt-tour .pnlm-compass { top: auto; bottom: 200px; right: 14px; }

/* ---------- lớp UI ---------- */
.vrt-ui { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.vrt-ui > * { pointer-events: auto; }

.vrt-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-width: 42px; height: 42px; padding: 0 10px;
	border: 0; border-radius: 999px;
	background: var(--vrt-glass); color: var(--vrt-text);
	backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
	cursor: pointer; font: inherit; transition: background .2s, color .2s;
}
.vrt-btn:hover { background: var(--vrt-glass-strong); }
.vrt-btn:focus-visible { outline: 2px solid var(--vrt-accent); outline-offset: 2px; }
.vrt-btn.is-on { color: var(--vrt-accent); }
.vrt-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.vrt-btn--sound svg { fill: currentColor; stroke: none; }
.vrt-btn--sound:not(.is-on) svg { fill: none; stroke: currentColor; }

/* Đầu trang: logo + tên */
.vrt-head { position: absolute; top: 14px; left: 66px; right: 14px; display: flex; align-items: center; gap: 12px; pointer-events: none; transition: left .3s; }
.vrt-logo { max-height: 44px; max-width: 140px; width: auto; filter: drop-shadow(0 1px 4px rgba(0, 0, 0, .5)); }
.vrt-titles { text-shadow: 0 1px 6px rgba(0, 0, 0, .7); min-width: 0; }
.vrt-titles__tour { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--vrt-muted); }
.vrt-titles__scene { font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vrt-tour:not(:has(.vrt-btn--menu)) .vrt-head { left: 14px; }

/* Menu cảnh */
.vrt-btn--menu { position: absolute; top: 14px; left: 14px; }
.vrt-menu {
	position: absolute; top: 0; bottom: 0; left: 0; width: var(--vrt-menu-w); max-width: 85%;
	padding: 64px 12px 16px; overflow-y: auto; overscroll-behavior: contain;
	background: var(--vrt-glass-strong); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
	transform: translateX(-100%); transition: transform .3s ease; visibility: hidden;
}
.vrt-tour.is-menu-open .vrt-menu { transform: none; visibility: visible; }
.vrt-tour.is-menu-open .vrt-btn--menu { z-index: 2; }
.vrt-tour.is-menu-open .vrt-head { left: calc(var(--vrt-menu-w) + 14px); }
.vrt-menu__close { position: absolute; top: 14px; right: 12px; background: transparent; }
.vrt-menu__close:hover { background: rgba(255, 255, 255, .1); }
.vrt-tour.is-menu-open .vrt-btn--menu { visibility: hidden; }

.vrt-menu__group { margin-bottom: 8px; }
.vrt-menu__group-title {
	width: 100%; display: flex; justify-content: space-between; align-items: center;
	padding: 10px 8px; border: 0; border-bottom: 1px solid rgba(255, 255, 255, .15);
	background: none; color: var(--vrt-accent); font: inherit; font-weight: 700;
	text-transform: uppercase; letter-spacing: .06em; font-size: 12px; cursor: pointer; text-align: left;
}
.vrt-menu__group-title::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .2s; }
.vrt-menu__group.is-open .vrt-menu__group-title::after { transform: rotate(45deg); }
.vrt-menu__list { list-style: none; margin: 6px 0 0; padding: 0; display: none; }
.vrt-menu__group.is-open .vrt-menu__list, .vrt-menu__group:not(:has(.vrt-menu__group-title)) .vrt-menu__list { display: block; }
.vrt-menu__list li { margin: 0; padding: 0; }
.vrt-menu__item {
	width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px; margin-bottom: 4px;
	border: 1px solid transparent; border-radius: 8px; background: none; color: var(--vrt-text);
	font: inherit; text-align: left; cursor: pointer;
}
.vrt-menu__item:hover { background: rgba(255, 255, 255, .08); }
.vrt-menu__item.is-active { border-color: var(--vrt-accent); background: rgba(201, 162, 75, .15); }
.vrt-menu__item img { width: 64px; height: 40px; object-fit: cover; border-radius: 5px; flex: none; }

/* Dải thumbnail */
.vrt-thumbs {
	/* width: max-content để left:50% không làm co khối; dư thì cuộn ngang */
	position: absolute; left: 50%; bottom: 66px; transform: translateX(-50%);
	width: max-content; max-width: calc(100% - 28px);
	display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px;
}
.vrt-thumbs::-webkit-scrollbar { display: none; }
.vrt-thumb {
	position: relative; flex: 0 0 120px; height: 68px; padding: 0; border: 2px solid rgba(255, 255, 255, .5); border-radius: 8px;
	overflow: hidden; background: #222; cursor: pointer; color: #fff; font: inherit; transition: border-color .2s, transform .2s;
}
.vrt-thumb:hover { transform: translateY(-2px); }
.vrt-thumb.is-active { border-color: var(--vrt-accent); }
.vrt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vrt-thumb span { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 6px 4px; font-size: 11px; text-align: left; background: linear-gradient(transparent, rgba(0, 0, 0, .8)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Thanh nút */
.vrt-bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 28px); display: flex; gap: 8px; }
.vrt-btn__text { font-size: 13px; white-space: nowrap; }
/* Menu mở: canh giữa trong phần còn lại bên phải menu */
.vrt-tour.is-menu-open .vrt-thumbs, .vrt-tour.is-menu-open .vrt-bar { left: calc(50% + var(--vrt-menu-w) / 2); max-width: calc(100% - var(--vrt-menu-w) - 28px); }

/* Hotspot */
.vrt-hs {
	width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	background: rgba(255, 255, 255, .25); border: 2px solid #fff;
	backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.vrt-hs::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.vrt-hs::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid #fff; animation: vrt-pulse 2s infinite; pointer-events: none; }
.vrt-hs--info { background: rgba(201, 162, 75, .55); }
.vrt-hs--info::before { content: "i"; width: auto; height: auto; background: none; color: #fff; font: 700 18px/1 Georgia, serif; }
.vrt-hs:hover::before, .vrt-hs:focus-visible::before { transform: scale(1.25); }
.vrt-hs:focus-visible { outline: 2px solid var(--vrt-accent); outline-offset: 3px; }
.vrt-hs__label {
	position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
	white-space: nowrap; padding: 4px 10px; border-radius: 999px; font-size: 13px;
	background: var(--vrt-glass-strong); color: #fff; pointer-events: none;
}
@keyframes vrt-pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(1.8); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .vrt-hs::after { animation: none; } }

/* ---------- popup ---------- */
.vrt-pop { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(0, 0, 0, .6); }
.vrt-pop[hidden] { display: none; }
.vrt-pop__box { display: flex; flex-direction: column; width: 100%; max-width: 1100px; max-height: 100%; border-radius: var(--vrt-radius); overflow: hidden; background: #14171e; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.vrt-pop--info .vrt-pop__box { max-width: 560px; }
.vrt-pop__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 18px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.vrt-pop__title { margin: 0; font-size: 16px; font-weight: 600; color: #fff; }
.vrt-pop__close { background: transparent; }
.vrt-pop__body { flex: 1; min-height: 0; overflow: auto; }

.vrt-info { padding: 18px; }
.vrt-info__img { width: 100%; height: auto; border-radius: 6px; margin-bottom: 14px; display: block; }
.vrt-info__text { color: rgba(255, 255, 255, .88); }
.vrt-info__text a { color: var(--vrt-accent); }
.vrt-info__text p { margin: 0 0 .8em; }

/* Gallery */
.vrt-gallery { display: flex; flex-direction: column; height: 100%; }
.vrt-gallery__stage { position: relative; flex: 1; min-height: 240px; height: min(70vh, 640px); background: #000; display: flex; align-items: center; justify-content: center; }
.vrt-gallery__img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.vrt-gallery__nav { position: absolute; top: 50%; transform: translateY(-50%); }
.vrt-gallery__prev { left: 10px; }
.vrt-gallery__next { right: 10px; }
.vrt-gallery__counter { text-align: center; padding: 8px 0 0; font-size: 12px; color: var(--vrt-muted); }
.vrt-gallery__caption { text-align: center; padding: 2px 16px; min-height: 1.4em; }
.vrt-gallery__strip { display: flex; gap: 6px; overflow-x: auto; padding: 10px 14px 14px; scrollbar-width: thin; }
.vrt-gallery__thumb { flex: 0 0 80px; height: 54px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: none; cursor: pointer; opacity: .6; }
.vrt-gallery__thumb.is-active { border-color: var(--vrt-accent); opacity: 1; }
.vrt-gallery__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Ảnh zoom (mặt bằng, vị trí) */
.vrt-zoom-wrap { position: relative; }
.vrt-zoom { height: min(75vh, 720px); overflow: hidden; display: flex; align-items: center; justify-content: center; background: #0b0d12; touch-action: none; cursor: zoom-in; }
.vrt-zoom.is-zoomed { cursor: grab; }
.vrt-zoom__img { max-width: 100%; max-height: 100%; user-select: none; transform-origin: center; transition: transform .05s linear; }
.vrt-zoom__tools { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; }

/* Vị trí */
.vrt-location__map { display: block; width: 100%; height: min(75vh, 720px); border: 0; }
.vrt-pop--location.has-both .vrt-location__map, .vrt-pop--location.has-both .vrt-zoom { height: min(60vh, 560px); }

/* ---------- mobile ---------- */
@media (max-width: 768px) {
	.vrt-tour { --vrt-menu-w: 260px; font-size: 13px; }
	/* Mobile: menu là drawer phủ lên, các thanh khác giữ nguyên vị trí */
	.vrt-tour.is-menu-open .vrt-head { left: 66px; }
	.vrt-tour.is-menu-open .vrt-thumbs, .vrt-tour.is-menu-open .vrt-bar { left: 50%; max-width: calc(100% - 28px); }
	.vrt-titles__scene { font-size: 15px; }
	.vrt-logo { max-height: 32px; }
	.vrt-btn__text { display: none; }
	.vrt-btn { min-width: 40px; height: 40px; padding: 0; }
	.vrt-thumb { flex-basis: 92px; height: 56px; }
	.vrt-thumbs { bottom: 62px; }
	.vrt-menu { z-index: 3; box-shadow: 10px 0 30px rgba(0, 0, 0, .4); }
	.vrt-tour .pnlm-controls-container { display: none; } /* mobile dùng chụm 2 ngón */
	.vrt-pop { padding: 0; }
	.vrt-pop__box { height: 100%; border-radius: 0; }
	.vrt-gallery__stage { height: auto; }
	.vrt-zoom, .vrt-location__map { height: calc(100dvh - 60px); }
	.vrt-pop--location.has-both .vrt-location__map, .vrt-pop--location.has-both .vrt-zoom { height: 50dvh; }
}

/* Tour nhúng thấp (< 480px): bỏ dải thumbnail cho thoáng */
@media (max-height: 480px) {
	.vrt-thumbs { display: none; }
}
