/* Prova virtuale – pulsante in pagina prodotto e finestra di prova.
   Colori dal tema del sito se definiti (--op-*), altrimenti i valori Polaris. */
.pv-try-btn,
.pv-dialog {
	--pv-navy: var(--op-navy, #0b1526);
	--pv-orange: var(--op-orange, #e9530e);
	--pv-ink: var(--op-ink, #14161a);
	--pv-muted: var(--op-muted, #5e6470);
	--pv-line: var(--op-line, #e7e4df);
	--pv-gray: var(--op-gray, #f4f3f1);
	--pv-radius: 14px;
}

/* ---------- pulsante "Provalo" ---------- */
.pv-try {
	margin: 14px 0 6px;
}
.pv-try-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 48px;
	min-width: 280px;
	padding: 12px 26px;
	border: 1.5px solid var(--pv-navy);
	border-radius: 8px;
	background: #fff;
	color: var(--pv-navy);
	font-weight: 600;
	font-size: 15px;
	line-height: 1;
	font-family: inherit;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s;
}
.pv-try-btn svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
}
.pv-try-btn:hover {
	background: var(--pv-navy);
	color: #fff;
}
.pv-try-btn:focus-visible {
	outline: 3px solid var(--pv-orange);
	outline-offset: 3px;
}
.pv-try-btn[aria-busy='true'] {
	cursor: progress;
	opacity: 0.7;
}
.pv-try-msg {
	margin: 8px 0 0;
	font-size: 14px;
	color: var(--pv-muted);
}
@media (max-width: 767px) {
	.pv-try-btn {
		width: 100%;
		min-width: 0;
	}
}

/* ---------- finestra ---------- */
html.pv-open {
	overflow: hidden;
}
.pv-dialog {
	box-sizing: border-box;
	/* Il tema azzera i margini: si ripristina la centratura del <dialog> modale. */
	position: fixed;
	inset: 0;
	margin: auto;
	width: min(640px, calc(100vw - 32px));
	height: fit-content;
	max-width: none;
	max-height: calc(100dvh - 32px);
	padding: 0;
	border: 0;
	border-radius: 20px;
	background: #fff;
	color: var(--pv-ink);
	font-family: inherit;
	font-size: 16px;
	line-height: 1.5;
	box-shadow: 0 30px 80px -20px rgba(8, 15, 28, 0.55);
	overflow: hidden;
}
.pv-dialog.pv-dialog--live {
	width: min(960px, calc(100vw - 32px));
}
.pv-dialog *,
.pv-dialog *::before,
.pv-dialog *::after {
	box-sizing: border-box;
}
.pv-dialog::backdrop {
	background: rgba(8, 15, 28, 0.62);
}
.pv-dialog[open] {
	animation: pv-in 0.22s ease-out;
}
@keyframes pv-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
}
.pv-frame {
	display: flex;
	flex-direction: column;
	max-height: calc(100dvh - 32px);
}
.pv-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 20px 12px 24px;
	border-bottom: 1px solid var(--pv-line);
}
.pv-title {
	margin: 0;
	font-weight: 700;
	font-size: 22px;
	line-height: 1.2;
	font-family: inherit;
	letter-spacing: -0.01em;
	color: var(--pv-ink);
}
.pv-title:focus {
	outline: none;
}
.pv-product {
	margin: 4px 0 0;
	font-size: 14px;
	color: var(--pv-muted);
}
.pv-icon-btn {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: var(--pv-gray);
	color: var(--pv-ink);
	cursor: pointer;
}
.pv-icon-btn svg,
.pv-tool svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.pv-icon-btn:hover {
	background: var(--pv-line);
}
.pv-body {
	overflow-y: auto;
	padding: 20px 24px 24px;
	overscroll-behavior: contain;
}
.pv-step {
	max-width: none;
}
.pv-step-title {
	margin: 0 0 12px;
	font-weight: 700;
	font-size: 19px;
	line-height: 1.3;
	font-family: inherit;
	color: var(--pv-ink);
}
.pv-step-title:focus,
.pv-visually-hidden:focus {
	outline: none;
}
.pv-step p {
	margin: 0 0 12px;
}
.pv-points {
	margin: 0 0 14px;
	padding-left: 20px;
}
.pv-points li {
	margin-bottom: 8px;
}
.pv-small {
	font-size: 14px;
	color: var(--pv-muted);
}
.pv-small a,
.pv-link {
	color: var(--pv-navy);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}
.pv-link {
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	cursor: pointer;
}
.pv-perm {
	padding: 12px 14px;
	border-radius: 10px;
	background: var(--pv-gray);
	font-size: 15px;
}
.pv-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 10px;
	margin-top: 20px;
}
.pv-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 12px 22px;
	border: 1.5px solid transparent;
	border-radius: 8px;
	font-weight: 600;
	font-size: 15px;
	line-height: 1.1;
	font-family: inherit;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.pv-btn--primary,
.pv-dialog a.pv-btn--primary {
	background: var(--pv-navy);
	color: #fff;
}
.pv-btn--primary:hover,
.pv-dialog a.pv-btn--primary:hover {
	background: var(--pv-orange);
	color: #fff;
}
.pv-btn--secondary {
	border-color: var(--pv-navy);
	background: #fff;
	color: var(--pv-navy);
}
.pv-btn--ghost {
	background: var(--pv-gray);
	color: var(--pv-ink);
}
.pv-btn--ghost:hover {
	background: var(--pv-line);
}
.pv-dialog :focus-visible {
	outline: 3px solid var(--pv-orange);
	outline-offset: 2px;
}
.pv-field {
	display: grid;
	gap: 6px;
	margin: 14px 0;
	max-width: 320px;
}
.pv-field label,
.pv-fit-live label {
	font-weight: 600;
	font-size: 15px;
}
.pv-dialog input[type='number'],
.pv-dialog select {
	min-height: 48px;
	padding: 10px 12px;
	border: 1.5px solid #b9b4ac;
	border-radius: 8px;
	background: #fff;
	color: var(--pv-ink);
	font-weight: 500;
	font-size: 16px;
	line-height: 1.2;
	font-family: inherit;
}
.pv-dialog input[aria-invalid='true'] {
	border-color: #b3261e;
}
.pv-field-error {
	margin: 0;
	color: #b3261e;
	font-size: 14px;
	font-weight: 600;
}
.pv-step--error [role='alert'] {
	padding: 12px 14px;
	border-left: 4px solid var(--pv-orange);
	border-radius: 6px;
	background: #fff4ee;
}

/* ---------- prova in diretta ---------- */
.pv-stage {
	position: relative;
	width: 100%;
	aspect-ratio: 4 / 3;
	max-height: calc(100dvh - 250px);
	border-radius: var(--pv-radius);
	background: #10131a;
	overflow: hidden;
}
.pv-video,
.pv-canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}
.pv-video {
	object-fit: cover;
}
.pv-stage--mirrored .pv-video {
	transform: scaleX(-1);
}
.pv-canvas {
	pointer-events: none;
}
.pv-hint {
	position: absolute;
	left: 50%;
	bottom: 14px;
	transform: translateX(-50%);
	max-width: calc(100% - 28px);
	margin: 0;
	padding: 9px 16px;
	border-radius: 30px;
	background: rgba(11, 21, 38, 0.82);
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	text-align: center;
}
.pv-hint[hidden],
.pv-hint:empty {
	display: none;
}
.pv-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 44px;
	height: 44px;
	margin: -22px 0 0 -22px;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: #fff;
	border-radius: 50%;
	animation: pv-spin 0.9s linear infinite;
}
@keyframes pv-spin {
	to {
		transform: rotate(360deg);
	}
}
.pv-paused,
.pv-snap {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	margin: 0;
	padding: 20px;
	background: rgba(11, 21, 38, 0.88);
	color: #fff;
	text-align: center;
}
.pv-paused[hidden],
.pv-snap[hidden] {
	display: none;
}
.pv-paused p {
	max-width: 420px;
	margin: 0;
}
.pv-snap img {
	max-width: 100%;
	max-height: calc(100% - 130px);
	border-radius: 10px;
}
.pv-snap .pv-small {
	color: #e8eaee;
}
.pv-snap .pv-actions {
	margin-top: 0;
	justify-content: center;
}
.pv-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}
.pv-tool {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 8px 14px;
	border: 1.5px solid var(--pv-line);
	border-radius: 30px;
	background: #fff;
	color: var(--pv-ink);
	font-weight: 600;
	font-size: 14px;
	line-height: 1;
	font-family: inherit;
	cursor: pointer;
}
.pv-tool:hover:not(:disabled) {
	border-color: var(--pv-navy);
}
.pv-tool:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}
.pv-tool[hidden] {
	display: none;
}
.pv-tool--select {
	cursor: default;
	padding: 2px 4px 2px 14px;
}
.pv-tool--select select {
	min-height: 38px;
	border: 0;
	padding: 4px 8px;
}
.pv-tool--range {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	max-width: 520px;
	margin-top: 12px;
	cursor: default;
	border-radius: 14px;
}
.pv-tool--range input[type='range'] {
	flex: 1;
	min-width: 0;
	height: 32px;
	accent-color: var(--pv-navy);
	cursor: pointer;
}
.pv-size-out {
	min-width: 44px;
	text-align: right;
	font-variant-numeric: tabular-nums;
	color: var(--pv-muted);
}
.pv-fit-live {
	margin-top: 12px;
	padding: 14px;
	border-radius: 12px;
	background: var(--pv-gray);
	max-width: 420px;
}
.pv-fit-live[hidden] {
	display: none;
}
.pv-inline {
	display: flex;
	gap: 8px;
	margin-top: 6px;
}
.pv-inline input {
	width: 120px;
}
.pv-notes {
	margin: 10px 0 0;
}
.pv-sr,
.pv-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* Telefono: finestra a tutto schermo, rispettando le aree sicure (notch, barra home). */
@media (max-width: 767px) {
	.pv-dialog,
	.pv-dialog.pv-dialog--live {
		width: 100vw;
		height: 100dvh;
		max-height: none;
		margin: 0;
		border-radius: 0;
	}
	.pv-frame {
		height: 100%;
		max-height: none;
		padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
	}
	.pv-head {
		padding: 12px 12px 10px 16px;
	}
	.pv-title {
		font-size: 19px;
	}
	.pv-body {
		flex: 1;
		display: flex;
		flex-direction: column;
		padding: 16px;
	}
	.pv-live:not([hidden]) {
		flex: 1;
		display: flex;
		flex-direction: column;
		min-height: 0;
	}
	.pv-stage {
		flex: 1;
		aspect-ratio: auto;
		min-height: 300px;
		max-height: none;
	}
	.pv-actions {
		justify-content: stretch;
	}
	.pv-actions .pv-btn {
		flex: 1 1 140px;
	}
	.pv-tool span {
		font-size: 13px;
	}
}
/* Telefono in orizzontale: poco spazio in altezza. */
@media (max-height: 500px) and (orientation: landscape) {
	.pv-stage {
		aspect-ratio: auto;
		height: calc(100dvh - 150px);
		min-height: 200px;
	}
	.pv-head {
		padding-top: 8px;
		padding-bottom: 6px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pv-dialog[open] {
		animation: none;
	}
	.pv-spinner {
		animation-duration: 2.4s;
	}
	.pv-try-btn,
	.pv-btn {
		transition: none;
	}
}
