/* ==========================================================================
   MENU PHẢI - FLOATING ACTION BUTTON (GÓC PHẢI DƯỚI MÀN HÌNH)
   ========================================================================== */

/* 1. KHUNG CHỨA MENU PHẢI (LUÔN NỔI TRÊN CÙNG KỂ CẢ FULLSCREEN) */
.menu-phai-container {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 2147483647; /* Z-Index cao nhất để không bị canvas WebGL hay Fullscreen che */
	display: flex;
	flex-direction: column-reverse;
	align-items: center;
	gap: 12px;
	user-select: none;
	-webkit-user-select: none;
	pointer-events: auto;
}

/* Đảm bảo luôn hiển thị trong mọi chế độ Fullscreen của trình duyệt */
:fullscreen .menu-phai-container,
:-webkit-full-screen .menu-phai-container,
:-moz-full-screen .menu-phai-container,
:-ms-fullscreen .menu-phai-container {
	position: fixed !important;
	bottom: 24px !important;
	right: 24px !important;
	z-index: 2147483647 !important;
	display: flex !important;
}

/* 2. NÚT CHÍNH (NÚT TRÒN GÓC PHẢI) */
.menu-phai-main-btn {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: linear-gradient(135deg, #3b82f6, #1d4ed8);
	border: 1px solid rgba(255, 255, 255, 0.3);
	box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
	color: #ffffff;
	cursor: pointer;
	outline: none;
	display: flex;
	justify-content: center;
	align-items: center;
	transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	position: relative;
}

.menu-phai-main-btn:hover {
	transform: scale(1.08);
	box-shadow: 0 8px 25px rgba(59, 130, 246, 0.65), 0 3px 8px rgba(0, 0, 0, 0.4);
}

.menu-phai-main-btn:active {
	transform: scale(0.95);
}

/* Icon dấu cộng / menu bên trong nút chính */
.menu-phai-icon {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Khi menu mở (Active): Nút chính đổi màu và xoay icon thành dấu ✕ */
.menu-phai-container.active .menu-phai-main-btn {
	background: linear-gradient(135deg, #ef4444, #b91c1c);
	box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
}

.menu-phai-container.active .menu-phai-icon {
	transform: rotate(135deg);
}

/* 3. DANH SÁCH CÁC NÚT CON SỔ RA */
.menu-phai-list {
	display: flex;
	flex-direction: column-reverse;
	gap: 10px;
	padding: 0;
	margin: 0;
	list-style: none;
	pointer-events: none;
}

/* Khi mở menu: Cho phép tương tác với nút con */
.menu-phai-container.active .menu-phai-list {
	pointer-events: auto;
}

/* Từng mục nút con */
.menu-phai-item {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	opacity: 0;
	transform: translateY(20px) scale(0.5);
	transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Nút bấm con */
.menu-phai-sub-btn {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: rgba(18, 24, 38, 0.85);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border: 1px solid rgba(255, 255, 255, 0.2);
	color: #e2e8f0;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
	cursor: pointer;
	outline: none;
	display: flex;
	justify-content: center;
	align-items: center;
	transition: all 0.25s ease;
	position: relative;
}

.menu-phai-sub-btn svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: transform 0.25s ease, filter 0.25s ease;
}

.menu-phai-sub-btn:hover {
	transform: scale(1.12);
	background: rgba(30, 41, 59, 0.95);
	border-color: #38bdf8;
	color: #38bdf8;
	box-shadow: 0 6px 20px rgba(56, 189, 248, 0.35);
}

.menu-phai-sub-btn:hover svg {
	transform: scale(1.1);
}

.menu-phai-sub-btn:active {
	transform: scale(0.92);
}

/* ==========================================================================
   TRẠNG THÁI ĐANG BẬT (IS-ACTIVE / SÁNG ĐÈN PHÁT SÁNG KHI ĐANG HOẠT ĐỘNG)
   ========================================================================== */
.menu-phai-sub-btn.is-active {
	background: rgba(14, 165, 233, 0.32) !important;
	border-color: #38bdf8 !important;
	color: #38bdf8 !important;
	box-shadow: 0 0 18px rgba(56, 189, 248, 0.6), 0 4px 15px rgba(0, 0, 0, 0.4) !important;
}

.menu-phai-sub-btn.is-active svg {
	filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.9));
}

/* Nút tự động xoay khi đang BẬT: hiệu ứng xoay nhẹ biểu tượng */
#btn-autorotate.is-active svg {
	animation: rotateSpin 8s linear infinite;
}

