/*
 * Trang xem demo /xem/{slug}/ (templates/xem.php): thanh công cụ + khung thiết bị.
 * Chỉ nạp ở trang này. Mọi màu lấy từ biến --vs-* của base.css, có giá trị dự phòng nếu base.css chưa nạp.
 */

.vs-v-html {
	height: 100%;
	overflow: hidden;
}

.vs-viewer {
	--vs-v-bar: 56px;
	--vs-v-on: #FFFFFF;
	--vs-v-on-muted: rgba(255, 255, 255, .76);
	--vs-v-hair: rgba(255, 255, 255, .22);
	--vs-v-ring: var(--vs-accent, #FFB700);
	height: 100%;
	margin: 0;
	overflow: hidden;
	background: var(--vs-deeper, #001B3D);
	color: var(--vs-ink, #0B1A33);
	font-family: var(--vs-font, "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

.vs-viewer *,
.vs-viewer *::before,
.vs-viewer *::after {
	box-sizing: border-box;
}

/* Cố định toàn khung; thanh quản trị WordPress (khi đăng nhập) đẩy xuống bằng top. */
.vs-v-app {
	position: fixed;
	inset: 0;
	display: flex;
	flex-direction: column;
}

.admin-bar .vs-v-app {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .vs-v-app {
		top: 46px;
	}
}

.vs-v-ic {
	flex: 0 0 auto;
	display: block;
}

.vs-v-sr,
.vs-v-dev-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.vs-viewer :focus {
	outline: none;
}

.vs-viewer :focus-visible {
	outline: 3px solid var(--vs-v-ring);
	outline-offset: 2px;
}

/* Vòng vàng không đủ tương phản trên nền trắng: nền sáng dùng xanh chính. */
.vs-v-pop :focus-visible,
.vs-v-dialog :focus-visible,
.vs-v-loading :focus-visible {
	outline-color: var(--vs-primary, #006CE4);
}

.vs-v-loading-card:focus-visible {
	outline: none;
}

/* ---------- Thanh công cụ ---------- */

.vs-v-bar {
	position: relative;
	z-index: 3;
	flex: 0 0 var(--vs-v-bar);
	height: var(--vs-v-bar);
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
	background: var(--vs-deeper, #001B3D);
	color: var(--vs-v-on);
	box-shadow: 0 1px 0 rgba(255, 255, 255, .08);
}

.vs-v-left {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 12px;
}

.vs-v-center {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 12px;
}

.vs-v-right {
	flex: 1 1 0;
	min-width: max-content;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
}

.vs-v-back {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 44px;
	min-height: 44px;
	margin-left: -8px;
	padding: 0 10px 0 10px;
	border-radius: 10px;
	color: var(--vs-v-on);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.vs-v-back:hover {
	background: rgba(255, 255, 255, .08);
}

.vs-v-title {
	min-width: 0;
	display: flex;
	flex-direction: column;
	padding-left: 12px;
	border-left: 1px solid rgba(255, 255, 255, .16);
	line-height: 1.25;
}

.vs-v-name {
	margin: 0;
	overflow: hidden;
	color: inherit;
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: 0;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.vs-v-num {
	color: var(--vs-v-on-muted);
	font-size: 12px;
	white-space: nowrap;
}

/* Nút đổi mẫu + ô bật ra */
.vs-v-switch {
	position: relative;
}

.vs-v-ctl {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 44px;
	min-height: 44px;
	padding: 0 12px;
	border: 1px solid var(--vs-v-hair);
	border-radius: 10px;
	background: rgba(255, 255, 255, .06);
	color: var(--vs-v-on);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.vs-v-ctl:hover,
.vs-v-ctl[aria-expanded="true"] {
	background: rgba(255, 255, 255, .14);
	border-color: rgba(255, 255, 255, .36);
}

.vs-v-ctl[aria-expanded="true"] .vs-v-ic:last-child {
	transform: rotate(180deg);
}

.vs-v-pop {
	position: absolute;
	top: calc(100% + 8px);
	left: 50%;
	z-index: 10;
	width: 340px;
	max-height: min(72vh, 600px);
	overflow: auto;
	overscroll-behavior: contain;
	padding: 8px;
	transform: translateX(-50%);
	border-radius: var(--vs-radius, 14px);
	background: var(--vs-card, #FFFFFF);
	color: var(--vs-ink, #0B1A33);
	box-shadow: 0 18px 48px rgba(0, 27, 61, .28), 0 0 0 1px rgba(0, 27, 61, .08);
}

.vs-v-pop[hidden] {
	display: none;
}

.vs-v-pop:focus-visible {
	outline: none;
}

.vs-v-pop-head {
	margin: 6px 10px 6px;
	color: var(--vs-muted, #5B6B82);
	font-size: 13px;
	font-weight: 600;
}

.vs-v-pop-foot {
	display: flex;
	align-items: center;
	min-height: 44px;
	margin-top: 6px;
	padding: 8px 10px;
	border-top: 1px solid var(--vs-line, #E3E9F2);
	border-radius: 0 0 10px 10px;
	color: var(--vs-primary, #006CE4);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	text-decoration: none;
}

.vs-v-pop-foot:hover {
	text-decoration: underline;
}

.vs-v-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.vs-v-item {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	padding: 6px 10px;
	border-radius: 10px;
	color: var(--vs-ink, #0B1A33);
	font-size: 14px;
	line-height: 1.35;
	text-decoration: none;
}

a.vs-v-item:hover {
	background: var(--vs-bg, #F4F7FC);
}

.vs-v-item.is-current {
	background: var(--vs-soft, #E8F1FD);
	font-weight: 600;
}

.vs-v-item.is-current .vs-v-ic {
	margin-left: auto;
	color: var(--vs-primary, #006CE4);
}

.vs-v-item.is-soon {
	color: var(--vs-muted, #5B6B82);
	cursor: default;
}

.vs-v-item-num {
	flex: 0 0 28px;
	height: 28px;
	display: inline-grid;
	place-items: center;
	border-radius: 8px;
	background: var(--vs-bg, #F4F7FC);
	color: var(--vs-deep, #003580);
	font-size: 12px;
	font-weight: 700;
}

.vs-v-item.is-current .vs-v-item-num {
	background: var(--vs-primary, #006CE4);
	color: var(--vs-primary-ink, #FFFFFF);
}

.vs-v-item.is-soon .vs-v-item-num {
	color: var(--vs-muted, #5B6B82);
}

.vs-v-item-soon {
	white-space: nowrap;
}

/* Chọn khung thiết bị */
.vs-v-devices {
	display: flex;
	gap: 2px;
	border-radius: 12px;
	background: rgba(255, 255, 255, .08);
}

.vs-v-dev {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 44px;
	height: 44px;
	padding: 0 10px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--vs-v-on-muted);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.vs-v-dev:hover {
	background: rgba(255, 255, 255, .1);
	color: var(--vs-v-on);
}

.vs-v-dev[aria-pressed="true"] {
	background: var(--vs-card, #FFFFFF);
	color: var(--vs-deeper, #001B3D);
}

/* Giá, Zalo, QR, Bỏ khung, Chọn mẫu này */
.vs-v-price {
	display: inline-flex;
	align-items: baseline;
	gap: 4px;
	min-height: 44px;
	padding: 12px 8px;
	border-radius: 10px;
	color: var(--vs-v-on);
	font-size: 14px;
	line-height: 1.4;
	text-decoration: none;
	white-space: nowrap;
}

.vs-v-price:hover {
	background: rgba(255, 255, 255, .08);
}

.vs-v-price-from {
	color: var(--vs-v-on-muted);
}

.vs-v-price strong {
	font-size: 15px;
	font-weight: 700;
}

.vs-v-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 44px;
	min-height: 44px;
	padding: 0 14px;
	border: 1px solid transparent;
	border-radius: 10px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.25;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.vs-v-btn--primary {
	background: var(--vs-primary, #006CE4);
	color: var(--vs-primary-ink, #FFFFFF);
}

.vs-v-btn--primary:hover {
	background: #0058BD;
}

.vs-v-btn--zalo {
	background: var(--vs-zalo, #0068FF);
	color: #FFFFFF;
}

.vs-v-btn--zalo:hover {
	background: #0055D4;
}

.vs-v-btn--ghost,
.vs-v-btn--icon {
	border-color: var(--vs-v-hair);
	background: rgba(255, 255, 255, .06);
	color: var(--vs-v-on);
}

.vs-v-btn--ghost:hover,
.vs-v-btn--icon:hover {
	border-color: rgba(255, 255, 255, .36);
	background: rgba(255, 255, 255, .14);
}

.vs-v-btn--icon {
	width: 44px;
	padding: 0;
}

.vs-v-btn--light {
	border-color: var(--vs-line, #E3E9F2);
	background: var(--vs-card, #FFFFFF);
	color: var(--vs-ink, #0B1A33);
}

.vs-v-btn--light:hover {
	border-color: #C9D3E2;
	background: var(--vs-bg, #F4F7FC);
}

.vs-v-btn--block {
	width: 100%;
	white-space: normal;
}

.vs-v-more {
	display: none;
}

/* Chú thích nhỏ khi rê chuột / đến bằng bàn phím (nút chỉ có icon). */
.vs-v-bar [data-tip]::after {
	content: attr(data-tip);
	position: absolute;
	top: calc(100% + 8px);
	left: 50%;
	z-index: 12;
	display: none;
	padding: 6px 10px;
	transform: translateX(-50%);
	border-radius: 8px;
	background: var(--vs-ink, #0B1A33);
	color: #FFFFFF;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.3;
	white-space: nowrap;
	pointer-events: none;
	box-shadow: 0 6px 18px rgba(0, 27, 61, .25);
}

.vs-v-bar [data-tip]:hover::after,
.vs-v-bar [data-tip]:focus-visible::after {
	display: block;
}

.vs-v-bar [aria-expanded="true"][data-tip]::after {
	display: none;
}

.vs-v-back[data-tip]::after {
	left: 0;
	transform: none;
}

/* Nút còn chữ thì khỏi chú thích. */
.vs-v-back[data-tip]::after,
.vs-v-unframe[data-tip]::after,
.vs-v-switch-btn[data-tip]::after {
	content: none;
}

/* ---------- Vùng xem ---------- */

.vs-v-stage {
	position: relative;
	z-index: 1;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	background: var(--vs-card, #FFFFFF);
}

.vs-v-device {
	position: relative;
	width: 100%;
	height: 100%;
	background: #FFFFFF;
}

.vs-v-frame {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	background: #FFFFFF;
}

.vs-v-frame:focus-visible {
	outline-offset: -3px;
}

/* Máy tính bảng / điện thoại: đặt giữa đúng bề ngang, viền máy nhẹ, nền phía sau --vs-soft. */
[data-vs-device="tablet"] .vs-v-stage,
[data-vs-device="phone"] .vs-v-stage {
	padding: 24px 16px;
	background: var(--vs-soft, #E8F1FD);
}

[data-vs-device="tablet"] .vs-v-device,
[data-vs-device="phone"] .vs-v-device {
	max-width: 100%;
	overflow: hidden;
	border: var(--vs-v-bezel) solid var(--vs-ink, #0B1A33);
	border-radius: calc(var(--vs-v-screen-radius) + var(--vs-v-bezel));
	box-shadow: 0 24px 60px rgba(0, 27, 61, .18), 0 2px 8px rgba(0, 27, 61, .12);
}

[data-vs-device="tablet"] .vs-v-device {
	--vs-v-bezel: 10px;
	--vs-v-screen-radius: 14px;
	width: calc(820px + 2 * var(--vs-v-bezel));
	max-height: calc(1180px + 2 * var(--vs-v-bezel));
}

[data-vs-device="phone"] .vs-v-device {
	--vs-v-bezel: 9px;
	--vs-v-screen-radius: 30px;
	width: calc(390px + 2 * var(--vs-v-bezel));
	max-height: calc(844px + 2 * var(--vs-v-bezel));
}

/* Trạng thái tải: chỉ hiện khi có JS (lớp vs-v-js gắn ở <head>), ẩn ngay khi iframe báo load. */
.vs-v-loading {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
	background: var(--vs-bg, #F4F7FC);
}

.vs-v-js .vs-v-loading {
	display: flex;
}

.vs-v-js .vs-v-device.is-loaded .vs-v-loading {
	display: none;
}

.vs-v-loading-card {
	max-width: 380px;
	color: var(--vs-ink, #0B1A33);
	text-align: center;
}

.vs-v-spinner {
	display: inline-block;
	width: 36px;
	height: 36px;
	border: 3px solid var(--vs-line, #E3E9F2);
	border-top-color: var(--vs-primary, #006CE4);
	border-radius: 50%;
	animation: vs-v-spin .9s linear infinite;
}

@keyframes vs-v-spin {
	to {
		transform: rotate(360deg);
	}
}

.vs-v-loading-text {
	margin: 12px 0 0;
	font-size: 15px;
	font-weight: 600;
}

.vs-v-slow p {
	margin: 12px 0 0;
	color: var(--vs-muted, #5B6B82);
	font-size: 14px;
}

.vs-v-slow-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-top: 16px;
}

/* ---------- Hộp thoại (QR, bảng trượt trên điện thoại) ---------- */

.vs-v-dialog {
	width: min(384px, calc(100% - 32px));
	max-height: calc(100% - 32px);
	padding: 0;
	overflow: auto;
	overscroll-behavior: contain;
	border: 0;
	border-radius: 18px;
	background: var(--vs-card, #FFFFFF);
	color: var(--vs-ink, #0B1A33);
	box-shadow: 0 24px 64px rgba(0, 27, 61, .35);
}

.vs-v-dialog::backdrop {
	background: rgba(0, 27, 61, .55);
}

/* Trình duyệt cũ không có showModal(): JS mở bằng thuộc tính open + lớp này. */
.vs-v-dialog.is-fallback {
	position: fixed;
	inset: 0;
	z-index: 100;
	margin: auto;
	height: fit-content;
}

.vs-v-dialog-in {
	position: relative;
	padding: 24px;
}

.vs-v-close {
	position: absolute;
	top: 8px;
	right: 8px;
	display: inline-grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--vs-muted, #5B6B82);
	cursor: pointer;
}

.vs-v-close:hover {
	background: var(--vs-bg, #F4F7FC);
	color: var(--vs-ink, #0B1A33);
}

.vs-v-dialog-title {
	margin: 0 40px 16px 0;
	color: var(--vs-ink, #0B1A33);
	font-family: inherit;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.35;
	letter-spacing: 0;
}

.vs-v-qr-code {
	display: grid;
	place-items: center;
	width: 232px;
	max-width: 100%;
	aspect-ratio: 1 / 1;
	margin: 0 auto 14px;
	overflow: hidden;
	border: 1px solid var(--vs-line, #E3E9F2);
	border-radius: 12px;
	background: #FFFFFF;
}

.vs-v-qr-code svg {
	display: block;
	width: 100%;
	height: 100%;
}

.vs-v-qr-code.is-error {
	padding: 16px;
	color: var(--vs-muted, #5B6B82);
	font-size: 14px;
	text-align: center;
}

.vs-v-qr-hint {
	margin: 0;
	color: var(--vs-muted, #5B6B82);
	font-size: 14px;
	text-align: center;
}

.vs-v-qr-url {
	margin: 6px 0 16px;
	font-size: 15px;
	font-weight: 600;
	text-align: center;
	overflow-wrap: anywhere;
}

.vs-v-copy-status {
	min-height: 1.5em;
	margin: 8px 0 0;
	color: var(--vs-call, #1E7B4F);
	font-size: 14px;
	text-align: center;
}

.vs-v-copy-status.is-error {
	color: var(--vs-muted, #5B6B82);
}

/* Bảng trượt từ dưới lên (chỉ mở được trên màn hình < 768px). */
.vs-v-sheet {
	width: 100%;
	max-width: 100%;
	max-height: 86%;
	margin: auto 0 0;
	border-radius: 18px 18px 0 0;
}

.vs-v-sheet .vs-v-dialog-in {
	padding: 20px 16px max(20px, env(safe-area-inset-bottom));
}

.vs-v-sheet[open] {
	animation: vs-v-up .22s ease-out;
}

@keyframes vs-v-up {
	from {
		transform: translateY(24px);
		opacity: 0;
	}
}

.vs-v-sheet-num {
	color: var(--vs-muted, #5B6B82);
	font-size: 15px;
	font-weight: 500;
}

.vs-v-sheet-price {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 52px;
	margin: 0 0 16px;
	padding: 10px 14px;
	border-radius: 12px;
	background: var(--vs-soft, #E8F1FD);
	color: var(--vs-ink, #0B1A33);
	font-size: 15px;
	text-decoration: none;
}

.vs-v-sheet-link {
	color: var(--vs-primary, #006CE4);
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
}

.vs-v-sheet-sub {
	margin: 0 0 4px;
	color: var(--vs-muted, #5B6B82);
	font-size: 13px;
	font-weight: 600;
}

.vs-v-sheet .vs-v-item {
	padding-left: 4px;
	padding-right: 4px;
}

.vs-v-sheet-actions {
	display: grid;
	gap: 8px;
	margin: 0 0 20px;
}

/* ---------- Bề ngang ---------- */

@media (min-width: 1440px) {
	.vs-v-dev-text {
		position: static;
		width: auto;
		height: auto;
		margin: 0;
		overflow: visible;
		clip: auto;
		clip-path: none;
	}

	.vs-v-dev {
		padding: 0 12px;
	}
}

/* Dưới 1280px: "Tất cả mẫu" và "Bỏ khung" chỉ còn icon (chữ vẫn đọc được bằng trình đọc màn hình); "gồm VAT" chỉ còn cho trình đọc màn hình. */
@media (max-width: 1279.98px) {
	.vs-v-price-vat,
	.vs-v-back-text,
	.vs-v-unframe-text {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.vs-v-back {
		padding: 0;
		justify-content: center;
	}

	.vs-v-unframe {
		width: 44px;
		padding: 0;
	}

	.vs-v-back[data-tip]::after,
	.vs-v-unframe[data-tip]::after {
		content: attr(data-tip);
	}
}

/* Máy tính bảng dọc: bỏ giá trên thanh, nút đổi mẫu chỉ còn icon. */
@media (max-width: 1023.98px) {
	.vs-v-price,
	.vs-v-num {
		display: none;
	}

	.vs-v-switch-text {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.vs-v-switch-btn {
		gap: 2px;
		padding: 0 8px;
	}

	.vs-v-switch-btn[data-tip]::after {
		content: attr(data-tip);
	}

	.vs-v-pop {
		left: 0;
		transform: none;
	}
}

/* Điện thoại: thanh gọn (quay lại, tên mẫu, Chọn mẫu này, nút thêm), iframe tràn bề ngang. */
@media (max-width: 767.98px) {
	.vs-viewer {
		--vs-v-bar: 52px;
	}

	.vs-v-bar {
		gap: 8px;
		padding: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
	}

	.vs-v-hide-sm {
		display: none;
	}

	.vs-v-more {
		display: inline-flex;
	}

	.vs-v-left {
		gap: 4px;
	}

	.vs-v-back {
		margin-left: 0;
	}

	.vs-v-title {
		padding-left: 0;
		border-left: 0;
	}

	.vs-v-right {
		gap: 6px;
	}

	.vs-v-choose {
		padding: 0 12px;
	}

	.vs-v-bar [data-tip]::after {
		content: none;
	}

	[data-vs-device] .vs-v-stage {
		padding: 0;
		background: var(--vs-card, #FFFFFF);
	}

	[data-vs-device] .vs-v-device {
		width: 100%;
		max-width: none;
		height: 100%;
		max-height: none;
		border: 0;
		border-radius: 0;
		box-shadow: none;
	}
}

@media (max-width: 359.98px) {
	.vs-v-choose {
		padding: 0 10px;
		font-size: 13px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.vs-viewer *,
	.vs-viewer *::before,
	.vs-viewer *::after {
		transition-duration: .01ms !important;
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
	}

	.vs-v-spinner {
		animation: none;
	}
}

@media (forced-colors: active) {
	.vs-v-dev[aria-pressed="true"] {
		outline: 2px solid CanvasText;
		outline-offset: -2px;
	}

	.vs-v-btn,
	.vs-v-ctl,
	.vs-v-dev {
		border: 1px solid ButtonText;
	}
}
