/*
 * Simulateur de devis (maquette index.html, section « Nos 4 formats »).
 * Trois zones : réglages (pages, exemplaires, adresses), prix par format, devis détaillé.
 * Réutilisable sur Nos formats et Tarifs et délais.
 */

.dv {
	line-height: normal; /* interligne par défaut, comme la maquette */
	margin-top: var(--space-2xl);
	padding: 14px;
	display: grid;
	grid-template-columns: minmax(0, 290px) minmax(0, 1fr) minmax(0, 340px);
	gap: 14px;
	align-items: stretch;
}

.dv-k {
	color: var(--encre-3);
	margin-bottom: 6px;
}

/* ---------- Réglages ---------- */
.dv-set {
	background: var(--papier-2);
	border-radius: var(--radius-l);
	padding: 24px 22px;
	display: flex;
	flex-direction: column;
	gap: 26px;
	min-width: 0;
}

.dv-field {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.dv-lab {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	font-size: 15px;
	font-weight: 600;
}

.dv-val {
	font-size: 14px;
	color: var(--encre-2);
	font-weight: 500;
	white-space: nowrap;
}

.dv-val .num {
	font-size: 28px;
	color: var(--encre);
	margin-right: 2px;
}

/* Nombre d'exemplaires : saisie libre, soulignée en pointillé pour se signaler. */
.dv-val .dv-saisie {
	width: 4.4ch;
	padding: 0 2px;
	border: 0;
	border-bottom: 2px dashed var(--trait);
	border-radius: 0;
	background: transparent;
	line-height: 1.1;
	text-align: right;
	-moz-appearance: textfield;
	appearance: textfield;
}

.dv-val .dv-saisie:hover {
	border-bottom-color: var(--encre-3);
}

.dv-val .dv-saisie:focus {
	outline: none;
	border-bottom-color: var(--rose);
	border-bottom-style: solid;
}

.dv-ctl {
	display: flex;
	align-items: center;
	gap: 10px;
}

.dv-pm {
	flex: none;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 1px solid var(--trait);
	background: var(--papier);
	color: var(--encre);
	font: 500 20px/1 var(--font-sans);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s, color 0.2s;
}

.dv-pm:hover {
	background: var(--encre);
	color: var(--sur-encre);
}

.dv-pm[aria-disabled="true"] {
	opacity: 0.35;
	pointer-events: none;
}

.dv-pm:focus-visible,
.dv-row:focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: 2px;
}

.dv-range {
	flex: 1;
	min-width: 0;
	-webkit-appearance: none;
	appearance: none;
	height: 6px;
	border-radius: var(--radius-pill);
	background: linear-gradient(90deg, var(--rose) 0 var(--p, 0%), var(--filet-papier) var(--p, 0%) 100%);
	outline: none;
	cursor: pointer;
	margin: 0;
}

.dv-range::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--papier);
	border: 6px solid var(--encre);
	box-sizing: border-box;
	box-shadow: 0 2px 6px rgba(30, 27, 23, 0.25);
}

.dv-range::-moz-range-thumb {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--papier);
	border: 6px solid var(--encre);
	box-sizing: border-box;
}

.dv-range:focus-visible::-webkit-slider-thumb {
	outline: 3px solid var(--focus);
	outline-offset: 2px;
}

.dv-scale {
	display: flex;
	justify-content: space-between;
	padding: 0 46px;
	font-size: 12px;
	color: var(--encre-3);
}

.dv-step {
	display: flex;
	align-items: center;
	gap: 12px;
}

.dv-addr {
	font-size: 30px;
	min-width: 28px;
	text-align: center;
}

.dv-addr-n {
	margin-left: auto;
	font-size: 13px;
	font-weight: 600;
	color: var(--pistache-encre);
	background: var(--pistache-pale);
	border-radius: var(--radius-pill);
	padding: 5px 11px;
	white-space: nowrap;
}

.dv-more {
	margin-top: auto;
	padding: 16px 18px;
	border-radius: 16px;
	background: var(--papier);
	font-size: 14px;
	line-height: 1.5;
	color: var(--encre-2);
}

.dv-more strong {
	display: block;
	color: var(--encre);
	font-size: 15px;
	margin-bottom: 2px;
}

.dv-more a {
	display: inline-block;
	margin-top: 6px;
	font-weight: 600;
	color: var(--encre);
}

.dv-more a:hover {
	color: var(--rose);
}

/* ---------- Prix par format ---------- */
.dv-fmts {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 20px 8px 8px;
	min-width: 0;
}

.dv-fmts .dv-k {
	padding-left: 10px;
}

.dv-row {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	min-height: 78px;
	padding: 14px 16px;
	border: 1px solid var(--trait-fin);
	border-radius: 16px;
	background: var(--papier);
	color: var(--encre);
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: background-color 0.25s, border-color 0.25s;
}

.dv-row:hover {
	border-color: var(--encre);
}

.dv-row[aria-checked="true"] {
	background: var(--encre);
	color: var(--sur-encre);
	border-color: var(--encre);
}

.dv-chip {
	flex: none;
	width: 20px;
	height: 28px;
	border-radius: 3px;
	background: var(--puce);
}

.dv-row[aria-checked="true"] .dv-chip {
	box-shadow: 0 0 0 2px var(--sur-encre);
}

