/*
 * Button: base/behavioral styles only. Appearance (color, background, font,
 * padding, border, radius, width) is owned by the Elementor widget's own Style
 * controls (see includes/elementor-widget.php), so the values below are only a
 * fallback for when no style was set.
 */
.pv-button-wrapper {
	display: flex;
}

.pv-trigger-button {
	cursor: pointer;
	box-sizing: border-box;
	transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
	background: #1a1a1a;
	color: #fff;
	border: none;
	border-radius: 4px;
	padding: 14px 28px;
	font-size: 15px;
}

.pv-editor-placeholder {
	padding: 16px;
	border: 1px dashed #ccc;
	border-radius: 4px;
	color: #888;
	font-size: 13px;
	text-align: center;
}

/* Modal ---------------------------------------------------------------- */

.pv-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba( 0, 0, 0, 0.6 );
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
	padding: 20px;
}

.pv-modal-overlay[hidden],
.pv-modal [hidden] {
	display: none !important;
}

body.pv-modal-open {
	overflow: hidden;
}

.pv-modal {
	background: #fff;
	border-radius: 8px;
	max-width: 720px;
	width: 100%;
	max-height: 92vh;
	overflow-y: auto;
	padding: 28px;
	position: relative;
	direction: rtl;
	text-align: right;
	box-sizing: border-box;
}

.pv-modal-close {
	position: absolute;
	top: 14px;
	left: 14px;
	background: none;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #666;
}

.pv-modal-title {
	margin: 0 0 18px;
	font-size: 22px;
}

/* Product + variation */

.pv-product-row {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px;
	margin-bottom: 18px;
	border: 1px solid #e6e6e6;
	border-radius: 6px;
	background: #fafafa;
}

.pv-product-thumb {
	width: 64px;
	height: 64px;
	object-fit: contain;
	border-radius: 4px;
	background: #fff;
	flex: none;
}

.pv-product-meta {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
	flex: 1;
}

.pv-variation-label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 13px;
	color: #555;
}

.pv-variation-label select {
	width: 100%;
	max-width: 360px;
	padding: 8px;
}

/* Intro: the steps and how to measure */

.pv-intro-lead {
	margin: 0 0 14px;
	font-size: 16px;
	line-height: 1.5;
}

.pv-howto {
	list-style: none;
	margin: 0 0 20px;
	padding: 0;
	display: grid;
	gap: 14px;
}

.pv-howto li {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.pv-howto li > div {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.pv-howto strong {
	font-size: 15px;
}

.pv-howto li span:not( .pv-howto-num ) {
	font-size: 14px;
	line-height: 1.5;
	color: #555;
}

.pv-howto-num {
	flex: none;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: #1a1a1a;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
}

.pv-guide {
	margin: 0 0 18px;
	padding: 16px;
	border: 1px solid #e6e6e6;
	border-radius: 8px;
	background: #fafafa;
	font-size: 14px;
	line-height: 1.55;
}

.pv-guide-title {
	margin: 0 0 8px;
	font-size: 16px;
}

.pv-guide-text {
	margin: 0 0 8px;
}

.pv-guide-art {
	display: block;
	width: 100%;
	max-width: 300px;
	height: auto;
	margin: 10px auto 4px;
}

.pv-guide-caption {
	margin: 0 0 12px;
	text-align: center;
	font-size: 12px;
	color: #777;
}

.pv-guide-steps,
.pv-guide-tips {
	margin: 0 0 12px;
	padding: 0 20px 0 0;
}

.pv-guide-steps li,
.pv-guide-tips li {
	margin: 0 0 6px;
}

.pv-guide-tips-title {
	margin: 0 0 4px;
	font-weight: 600;
}

.pv-guide-details {
	margin: 0 0 14px;
	font-size: 14px;
}

.pv-guide-details summary {
	cursor: pointer;
	font-weight: 600;
	padding: 6px 0;
}

.pv-link-button {
	display: block;
	margin: 14px auto 0;
	padding: 4px 8px;
	background: none;
	border: none;
	color: #1a1a1a;
	font-size: 14px;
	text-decoration: underline;
	cursor: pointer;
}

/* Upload */

.pv-dropzone {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 40px 20px;
	border: 2px dashed #c9c9c9;
	border-radius: 8px;
	text-align: center;
	cursor: pointer;
	color: #555;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.pv-dropzone:hover {
	border-color: #1a1a1a;
	background: #fafafa;
}

.pv-upload-icon {
	font-size: 36px;
	line-height: 1;
	color: #999;
}

.pv-dropzone-title {
	font-size: 17px;
	color: #1a1a1a;
}

.pv-dropzone-sub {
	font-size: 13px;
	max-width: 420px;
}

/* Placement and calibration stage */

.pv-instruction {
	margin: 0 0 12px;
	font-size: 15px;
	line-height: 1.5;
}

.pv-stage {
	position: relative;
	display: block;
	width: fit-content;
	max-width: 100%;
	margin: 0 auto 16px;
	line-height: 0;
	cursor: crosshair;
	user-select: none;
	-webkit-user-select: none;
	overflow: hidden;
	border-radius: 6px;
	/* One finger scrolls the page while the photo is not zoomed; zoom.js switches it to "none" when it is. */
	touch-action: pan-y;
}

.pv-stage.is-zoomed {
	cursor: grab;
}

/* The layer that is scaled and moved when zooming. Markers live inside it so they follow the photo. */
.pv-pan {
	position: relative;
	transform-origin: 0 0;
	will-change: transform;
}

.pv-zoom-controls {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 3;
	display: flex;
	flex-direction: column;
	gap: 6px;
	line-height: 1;
}

.pv-zoom-controls button {
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1px solid rgba( 0, 0, 0, 0.25 );
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.95 );
	color: #1a1a1a;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.3 );
	touch-action: manipulation;
}

.pv-zoom-controls button[data-zoom='reset'] {
	font-size: 11px;
}

.pv-zoom-hint {
	margin: -6px 0 14px;
	font-size: 12px;
	color: #777;
	text-align: center;
}

.pv-stage img {
	display: block;
	max-width: 100%;
	max-height: 56vh;
	width: auto;
	height: auto;
	border-radius: 6px;
}

/*
 * A pin whose tip is exactly the clicked point: the sharp corner is the bottom-left
 * one, so it is both the element's anchor (left/top) and the rotation origin.
 */
.pv-marker {
	position: absolute;
	box-sizing: border-box;
	width: 22px;
	height: 22px;
	margin: -22px 0 0 0;
	background: #e53935;
	border: 2px solid #fff;
	border-radius: 50% 50% 50% 0;
	/* --pv-inv is 1/zoom, so the pin keeps its size while the photo is magnified. */
	transform: rotate( -45deg ) scale( var( --pv-inv, 1 ) );
	transform-origin: 0 100%;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.5 );
	pointer-events: none;
}

