/**
 * 主题在线预览页（方案 A：站内 iframe 预览器）
 */

html,
body.mfmls-preview {
	height: 100%;
	margin: 0;
	overflow: hidden;
	background: #0f1720;
}

body.mfmls-preview #wpadminbar {
	display: none;
}

.pv {
	display: flex;
	flex-direction: column;
	height: 100vh;
	height: 100dvh;
}

/* ---------- 顶部工具条 ---------- */
.pv__bar {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
	padding: 8px 14px;
	background: #16212c;
	border-bottom: 1px solid rgba(255, 255, 255, .08);
	color: #e8eef4;
	flex: 0 0 auto;
}

.pv__back {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	max-width: 260px;
	color: #e8eef4;
	text-decoration: none;
	font-weight: 600;
	font-size: .92rem;
}

.pv__back:hover {
	color: #7fd8dd;
}

.pv__back-ico {
	font-size: 1.05rem;
	line-height: 1;
}

.pv__back-text {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pv__pages {
	display: flex;
	gap: 4px;
	overflow-x: auto;
	max-width: 100%;
	scrollbar-width: none;
}

.pv__pages::-webkit-scrollbar {
	display: none;
}

.pv__page {
	padding: 5px 11px;
	border-radius: 999px;
	color: #9fb0c0;
	text-decoration: none;
	font-size: .84rem;
	white-space: nowrap;
}

.pv__page:hover {
	color: #e8eef4;
	background: rgba(255, 255, 255, .06);
}

.pv__page.is-active {
	color: #0f1720;
	background: #7fd8dd;
	font-weight: 600;
}

.pv__devices {
	display: flex;
	gap: 2px;
	padding: 3px;
	border-radius: 10px;
	background: rgba(255, 255, 255, .06);
	margin-left: auto;
}

.pv__size-tools {
	display: flex;
	align-items: center;
	gap: 6px;
}

.pv__size-label {
	color: #9fb0c0;
	font-size: .8rem;
	white-space: nowrap;
}

.pv__size {
	max-width: 162px;
	min-height: 40px;
	padding: 6px 10px;
	border: 1px solid #526476;
	border-radius: 8px;
	background: #233544;
	color: #e8eef4;
	font: inherit;
	font-size: .84rem;
	cursor: pointer;
}

.pv__size:focus-visible,
.pv__dev:focus-visible,
.pv__act:focus-visible {
	outline: 2px solid #7fd8dd;
	outline-offset: 2px;
}

.pv__dev {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	min-height: 40px;
	min-width: 40px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #9fb0c0;
	font-size: .84rem;
	cursor: pointer;
	font-family: inherit;
}

.pv__dev svg {
	width: 16px;
	height: 16px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.pv__dev:hover {
	color: #e8eef4;
}

.pv__dev.is-active {
	background: #233544;
	color: #7fd8dd;
}

.pv__acts {
	display: flex;
	align-items: center;
	gap: 8px;
}

.pv__act {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	min-height: 40px;
	min-width: 40px;
	border-radius: 8px;
	color: #9fb0c0;
	text-decoration: none;
	font-size: .84rem;
	background: transparent;
	border: 0;
	cursor: pointer;
	font-family: inherit;
}

.pv__act:hover {
	color: #e8eef4;
	background: rgba(255, 255, 255, .07);
}

.pv__act:disabled {
	cursor: not-allowed;
	opacity: .4;
}

.pv__rotate {
	border: 1px solid rgba(255, 255, 255, .14);
}

.pv__act svg {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.pv__cta {
	display: inline-block;
	padding: 7px 16px;
	border-radius: 8px;
	background: linear-gradient(135deg, #17aeb4, #0a5a64);
	color: #fff;
	font-weight: 600;
	font-size: .86rem;
	text-decoration: none;
	white-space: nowrap;
}

.pv__cta:hover {
	filter: brightness(1.1);
	color: #fff;
}

/* ---------- 舞台 ---------- */
.pv__stage {
	position: relative;
	flex: 1 1 auto;
	overflow: auto;
	background: #0f1720;
	padding: 16px;
	display: flex;
	justify-content: center;
}

.pv__frame {
	transform-origin: top center;
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
	flex: 0 0 auto;
}

.pv__frame iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ---------- 加载态 / 兜底 ---------- */
.pv__loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	color: #7f8fa0;
	font-size: .9rem;
	z-index: 2;
}

.pv__spinner {
	width: 18px;
	height: 18px;
	border: 2px solid rgba(127, 216, 221, .25);
	border-top-color: #7fd8dd;
	border-radius: 50%;
	animation: pv-spin .7s linear infinite;
}

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

.pv__fallback {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	text-align: center;
	color: #9fb0c0;
	padding: 24px;
	z-index: 3;
}

.pv__fallback b {
	color: #e8eef4;
	font-size: 1.05rem;
}

.pv__fallback-tip {
	font-size: .86rem;
	max-width: 420px;
	margin: 0;
}

.is-hidden {
	display: none !important;
}

/* ---------- 底栏 ---------- */
.pv__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 6px 14px;
	background: #16212c;
	border-top: 1px solid rgba(255, 255, 255, .08);
	color: #7f8fa0;
	font-size: .78rem;
	flex: 0 0 auto;
}

.pv__foot-w {
	font-variant-numeric: tabular-nums;
	color: #7fd8dd;
	text-align: right;
}

/* ---------- 窄屏：工具条精简 + 舞台允许横向滚动 ---------- */
@media (max-width: 860px) {
	.pv__back-text {
		display: none;
	}

	.pv__act-text {
		display: none;
	}

	.pv__devices {
		margin-left: 0;
		order: 3;
	}

	.pv__dev span {
		display: none;
	}

	.pv__dev {
		padding: 6px 10px;
	}

	.pv__bar {
		gap: 8px;
		padding: 6px 10px;
	}

	.pv__stage {
		padding: 8px;
		justify-content: flex-start;
	}

	.pv__foot-tip,
	.pv__size-label {
		display: none;
	}

	.pv__size {
		max-width: 150px;
	}

	.pv__dev,
	.pv__act,
	.pv__size {
		min-height: 44px;
	}

	.pv__dev,
	.pv__act {
		min-width: 44px;
	}
}

@media (max-width: 420px) {
	.pv__size-tools {
		order: 4;
	}

	.pv__size {
		max-width: 142px;
	}
}