@keyframes rotateSpin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* Chấm xanh lá phát sáng (ON Indicator) ở góc nút để nhận biết tính năng ĐANG BẬT */
.menu-phai-item.is-on::after {
	content: '';
	position: absolute;
	top: -1px;
	right: -1px;
	width: 10px;
	height: 10px;
	background: #22c55e;
	border-radius: 50%;
	border: 1.5px solid #0f172a;
	box-shadow: 0 0 10px #22c55e, 0 0 4px #22c55e;
	z-index: 10005;
	pointer-events: none;
	animation: indicatorGlow 2s infinite ease-in-out;
}

@keyframes indicatorGlow {
	0%, 100% {
		transform: scale(1);
		opacity: 1;
	}
	50% {
		transform: scale(1.2);
		opacity: 0.85;
	}
}

/* Nổi bật đặc biệt cho nút AR */
.btn-ar-highlight {
	background: rgba(14, 165, 233, 0.25) !important;
	border-color: rgba(56, 189, 248, 0.6) !important;
	color: #38bdf8 !important;
	box-shadow: 0 0 15px rgba(56, 189, 248, 0.35) !important;
}

.btn-ar-highlight:hover {
	background: rgba(14, 165, 233, 0.45) !important;
	box-shadow: 0 0 25px rgba(56, 189, 248, 0.65) !important;
}

/* Tooltip nhãn giải thích nút bên trái */
.menu-phai-tooltip {
	position: absolute;
	right: 54px;
	background: rgba(15, 23, 42, 0.92);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	color: #f8fafc;
	font-size: 12px;
	font-weight: 500;
	padding: 5px 10px;
	border-radius: 6px;
	border: 1px solid rgba(255, 255, 255, 0.15);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	white-space: nowrap;
	opacity: 0;
	transform: translateX(8px);
	pointer-events: none;
	transition: all 0.25s ease;
}

.menu-phai-item:hover .menu-phai-tooltip {
	opacity: 1;
	transform: translateX(0);
}

/* 4. HIỆU ỨNG XUẤT HIỆN LẦN LƯỢT (STAGGER ANIMATION) CHO 8 NÚT */
.menu-phai-container.active .menu-phai-item {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.menu-phai-container.active .menu-phai-item:nth-child(1) {
	transition-delay: 0.03s;
}
.menu-phai-container.active .menu-phai-item:nth-child(2) {
	transition-delay: 0.06s;
}
.menu-phai-container.active .menu-phai-item:nth-child(3) {
	transition-delay: 0.09s;
}
.menu-phai-container.active .menu-phai-item:nth-child(4) {
	transition-delay: 0.12s;
}
.menu-phai-container.active .menu-phai-item:nth-child(5) {
	transition-delay: 0.15s;
}
.menu-phai-container.active .menu-phai-item:nth-child(6) {
	transition-delay: 0.18s;
}
.menu-phai-container.active .menu-phai-item:nth-child(7) {
	transition-delay: 0.21s;
}
.menu-phai-container.active .menu-phai-item:nth-child(8) {
	transition-delay: 0.24s;
}

/* ==========================================================================
   5. RESPONSIVE ĐIỆN THOẠI & TỰ ĐỘNG ẨN MENU PHẢI KHI MỞ POPUP/DANH MỤC
   ========================================================================== */
@media screen and (max-width: 768px) {
	.menu-phai-container {
		bottom: calc(18px + env(safe-area-inset-bottom, 0px));
		right: calc(18px + env(safe-area-inset-right, 0px));
		gap: 10px;
		transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease;
	}

	.menu-phai-main-btn {
		width: 48px;
		height: 48px;
	}

	.menu-phai-sub-btn {
		width: 38px;
		height: 38px;
	}

	.menu-phai-sub-btn svg {
		width: 16px;
		height: 16px;
	}

	.menu-phai-tooltip {
		right: 48px;
		font-size: 11px;
		padding: 4px 8px;
	}

	body:has(.hotspot-node3-modal-overlay.active) #menu-phai-container,
	body:has(.hotspot-node4-modal-overlay.active) #menu-phai-container,
	body:has(.menu-trai-drawer.active) #menu-phai-container,
	body:has(.menu-trai-backdrop.active) #menu-phai-container,
	body:has(.menu-trai-modal.active) #menu-phai-container,
	body:has(.menu-trai-lightbox-modal.active) #menu-phai-container,
	body:has(.bancovan-modal.active) #menu-phai-container,
	body:has(.visitor-modal-overlay.active) #menu-phai-container,
	body:has(.lang-modal-overlay.active) #menu-phai-container,
	body:has(.ar-simulator-modal.active) #menu-phai-container,
	body:has(.zalo-guide-overlay.active) #menu-phai-container,
	body.popup-open-mobile #menu-phai-container,
	body.hotspot-modal-open #menu-phai-container,
	#menu-phai-container.mobile-hidden {
		opacity: 0 !important;
		visibility: hidden !important;
		pointer-events: none !important;
		transform: translateX(45px) scale(0.8) !important;
	}
}

