/* Virtual Try-On for WooCommerce — storefront styles. Logical properties keep RTL (Arabic, Hebrew) working. */

:root {
	--wcvto-accent: #1f1f1f;
	--wcvto-accent-text: #ffffff;
	--wcvto-text: #1a1a1a;
	--wcvto-muted: #6b6b6b;
	--wcvto-line: #e3e3e3;
	--wcvto-soft: #f5f4f2;
	--wcvto-radius: 14px;
}

/* ---------- Trigger button ---------- */

.wcvto-open {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	cursor: pointer;
}

.wcvto-open svg {
	width: 1.25em;
	height: 1.25em;
	flex: none;
}

form.cart .wcvto-open {
	margin-inline-start: 0.5em;
	vertical-align: middle;
}

.wcvto-btn-wrap {
	margin: 0 0 1.5em;
}

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

html.wcvto-lock,
html.wcvto-lock body {
	overflow: hidden;
}

.wcvto-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	color-scheme: light;
}

.wcvto-modal[hidden] {
	display: none;
}

.wcvto-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 15, 15, 0.62);
	animation: wcvto-fade 0.18s ease-out;
}

.wcvto-dialog {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 460px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 24px;
	background: #fff;
	color: var(--wcvto-text);
	border-radius: 20px;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
	font-size: 15px;
	line-height: 1.5;
	text-align: start;
	animation: wcvto-rise 0.22s ease-out;
}

.wcvto-dialog:focus {
	outline: none;
}

.wcvto-dialog *,
.wcvto-dialog *::before,
.wcvto-dialog *::after {
	box-sizing: border-box;
}

/* Neutralise common theme styles inside the dialog. */
.wcvto-dialog h2,
.wcvto-dialog p,
.wcvto-dialog ul {
	margin: 0;
	padding: 0;
}

.wcvto-dialog button,
.wcvto-dialog a {
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-shadow: none;
	box-shadow: none;
}

.wcvto-dialog img {
	display: block;
	max-width: 100%;
	height: auto;
}

.wcvto-dialog [hidden] {
	display: none !important;
}

@media (max-width: 600px) {
	.wcvto-modal {
		padding: 0;
		align-items: flex-end;
	}

	.wcvto-dialog {
		max-width: none;
		max-height: 94vh;
		max-height: 94dvh;
		border-radius: 20px 20px 0 0;
		padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
		animation-name: wcvto-sheet;
	}
}

.wcvto-close {
	position: absolute;
	inset-block-start: 12px;
	inset-inline-end: 12px;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--wcvto-soft);
	color: var(--wcvto-text);
	cursor: pointer;
}

.wcvto-close:hover {
	background: var(--wcvto-line);
}

.wcvto-close svg {
	width: 18px;
	height: 18px;
}

/* ---------- Header ---------- */

.wcvto-head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-block-end: 18px;
	padding-inline-end: 44px;
}

.wcvto-garment {
	width: 48px;
	height: 60px;
	object-fit: cover;
	border-radius: 8px;
	background: var(--wcvto-soft);
	flex: none;
}

.wcvto-dialog h2 {
	font-size: 18px;
	font-weight: 650;
	line-height: 1.25;
	color: var(--wcvto-text);
}

