/* Shared full-screen barcode scanner overlay (assets/js/scan-engine.js).
 * Used by both the storefront scan-to-cart and the Product Manager panel. */
body.freshio-scan-open {
	overflow: hidden;
}

.freshio-scan {
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: #000;
	display: none;
	flex-direction: column;
	color: #fff;
}
.freshio-scan.is-open {
	display: flex;
}

.freshio-scan__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 12px 10px 16px;
	padding-top: calc(10px + env(safe-area-inset-top));
}
.freshio-scan__title {
	margin: 0;
	font-size: 16px;
	color: #fff;
}
.freshio-scan__tools {
	display: flex;
	align-items: center;
	gap: 4px;
}
.freshio-scan__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	margin: 0;
	background: none;
	border: 0;
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
	font-size: 30px;
	line-height: 1;
}
.freshio-scan__btn:hover,
.freshio-scan__btn:focus {
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
}
.freshio-scan__btn svg {
	width: 24px;
	height: 24px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.freshio-scan__mute.is-muted {
	color: rgba(255, 255, 255, 0.6);
}

.freshio-scan__reader {
	flex: 1;
	width: 100%;
	position: relative;
	overflow: hidden;
}
.freshio-scan__reader video {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.freshio-scan__guide {
	position: absolute;
	left: 8%;
	right: 8%;
	top: 32%;
	bottom: 32%;
	border: 2px solid rgba(255, 255, 255, 0.8);
	border-radius: 10px;
	box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
	pointer-events: none;
	transition: border-color 0.15s, background-color 0.15s;
}
.freshio-scan__laser {
	position: absolute;
	left: 6%;
	right: 6%;
	top: 50%;
	height: 2px;
	background: #ff3b30;
	box-shadow: 0 0 8px #ff3b30;
	animation: freshio-scan-laser 1.6s ease-in-out infinite;
}
.freshio-scan__guide.is-hit {
	border-color: #34c759;
	background-color: rgba(52, 199, 89, 0.25);
}
.freshio-scan__guide.is-hit .freshio-scan__laser {
	display: none;
}
@keyframes freshio-scan-laser {
	0%, 100% { opacity: 0.35; }
	50% { opacity: 1; }
}

.freshio-scan__footer {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	padding-bottom: calc(20px + env(safe-area-inset-bottom));
}
.freshio-scan__status {
	min-height: 1.5em;
	text-align: center;
	font-size: 14px;
}
.freshio-scan__torch {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	margin: 0;
	background: rgba(255, 255, 255, 0.15);
	border: 0;
	border-radius: 999px;
	color: #fff;
	font-size: 14px;
	cursor: pointer;
}
.freshio-scan__torch[hidden] {
	display: none;
}
.freshio-scan__torch svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linejoin: round;
}
.freshio-scan__torch.is-on {
	background: #ffd60a;
	color: #000;
}
.freshio-scan__torch.is-hinting {
	animation: freshio-scan-pulse 1s ease-in-out infinite;
}
@keyframes freshio-scan-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(255, 214, 10, 0.7); }
	50% { box-shadow: 0 0 0 10px rgba(255, 214, 10, 0); }
}
@media (prefers-reduced-motion: reduce) {
	.freshio-scan__laser,
	.freshio-scan__torch.is-hinting {
		animation: none;
	}
}

/* ---- Multiple barcodes: frozen frame + numbered outlines + bottom list ---- */
.freshio-scan__freeze {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: none;
}
.freshio-scan__marks {
	position: absolute;
	inset: 0;
	pointer-events: none;
}
.freshio-scan.is-choosing .freshio-scan__freeze {
	display: block;
}
.freshio-scan.is-choosing .freshio-scan__guide,
.freshio-scan.is-choosing .freshio-scan__status,
.freshio-scan.is-choosing .freshio-scan__torch {
	display: none;
}
.freshio-scan__box {
	position: absolute;
	border: 3px solid #ffd60a;
	border-radius: 6px;
	background: rgba(255, 214, 10, 0.15);
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}
.freshio-scan__mark {
	position: absolute;
	transform: translate(-50%, -50%);
	width: 40px;
	height: 40px;
	padding: 0;
	margin: 0;
	border: 2px solid #000;
	border-radius: 50%;
	background: #ffd60a;
	color: #000;
	font-size: 18px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	pointer-events: auto;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
/* Bigger invisible tap target than the visible badge. */
.freshio-scan__mark::after {
	content: "";
	position: absolute;
	inset: -10px;
}

.freshio-scan__chooser {
	width: 100%;
	max-width: 520px;
	max-height: 45vh;
	overflow-y: auto;
}
.freshio-scan__chooser[hidden] {
	display: none;
}
.freshio-scan__chooser-title {
	margin: 0 0 10px;
	text-align: center;
	font-size: 15px;
	font-weight: 600;
	color: #fff;
}
.freshio-scan__choices {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.freshio-scan__choice {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	min-height: 56px;
	padding: 8px 12px;
	margin: 0;
	border: 0;
	border-radius: 12px;
	background: #fff;
	color: #111;
	text-align: left;
	cursor: pointer;
}
.freshio-scan__choice:active {
	background: #fff6c2;
}
.freshio-scan__choice-num {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: #ffd60a;
	color: #000;
	font-weight: 700;
}
.freshio-scan__choice-img {
	flex: none;
	width: 44px;
	height: 44px;
	object-fit: contain;
	border-radius: 6px;
	background: #f3f3f3;
}
.freshio-scan__choice-img[hidden] {
	display: none;
}
.freshio-scan__choice-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.freshio-scan__choice-label {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.25;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}
.freshio-scan__choice-meta {
	font-size: 12px;
	color: #666;
	margin-top: 2px;
}
.freshio-scan__choice.is-missing .freshio-scan__choice-label {
	color: #888;
	font-weight: 500;
}
.freshio-scan__rescan {
	display: block;
	width: 100%;
	margin: 10px 0 0;
	padding: 12px;
	border: 1px solid rgba(255, 255, 255, 0.6);
	border-radius: 12px;
	background: transparent;
	color: #fff;
	font-size: 15px;
	cursor: pointer;
}