/* ==========================================================================
   CHẾ ĐỘ KÍNH THỰC TẾ ẢO VR & CARDBOARD DÀNH CHO IPHONE & MOBILE
   ========================================================================== */

/* 1. Hiệu ứng nút VR khi đang BẬT */
.menu-phai-vr-item .menu-phai-sub-btn.is-active {
	background: rgba(14, 165, 233, 0.4) !important;
	border-color: #38bdf8 !important;
	color: #38bdf8 !important;
	box-shadow: 0 0 20px rgba(56, 189, 248, 0.8), 0 4px 15px rgba(0, 0, 0, 0.5) !important;
	animation: vrPulseGlow 2s infinite ease-in-out;
}

@keyframes vrPulseGlow {
	0%, 100% {
		box-shadow: 0 0 15px rgba(56, 189, 248, 0.6), 0 4px 15px rgba(0, 0, 0, 0.5);
	}
	50% {
		box-shadow: 0 0 25px rgba(56, 189, 248, 0.95), 0 4px 20px rgba(14, 165, 233, 0.7);
	}
}

/* 2. THANH ĐIỀU KHIỂN NỔI VR HUD (VR CONTROL BANNER) */
.vr-hud-overlay {
	position: fixed;
	top: calc(16px + env(safe-area-inset-top, 0px));
	left: 50%;
	transform: translateX(-50%) translateY(-20px);
	z-index: 2147483640;
	opacity: 0;
	pointer-events: none;
	transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
	width: calc(100% - 32px);
	max-width: 440px;
}

.vr-hud-overlay.active {
	transform: translateX(-50%) translateY(0);
	opacity: 1;
	pointer-events: auto;
}

.vr-hud-content {
	background: rgba(11, 19, 41, 0.92);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border: 1px solid rgba(56, 189, 248, 0.45);
	border-radius: 20px;
	padding: 12px 16px;
	box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.25);
	display: flex;
	flex-direction: column;
	gap: 8px;
	text-align: center;
}

.vr-hud-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 0.82rem;
	font-weight: 800;
	letter-spacing: 0.5px;
	color: #38bdf8;
	text-transform: uppercase;
}

.vr-hud-pulse {
	width: 8px;
	height: 8px;
	background: #38bdf8;
	border-radius: 50%;
	box-shadow: 0 0 8px #38bdf8;
	animation: vrPulseDot 1.4s infinite ease-in-out;
}

@keyframes vrPulseDot {
	0%, 100% { transform: scale(1); opacity: 1; }
	50% { transform: scale(1.6); opacity: 0.5; }
}