.wcvto-product-name {
	color: var(--wcvto-muted);
	font-size: 14px;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* ---------- Upload step ---------- */

.wcvto-file {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.wcvto-drop {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 190px;
	padding: 16px;
	border: 2px dashed #cfcfcf;
	border-radius: var(--wcvto-radius);
	background: var(--wcvto-soft);
	text-align: center;
	cursor: pointer;
	transition: border-color 0.15s, background-color 0.15s;
}

.wcvto-drop:hover,
.wcvto-file:focus-visible + .wcvto-drop {
	border-color: var(--wcvto-accent);
}

.wcvto-file:focus-visible + .wcvto-drop {
	outline: 2px solid var(--wcvto-accent);
	outline-offset: 2px;
}

.wcvto-drop.has-photo {
	padding: 8px;
	border-style: solid;
	border-color: var(--wcvto-line);
	background: #fff;
}

.wcvto-drop-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	color: var(--wcvto-muted);
	font-size: 14px;
}

.wcvto-drop-empty svg {
	width: 40px;
	height: 40px;
	margin-block-end: 6px;
	color: var(--wcvto-text);
}

.wcvto-drop-empty strong {
	color: var(--wcvto-text);
	font-size: 16px;
	font-weight: 600;
}

.wcvto-preview {
	max-height: 300px;
	width: auto !important;
	border-radius: 10px;
	object-fit: contain;
}

.wcvto-photo-actions {
	display: flex;
	justify-content: center;
	gap: 18px;
	margin-block-start: 8px !important;
}

.wcvto-link {
	padding: 4px 0;
	border: 0;
	background: none;
	color: var(--wcvto-text);
	font-size: 14px !important;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.wcvto-forget {
	color: var(--wcvto-muted);
}

.wcvto-tips {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px 14px;
	margin: 16px 0 !important;
	list-style: none;
	font-size: 13px;
	color: var(--wcvto-muted);
}

.wcvto-tips li {
	position: relative;
	margin: 0;
	padding-inline-start: 18px;
}

.wcvto-tips li::before {
	content: "";
	position: absolute;
	inset-inline-start: 2px;
	top: 0.45em;
	width: 9px;
	height: 5px;
	border-inline-start: 2px solid var(--wcvto-accent);
	border-bottom: 2px solid var(--wcvto-accent);
	transform: rotate(-45deg);
}

[dir="rtl"] .wcvto-tips li::before {
	transform: rotate(45deg);
}

@media (max-width: 380px) {
	.wcvto-tips {
		grid-template-columns: 1fr;
	}
}

.wcvto-consent {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-block-end: 14px;
	font-size: 13px;
	line-height: 1.45;
	color: var(--wcvto-muted);
	cursor: pointer;
}

.wcvto-consent input {
	flex: none;
	width: 18px;
	height: 18px;
	margin: 1px 0 0;
	accent-color: var(--wcvto-accent);
}

.wcvto-msg {
	margin-block-end: 14px !important;
	padding: 10px 12px !important;
	border-radius: 10px;
	background: #fdecec;
	color: #8a1c1c;
	font-size: 14px;
}

/* ---------- Buttons ---------- */

.wcvto-primary,
.wcvto-secondary {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 48px;
	padding: 12px 18px;
	border-radius: 999px;
	font-size: 15px !important;
	font-weight: 600 !important;
	line-height: 1.2;
	text-align: center;
	text-decoration: none !important;
	cursor: pointer;
	transition: opacity 0.15s, background-color 0.15s;
}

.wcvto-primary {
	border: 0;
	background: var(--wcvto-accent) !important;
	color: var(--wcvto-accent-text) !important;
}

.wcvto-primary:hover {
	opacity: 0.9;
}

.wcvto-primary:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.wcvto-secondary {
	border: 1.5px solid var(--wcvto-line);
	background: #fff !important;
	color: var(--wcvto-text) !important;
}

.wcvto-secondary:hover {
	border-color: var(--wcvto-text);
}

.wcvto-primary:focus-visible,
.wcvto-secondary:focus-visible,
.wcvto-link:focus-visible,
.wcvto-close:focus-visible,
.wcvto-compare:focus-visible {
	outline: 2px solid var(--wcvto-accent);
	outline-offset: 2px;
}

/* ---------- Loading step ---------- */

.wcvto-loading {
	position: relative;
	overflow: hidden;
	max-width: 260px;
	margin: 4px auto 16px;
	border-radius: var(--wcvto-radius);
	background: var(--wcvto-soft);
	aspect-ratio: 3 / 4;
}

.wcvto-loading-photo {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover;
	filter: blur(3px) saturate(0.7);
	opacity: 0.75;
	transform: scale(1.05);
}

.wcvto-scan {
	position: absolute;
	inset-inline: 0;
	top: 0;
	height: 30%;
	background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.85) 85%, var(--wcvto-accent) 100%);
	opacity: 0.7;
	animation: wcvto-scan 2.2s ease-in-out infinite alternate;
}

.wcvto-loading-text {
	text-align: center;
	font-weight: 600;
	min-height: 1.5em;
}

.wcvto-small {
	margin-block-start: 6px !important;
	text-align: center;
	font-size: 12.5px;
	color: var(--wcvto-muted);
}

/* ---------- Result step ---------- */

.wcvto-result-wrap {
	position: relative;
	border-radius: var(--wcvto-radius);
	overflow: hidden;
	background: var(--wcvto-soft);
}

.wcvto-result,
.wcvto-original {
	width: 100% !important;
	max-height: 62vh;
	max-height: 62dvh;
	object-fit: contain;
	margin: 0 auto;
	animation: wcvto-fade 0.35s ease-out;
}

.wcvto-compare {
	position: absolute;
	inset-block-end: 10px;
	inset-inline-start: 50%;
	transform: translateX(-50%);
	padding: 7px 14px;
	border: 0;
	border-radius: 999px;
	background: rgba(17, 17, 17, 0.72);
	color: #fff;
	font-size: 13px !important;
	font-weight: 600;
	white-space: nowrap;
	cursor: pointer;
	backdrop-filter: blur(4px);
}

[dir="rtl"] .wcvto-compare {
	transform: translateX(50%);
}

.wcvto-actions {
	display: grid;
	gap: 10px;
	margin-block-start: 14px;
}

.wcvto-actions-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.wcvto-step[data-step="login"] p {
	margin-block-end: 16px;
}

/* ---------- Motion ---------- */

@keyframes wcvto-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes wcvto-rise {
	from { opacity: 0; transform: translateY(12px) scale(0.98); }
	to { opacity: 1; transform: none; }
}

@keyframes wcvto-sheet {
	from { transform: translateY(40px); opacity: 0.4; }
	to { transform: none; opacity: 1; }
}

@keyframes wcvto-scan {
	from { transform: translateY(-100%); }
	to { transform: translateY(330%); }
}

@media (prefers-reduced-motion: reduce) {
	.wcvto-backdrop,
	.wcvto-dialog,
	.wcvto-result,
	.wcvto-original {
		animation: none;
	}

	.wcvto-scan {
		animation: none;
		top: auto;
		bottom: 0;
		height: 4px;
		background: var(--wcvto-accent);
	}
}
