/**
 * IFA Product Codes - Integrazione grafica nel footer scheda prodotto IFA
 */

/* ============================================
   RESET E CONTENIMENTO NEL FOOTER
   ============================================ */

/* Il contenitore .ifa-barcode deve essere inline nel footer */
.ifa-sheet__footer .ifa-barcode {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0;
	flex-shrink: 0;
}

/* Nascondi label e value originali quando il plugin è attivo */
.ifa-barcode:has(.ifa-product-codes--ready) .ifa-barcode__label,
.ifa-barcode:has(.ifa-product-codes--ready) .ifa-barcode__value {
	display: none;
}

/* Reset totale del placeholder grafico del tema */
.ifa-barcode__graphic {
	background: none !important;
	border: none !important;
	width: auto !important;
	height: auto !important;
	padding: 0 !important;
	margin: 0 !important;
}

/* ============================================
   WRAPPER DEI CODICI - Layout orizzontale
   ============================================ */

.ifa-product-codes__wrapper {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	gap: 16px;
	padding: 0;
	margin: 0;
	align-items: stretch;
}

/* ============================================
   SINGOLO BOX (Barcode / QR Code)
   ============================================ */

.ifa-product-codes__item {
	position: relative;
	flex: 0 0 auto;
	width: 180px;
	background: #fff;
	border-radius: 10px;
	padding: 14px 16px 16px;
	border: 1px solid rgba(0, 0, 0, 0.1);
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
	overflow: hidden;
}

/* Overlay gradiente sottile */
.ifa-product-codes__item::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 10px;
	background: linear-gradient(145deg, transparent 50%, rgba(0, 0, 0, 0.02));
	pointer-events: none;
}

/* ============================================
   TITOLO DEL BOX
   ============================================ */

.ifa-product-codes__title {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 1.2px;
	text-transform: uppercase;
	color: #111;
	margin: 0 0 10px;
	padding: 0;
	position: relative;
	z-index: 1;
	display: flex;
	justify-content: space-between;
	align-items: center;
	line-height: 1;
}

.ifa-product-codes__title::after {
	content: '';
	width: 24px;
	height: 2px;
	border-radius: 2px;
	background: #111;
	display: block;
	flex-shrink: 0;
}

/* ============================================
   AREA GRAFICA (figura con sfondo)
   ============================================ */

.ifa-product-codes__figure {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 14px;
	border-radius: 8px;
	background: #f5f5f5;
}

/* Bordo tratteggiato interno */
.ifa-product-codes__figure::before {
	content: '';
	position: absolute;
	inset: 4px;
	border: 1px dashed rgba(0, 0, 0, 0.12);
	border-radius: 6px;
	pointer-events: none;
}

/* ============================================
   BARCODE (SVG)
   ============================================ */

.ifa-product-codes__barcode {
	width: 100%;
	height: 60px;
	max-width: 150px;
	display: block;
}

/* Nascondi il testo sotto il barcode (generato da JsBarcode) */
.ifa-product-codes__barcode text {
	display: none !important;
}

/* ============================================
   QR CODE - FIX: la libreria genera canvas + img
   ============================================ */

.ifa-product-codes__qrcode {
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
}

/* Nascondi il canvas, mostra solo l'immagine (più nitida) */
.ifa-product-codes__qrcode canvas {
	display: none !important;
}

.ifa-product-codes__qrcode img {
	width: 100px !important;
	height: 100px !important;
	display: block !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
	.ifa-sheet__footer .ifa-barcode {
		width: 100%;
	}

	.ifa-product-codes__wrapper {
		flex-wrap: wrap;
		justify-content: flex-start;
	}

	.ifa-product-codes__item {
		width: 160px;
	}
}

@media (max-width: 480px) {
	.ifa-product-codes__wrapper {
		gap: 12px;
	}

	.ifa-product-codes__item {
		width: 140px;
		padding: 12px 14px 14px;
	}

	.ifa-product-codes__title {
		font-size: 9px;
		margin-bottom: 8px;
	}

	.ifa-product-codes__figure {
		padding: 10px;
	}

	.ifa-product-codes__barcode {
		height: 50px;
		max-width: 120px;
	}

	.ifa-product-codes__qrcode img {
		width: 80px !important;
		height: 80px !important;
	}
}

/* ============================================
   STAMPA
   ============================================ */

@media print {
	.ifa-product-codes__item {
		box-shadow: none;
		border: 1px solid #ccc;
	}

	.ifa-product-codes__figure {
		background: #fff;
	}

	.ifa-product-codes__figure::before {
		border-color: #ccc;
	}
}