.dv-rt {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.dv-rn {
	font-size: 18px;
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.dv-rs {
	font-size: 13px;
	color: var(--encre-3);
}

.dv-row[aria-checked="true"] .dv-rs,
.dv-row[aria-checked="true"] .dv-ttc {
	color: var(--sur-encre-2);
}

.dv-rp {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
	text-align: right;
}

.dv-ht {
	display: flex;
	align-items: baseline;
	gap: 5px;
	white-space: nowrap;
}

.dv-ht .num {
	font-size: 23px;
	line-height: 1.1;
}

.dv-u {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.06em;
}

.dv-ttc {
	font-size: 12.5px;
	color: var(--encre-3);
	white-space: nowrap;
}

/* Format indisponible pour ces réglages */
.dv-row.na {
	background: transparent;
	border-style: dashed;
}

.dv-row.na .dv-rn,
.dv-row.na .dv-chip {
	opacity: 0.5;
}

.dv-row.na .dv-rs {
	color: var(--orange-encre);
}

.dv-row.na[aria-checked="true"] {
	background: var(--papier-2);
	color: var(--encre);
	border-color: var(--encre);
}

.dv-row.na[aria-checked="true"] .dv-ttc {
	color: var(--encre-3);
}

.dv-foot {
	margin: 4px 10px 0;
	font-size: 13px;
	color: var(--encre-3);
}

.dv-cmp {
	width: fit-content;
	margin-top: 14px;
}

/* ---------- Devis ---------- */
.dv-sum {
	background: var(--papier-2);
	border-radius: var(--radius-l);
	padding: 22px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.dv-sum .dv-k {
	color: var(--rose-fonce);
}

.dv-prev {
	position: relative;
	height: 190px;
	margin: -4px 0 14px;
	border-radius: var(--radius-m);
	background-color: var(--sable);
	background-image: linear-gradient(90deg, var(--trait-fin) 1px, transparent 1px), linear-gradient(0deg, var(--trait-fin) 1px, transparent 1px);
	background-size: 18px 18px;
	overflow: hidden;
}

.dv-sheet {
	position: absolute;
	left: 50%;
	top: 50%;
	width: var(--l, 96px);
	height: var(--h, 139px);
	translate: -50% -50%;
	border-radius: 4px;
	box-shadow: 0 10px 22px rgba(30, 27, 23, 0.14);
	background: var(--puce);
	transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), height 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.3s;
	padding: 9px;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.dv-sheet.s-b {
	rotate: -7deg;
	translate: -62% -48%;
	opacity: 0.55;
}

.dv-sheet.s-a {
	rotate: 5deg;
	translate: -40% -52%;
	opacity: 0.8;
}

.dv-sheet.s-u {
	background: var(--papier);
}

.dv-mast {
	display: block;
	height: 7px;
	width: 70%;
	margin: 0 auto 2px;
	background: var(--encre);
	border-radius: 2px;
}

.dv-img {
	display: block;
	flex: 1;
	max-height: 62%;
	border-radius: 2px;
	background-color: var(--papier-2);
	background-image: radial-gradient(var(--puce) 1px, transparent 1.2px);
	background-size: 4px 4px;
}

.dv-sheet .ln {
	display: block;
	height: 4px;
	background: var(--filet);
	border-radius: 2px;
}

.dv-title {
	font-size: 19px;
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1.3;
}

.dv-lines {
	margin: 12px 0 0;
	display: flex;
	flex-direction: column;
}

.dv-lines div {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 9px 0;
	border-bottom: 1px solid var(--trait);
	font-size: 14.5px;
}

.dv-lines dt {
	color: var(--encre-2);
}

.dv-lines dd {
	margin: 0;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.dv-total {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	margin-top: 12px;
}

.dv-total .kick {
	color: var(--encre);
}

.dv-total .num {
	font-size: 34px;
	line-height: 1;
	color: var(--rose);
}

.dv-cta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
}

.dv-cta .mfaj-btn {
	flex: 1 1 auto;
}

.dv-note {
	margin: 12px 0 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--encre-3);
}

.dv-ko {
	margin: 14px 0 0;
	padding: 14px 16px;
	border-radius: var(--radius-m);
	background: var(--orange-pale);
	color: var(--encre);
	font-size: 14.5px;
	line-height: 1.5;
}

/* Puces de couleur des formats */
.dv-row[data-format="mag"],
.dv[data-format="mag"] .dv-sheet { --puce: var(--orange); }
.dv-row[data-format="eco"],
.dv[data-format="eco"] .dv-sheet { --puce: var(--pistache); }
.dv-row[data-format="tab"],
.dv[data-format="tab"] .dv-sheet { --puce: var(--rose); }
.dv-row[data-format="brd"],
.dv[data-format="brd"] .dv-sheet { --puce: var(--citron); }

/* Proportions de l'aperçu */
.dv[data-format="mag"] .dv-sheet,
.dv[data-format="eco"] .dv-sheet { --l: 74px; --h: 105px; }
.dv[data-format="tab"] .dv-sheet { --l: 96px; --h: 139px; }
.dv[data-format="brd"] .dv-sheet { --l: 106px; --h: 160px; }

@media (max-width: 1180px) {
	.dv {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	}

	.dv-sum {
		grid-column: 1 / -1;
	}

	.dv-prev {
		display: none;
	}
}

@media (max-width: 760px) {
	.dv {
		grid-template-columns: minmax(0, 1fr);
	}

	.dv-fmts {
		padding: 12px 0 0;
	}

	.dv-row {
		min-height: 70px;
		padding: 12px;
	}

	.dv-ht .num {
		font-size: 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dv-sheet {
		transition: none;
	}
}
