/* Compatibilità smartphone: i padding non sforano la larghezza (no scroll orizzontale). Circoscritto al modulo. */
.tspos-wrap, .tspos-wrap *, .tspos-wrap *::before, .tspos-wrap *::after { box-sizing: border-box; }
.tspos-wrap img, .tspos-wrap canvas { max-width: 100%; }
/* Telastampa — Modulo POSTER — frontend
   IMPL-POSTER 🔒 PARANOID — prefisso .tspos- per non collidere */

.tspos-wrap { max-width: 1100px; margin: 0 auto; font-family: inherit; }
.tspos-title { font-size: 1.4em; font-weight: 700; margin: 0 0 4px; }
.tspos-sub { color: #666; margin: 0 0 16px; font-size: .95em; }

/* Selettore misura */
.tspos-misure-label { font-size: .9em; font-weight: 600; color: #555; margin: 0 0 8px; }
.tspos-misure { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tspos-misura-btn {
	flex: 1 1 100px; padding: 10px 6px; border: 2px solid #ddd; border-radius: 10px;
	background: #fff; cursor: pointer; text-align: center; transition: all .2s;
	font-size: 13px; color: #555; font-family: inherit; line-height: 1.3;
}
.tspos-misura-btn:hover { border-color: #e8650a; color: #e8650a; }
.tspos-misura-btn.active { border-color: #e8650a; background: #e8650a; color: #fff; font-weight: 700; }
.tspos-misura-dim { font-size: 1.2em; font-weight: 700; display: block; }
.tspos-misura-unit { font-size: .75em; opacity: .75; }

/* Anteprima */
.tspos-preview-box {
	position: relative; width: 100%;
	border: 1px solid #cfcfcf; background: #fafafa;
	border-radius: 8px; overflow: hidden;
	display: flex; align-items: center; justify-content: center;
	min-height: 300px;
}
.tspos-canvas { display: block; max-width: 100%; max-height: 70vh; height: auto; touch-action: none; cursor: grab; }
.tspos-canvas:active { cursor: grabbing; }
.tspos-hint {
	position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
	color: #999; font-size: .95em; text-align: center; pointer-events: none; padding: 0 16px;
}
/* Stato vuoto: box toccabile per caricare la foto */
.tspos-preview-box.tspos-empty { cursor: pointer; border: 2px dashed #c9a24b; background: #fcf8ee; }
.tspos-preview-box.tspos-empty .tspos-hint { color: #a07f33; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tspos-hint-ico { font-size: 30px; }

/* Zoom */
.tspos-zoombar { margin-top: 12px; display: flex; gap: 20px; flex-wrap: wrap; }
.tspos-zoom-row { flex: 1 1 320px; display: flex; align-items: center; gap: 10px; }
.tspos-zoom-row label { font-size: .9em; color: #555; min-width: 80px; }
.tspos-zoom { flex: 1; }
.tspos-zoom:disabled { opacity: .4; }

/* Pannelli controllo */
.tspos-controls { display: flex; gap: 20px; margin-top: 20px; flex-wrap: wrap; }
.tspos-panel {
	flex: 1 1 320px; background: #fff; border: 1px solid #e3e3e3;
	border-radius: 10px; padding: 16px 18px;
}
.tspos-panel h3 { margin: 0 0 12px; font-size: 1.05em; }
.tspos-btn {
	display: inline-block; border: 0; border-radius: 8px; cursor: pointer;
	padding: 10px 18px; font-size: .95em; font-weight: 600; color: #fff;
	background: #3a6bb0;
}
.tspos-btn:disabled { opacity: .5; cursor: default; }
.tspos-file { display: none; }
.tspos-filename { margin-top: 8px; font-size: .82em; color: #888; word-break: break-all; }
.tspos-err { color: #b00; font-size: .85em; margin-top: 8px; }

.tspos-opt-row { margin-top: 12px; display: flex; align-items: center; gap: 10px; }
.tspos-opt-row label { font-size: .9em; color: #555; min-width: 60px; }
.tspos-opt-row select, .tspos-opt-row input[type="text"] { flex: 1; padding: 6px 8px; border: 1px solid #ccc; border-radius: 6px; }

/* Editor testi (versione C) */
.tspos-testi-panel .tspos-add-testo {
	display: block; width: 100%; border: 2px dashed #e8650a; background: #fff7f0;
	color: #e8650a; padding: 10px; border-radius: 8px; font-weight: 600; cursor: pointer;
	margin-bottom: 12px;
}
.tspos-testi-panel .tspos-add-testo:hover { background: #ffe8d3; }
.tspos-testi-panel .tspos-applica-testo {
	display: block; width: 100%; border: none; background: #e8650a; color: #fff;
	padding: 12px; border-radius: 8px; font-weight: 700; cursor: pointer; margin-top: 12px;
}
.tspos-testi-panel .tspos-applica-testo:hover { background: #cf5407; }
.tspos-testi-list { display: flex; flex-direction: column; gap: 10px; }
.tspos-testo-row {
	background: #fafafa; border: 2px solid #e3e3e3; border-radius: 8px;
	padding: 10px; cursor: pointer; transition: border-color .15s;
}
.tspos-testo-row.selected { border-color: #e8650a; background: #fff7f0; }
.tspos-testo-input {
	width: 100%; padding: 6px 8px; border: 1px solid #ccc; border-radius: 6px;
	font-size: 14px; margin-bottom: 6px;
}
.tspos-testo-controls {
	display: grid;
	grid-template-columns: auto 1fr auto auto auto auto;
	gap: 6px; align-items: center;
	font-size: 12px;
}
.tspos-testo-controls label { color: #666; font-size: 11px; }
.tspos-testo-controls select { padding: 4px; border: 1px solid #ccc; border-radius: 4px; font-size: 12px; }
.tspos-testo-controls input[type="color"] { width: 30px; height: 26px; padding: 0; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; }
.tspos-testo-del {
	background: #fff; border: 1px solid #e44; color: #e44;
	padding: 6px 10px; border-radius: 6px; font-size: 13px; cursor: pointer;
	margin-top: 6px;
}
.tspos-testo-del:hover { background: #fee; }

.tspos-tip { font-size: .8em; color: #999; margin-top: 8px; line-height: 1.4; }
.tspos-note { margin-top: 18px; color: #777; font-size: .85em; }

/* Carrello */
.tspos-cart { margin-top: 18px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.tspos-prezzo { font-size: 1.4em; font-weight: 700; }
.tspos-addcart {
	border: 0; border-radius: 8px; cursor: pointer;
	padding: 14px 28px; font-size: 1em; font-weight: 700; color: #fff;
	background: #e8650a;
}
.tspos-addcart:hover:not(:disabled) { background: #c8540a; }
.tspos-addcart:disabled { opacity: .45; cursor: default; }
.tspos-cart-msg { font-size: .9em; color: #555; flex-basis: 100%; }

@media (max-width: 600px) {
	.tspos-misura-btn { flex: 1 1 30%; padding: 8px 4px; font-size: 12px; }
	.tspos-misura-dim { font-size: 1.1em; }
	.tspos-testo-controls { grid-template-columns: 1fr 1fr; }
	/* Canvas più basso su mobile: lascia spazio attorno per scorrere la pagina
	   (sul canvas il tocco trascina la foto, non scrolla). */
	.tspos-canvas { max-height: 52vh; }
}

/* [v41.74] Desktop (>880px): comandi a SINISTRA, anteprima a DESTRA sticky.
   Versione robusta: ogni figlio forzato in colonna 1 (niente auto-piazzamenti in colonna 2),
   pannelli comandi impilati e contenuti nella colonna (min-width:0), anteprima che copre tutte le righe. */
@media (min-width: 881px) {
	.tspos-wrap { display: grid; grid-template-columns: 380px minmax(0, 1fr); column-gap: 24px; align-items: start; }
	.tspos-wrap > * { grid-column: 1; min-width: 0; }
	.tspos-title, .tspos-sub { grid-column: 1 / -1; }
	.tspos-zoombar { margin-top: 0; }
	.tspos-controls { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
	.tspos-controls .tspos-panel { width: 100%; min-width: 0; }
	.tspos-preview-box { grid-column: 2; grid-row: 3 / span 60; position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); }
}