.vr-hud-guide {
	font-size: 0.76rem;
	color: #cbd5e1;
	margin: 0;
	line-height: 1.35;
}

.vr-hud-actions {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 4px;
	flex-wrap: wrap;
}

.vr-hud-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 7px 13px;
	border-radius: 999px;
	font-size: 0.76rem;
	font-weight: 700;
	cursor: pointer;
	border: 1px solid transparent;
	transition: all 0.2s ease;
	white-space: nowrap;
}

.vr-hud-btn.primary {
	background: linear-gradient(135deg, #ef4444, #dc2626);
	color: #ffffff;
	box-shadow: 0 3px 10px rgba(239, 68, 68, 0.35);
}

.vr-hud-btn.primary:active {
	transform: scale(0.96);
}

.vr-hud-btn.secondary {
	background: rgba(255, 255, 255, 0.08);
	border-color: rgba(255, 255, 255, 0.2);
	color: #e2e8f0;
}

.vr-hud-btn.secondary:hover,
.vr-hud-btn.secondary:active {
	background: rgba(56, 189, 248, 0.2);
	border-color: #38bdf8;
	color: #38bdf8;
}

/* 3. TOAST THÔNG BÁO VR */
.vr-toast-msg {
	position: fixed;
	bottom: calc(85px + env(safe-area-inset-bottom, 0px));
	left: 50%;
	transform: translateX(-50%) translateY(20px);
	background: rgba(11, 19, 41, 0.95);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border: 1px solid #38bdf8;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(56, 189, 248, 0.4);
	color: #ffffff;
	font-size: 0.82rem;
	font-weight: 600;
	padding: 10px 18px;
	border-radius: 999px;
	z-index: 2147483642;
	pointer-events: none;
	opacity: 0;
	transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	text-align: center;
	white-space: nowrap;
	max-width: 90vw;
}

.vr-toast-msg.show {
	transform: translateX(-50%) translateY(0);
	opacity: 1;
}

/* 4. CHẾ ĐỘ 2 MẮT KÍNH VR CARDBOARD (STEREO SPLIT-SCREEN) */
.vr-cardboard-overlay {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	background: #000000;
	z-index: 2147483645;
	display: none;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.vr-cardboard-overlay.active {
	display: flex;
}

.vr-cardboard-eye {
	flex: 1;
	height: 100%;
	position: relative;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000000;
}

.vr-cardboard-eye canvas {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.vr-cardboard-divider {
	width: 2px;
	height: 100%;
	background: rgba(255, 255, 255, 0.25);
	position: relative;
	z-index: 10;
	flex-shrink: 0;
}

.vr-cardboard-divider::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 8px;
	height: 8px;
	background: #38bdf8;
	border-radius: 50%;
	box-shadow: 0 0 10px #38bdf8;
}

.vr-cardboard-crosshair {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 12px;
	height: 12px;
	pointer-events: none;
	z-index: 5;
}

.vr-cardboard-crosshair::before,
.vr-cardboard-crosshair::after {
	content: '';
	position: absolute;
	background: rgba(255, 255, 255, 0.4);
}

.vr-cardboard-crosshair::before {
	top: 5px;
	left: 0;
	width: 12px;
	height: 2px;
}

.vr-cardboard-crosshair::after {
	top: 0;
	left: 5px;
	width: 2px;
	height: 12px;
}

.vr-cardboard-exit-btn {
	position: absolute;
	top: calc(14px + env(safe-area-inset-top, 0px));
	right: calc(14px + env(safe-area-inset-right, 0px));
	z-index: 20;
	background: rgba(15, 23, 42, 0.85);
	border: 1px solid rgba(255, 255, 255, 0.3);
	color: #ffffff;
	padding: 8px 14px;
	border-radius: 999px;
	font-size: 0.76rem;
	font-weight: 700;
	cursor: pointer;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	transition: all 0.2s ease;
}

.vr-cardboard-exit-btn:active {
	transform: scale(0.95);
	background: rgba(239, 68, 68, 0.85);
}
