/**
 * WC Barcode Scanner — estilos del botón y del modal de escaneo.
 * Todo va bajo el prefijo .wcbs- para no chocar con el tema.
 */

.wcbs-wrap {
	margin: 1em 0;
}

.wcbs-align-center {
	text-align: center;
}

.wcbs-align-right {
	text-align: right;
}

.wcbs-open {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	cursor: pointer;
}

.wcbs-icon {
	flex: 0 0 auto;
}

body.wcbs-lock {
	overflow: hidden;
}

/* ------------------------------------------------------------------ modal */

.wcbs-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	background: rgba(0, 0, 0, 0.75);
	-webkit-overflow-scrolling: touch;
}

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

.wcbs-dialog {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 480px;
	max-height: 100%;
	overflow-y: auto;
	background: #fff;
	color: #1e1e1e;
	border-radius: 0;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

@media (min-width: 600px) {

	.wcbs-modal {
		padding: 24px;
	}

	.wcbs-dialog {
		max-height: calc(100vh - 48px);
		border-radius: 12px;
	}
}

.wcbs-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.wcbs-title {
	margin: 0;
	font-size: 17px;
	line-height: 1.3;
	font-weight: 600;
}

.wcbs-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	color: inherit;
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.wcbs-close:hover,
.wcbs-close:focus-visible {
	background: rgba(0, 0, 0, 0.07);
}

/* ----------------------------------------------------------------- cámara */

.wcbs-stage {
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #000;
}

.wcbs-stage[hidden] {
	display: none;
}

.wcbs-video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: #000;
}

.wcbs-reticle {
	position: absolute;
	top: 25%;
	right: 5%;
	bottom: 25%;
	left: 5%;
	pointer-events: none;
	box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

.wcbs-corner {
	position: absolute;
	width: 26px;
	height: 26px;
	border: 3px solid #fff;
}

.wcbs-corner.tl {
	top: 0;
	left: 0;
	border-right: 0;
	border-bottom: 0;
}

.wcbs-corner.tr {
	top: 0;
	right: 0;
	border-bottom: 0;
	border-left: 0;
}

.wcbs-corner.bl {
	bottom: 0;
	left: 0;
	border-top: 0;
	border-right: 0;
}

.wcbs-corner.br {
	right: 0;
	bottom: 0;
	border-top: 0;
	border-left: 0;
}

.wcbs-laser {
	position: absolute;
	left: 8%;
	width: 84%;
	height: 2px;
	background: #e23b3b;
	box-shadow: 0 0 8px rgba(226, 59, 59, 0.9);
	animation: wcbs-sweep 2.4s ease-in-out infinite;
}

@keyframes wcbs-sweep {

	0%,
	100% {
		top: 8%;
	}

	50% {
		top: 92%;
	}
}

@media (prefers-reduced-motion: reduce) {

	.wcbs-laser {
		top: 50%;
		animation: none;
	}
}

.wcbs-tools {
	position: absolute;
	right: 10px;
	bottom: 10px;
	display: flex;
	gap: 8px;
}

.wcbs-tool {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	color: #fff;
	background: rgba(0, 0, 0, 0.55);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.wcbs-tool[hidden] {
	display: none;
}

.wcbs-tool.is-on {
	color: #111;
	background: #ffd54a;
}

/* --------------------------------------------------------------- mensajes */

.wcbs-status {
	margin: 0;
	padding: 12px 16px;
	font-size: 14px;
	line-height: 1.4;
	text-align: center;
}

.wcbs-status.is-error {
	color: #8a1f11;
	background: #fdecea;
}

.wcbs-status.is-muted {
	color: #555;
}

/* ------------------------------------------------------------- resultados */

.wcbs-results {
	padding: 0 16px;
}

.wcbs-results:empty {
	padding: 0;
}

.wcbs-list {
	margin: 0 0 12px;
	padding: 0;
	list-style: none;
}

.wcbs-card {
	padding: 12px 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.wcbs-card.is-out {
	opacity: 0.65;
}

.wcbs-card-link {
	display: flex;
	align-items: center;
	gap: 12px;
	color: inherit;
	text-decoration: none;
}

.wcbs-card-img {
	flex: 0 0 64px;
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 6px;
}

.wcbs-card-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.wcbs-card-name {
	font-weight: 600;
	line-height: 1.3;
}

.wcbs-card-price {
	font-size: 14px;
}

.wcbs-card-price del {
	opacity: 0.6;
}

.wcbs-card-meta {
	font-size: 12px;
	color: #666;
}

.wcbs-card-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.wcbs-btn {
	display: inline-block;
	padding: 9px 14px;
	font-size: 14px;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	border: 1px solid currentColor;
	border-radius: 6px;
	cursor: pointer;
}

.wcbs-btn-primary {
	color: #fff;
	background: #1e1e1e;
	border-color: #1e1e1e;
}

.wcbs-btn-ghost {
	color: inherit;
	background: transparent;
}

.wcbs-again {
	display: block;
	width: 100%;
	margin: 4px 0 12px;
}

.wcbs-empty {
	margin: 8px 0;
	text-align: center;
}

.wcbs-search-link {
	display: block;
	margin-bottom: 12px;
	text-align: center;
}

/* ---------------------------------------------------------- entrada manual */

.wcbs-manual {
	margin-top: auto;
	padding: 14px 16px 18px;
	border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.wcbs-manual-label {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	color: #555;
}

.wcbs-manual-row {
	display: flex;
	gap: 8px;
}

.wcbs-manual-input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 10px 12px;
	font-size: 16px; /* Evita el zoom automático en iOS. */
	border: 1px solid #c9c9c9;
	border-radius: 6px;
}

.wcbs-manual-submit {
	flex: 0 0 auto;
	cursor: pointer;
}