.pv-marker::after {
	content: '';
	position: absolute;
	inset: 6px;
	background: #fff;
	border-radius: 50%;
}

.pv-line-layer {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.pv-line-layer line {
	stroke: #e53935;
	stroke-width: 3;
	vector-effect: non-scaling-stroke;
}

.pv-dot {
	position: absolute;
	width: 14px;
	height: 14px;
	margin: -7px 0 0 -7px;
	background: #e53935;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.5 );
	pointer-events: none;
	transform: scale( var( --pv-inv, 1 ) );
}

.pv-calibrate-form {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 16px;
	font-size: 14px;
}

.pv-calibrate-form input {
	width: 110px;
	padding: 8px;
}

/* Buttons */

.pv-actions {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	margin-top: 8px;
}

.pv-generate-button,
.pv-secondary-button {
	display: inline-block;
	padding: 13px 18px;
	background: #1a1a1a;
	color: #fff;
	border: 1px solid #1a1a1a;
	border-radius: 4px;
	font-size: 15px;
	cursor: pointer;
	text-align: center;
	text-decoration: none;
	box-sizing: border-box;
	flex: 1 1 140px;
}

.pv-generate-button:disabled {
	background: #ccc;
	border-color: #ccc;
	cursor: not-allowed;
}

.pv-secondary-button {
	background: #fff;
	color: #1a1a1a;
}

/* Loading */

#pv-step-loading {
	text-align: center;
	padding: 30px 0;
}

.pv-spinner {
	width: 40px;
	height: 40px;
	border: 4px solid #eee;
	border-top-color: #1a1a1a;
	border-radius: 50%;
	margin: 0 auto 16px;
	animation: pv-spin 0.8s linear infinite;
}

.pv-progress {
	width: 70%;
	max-width: 360px;
	height: 6px;
	margin: 12px auto;
	background: #eee;
	border-radius: 3px;
	overflow: hidden;
}

.pv-progress span {
	display: block;
	width: 4%;
	height: 100%;
	background: #1a1a1a;
	transition: width 0.6s ease;
}

.pv-loading-subtext {
	color: #888;
	font-size: 13px;
}

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

/* Result */

#pv-result-image {
	width: 100%;
	height: auto;
	border-radius: 6px;
	display: block;
}

.pv-info {
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
	font-size: 14px;
	color: #444;
}

.pv-info li {
	margin: 4px 0;
}

.pv-error {
	color: #c0392b;
	font-size: 14px;
	margin: 14px 0 0;
}

@media ( max-width: 520px ) {
	.pv-modal {
		padding: 20px 16px;
	}

	.pv-dropzone {
		padding: 28px 14px;
	}
}

.pv-debug {
	margin-top: 14px;
	font-size: 12px;
	color: #555;
}

.pv-debug textarea {
	width: 100%;
	box-sizing: border-box;
	margin-top: 6px;
	font-family: ui-monospace, Menlo, Consolas, monospace;
	font-size: 11px;
}
