/* Thermomètre des pertes d'argent — styles publics
   Charte Habib : bleu #378ADD · orange #EF9F27 · rouge #E24B4A
   Approche : diagnostic premium + override des règles du thème WP. */

/* ---------- Override défensif du thème (Breakdance & cie) ---------- */
.tpa-wrap, .tpa-wrap *, .tpa-wrap *::before, .tpa-wrap *::after {
	text-transform: none !important;
	letter-spacing: normal !important;
	box-sizing: border-box;
}

/* ---------- Wrap : ambiance diagnostic ---------- */
.tpa-wrap {
	--tpa-blue: #378ADD;
	--tpa-orange: #EF9F27;
	--tpa-red: #E24B4A;
	--tpa-ink: #0f172a;
	--tpa-muted: #64748b;
	--tpa-soft: #f8fafc;
	--tpa-border: #e6e8ec;
	--tpa-bg-card: #ffffff;
	--tpa-radius: 14px;
	--tpa-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
	--tpa-shadow-md: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 24px -16px rgba(15, 23, 42, .12);
	--tpa-shadow-lg: 0 4px 8px rgba(15, 23, 42, .05), 0 24px 48px -24px rgba(226, 75, 74, .25);

	max-width: 740px;
	margin: 0 auto;
	padding: 28px 18px 32px;
	font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--tpa-ink);
	font-size: 15px;
	line-height: 1.55;
	background:
		radial-gradient(circle at 0% 0%, rgba(55, 138, 221, .06) 0%, transparent 38%),
		radial-gradient(circle at 100% 100%, rgba(226, 75, 74, .07) 0%, transparent 40%);
	border-radius: 20px;
}

/* ---------- Anti-spam (honeypot) ---------- */
.tpa-hp { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Barre de progression du formulaire ---------- */
.tpa-progress { margin: 0 0 22px; }
.tpa-progress__track {
	height: 8px;
	background: #eef0f3;
	border-radius: 999px;
	overflow: hidden;
	box-shadow: inset 0 1px 2px rgba(15, 23, 42, .05);
}
.tpa-progress__bar {
	height: 100%;
	width: 0%;
	background: var(--tpa-blue);
	border-radius: 999px;
	transition: width .45s cubic-bezier(.22, 1, .36, 1), background-color .35s ease-out, box-shadow .35s ease-out;
}
.tpa-progress__bar.is-mid  { background: var(--tpa-orange); }
.tpa-progress__bar.is-near {
	background: var(--tpa-red);
	animation: tpa-glow 2s ease-in-out infinite;
}
@keyframes tpa-glow {
	0%, 100% { box-shadow: 0 0 0 0 rgba(226, 75, 74, .55); }
	50%      { box-shadow: 0 0 16px 2px rgba(226, 75, 74, .55); }
}
.tpa-progress__label {
	display: flex;
	justify-content: space-between;
	font-size: 12px;
	color: var(--tpa-muted);
	margin-top: 8px;
	font-variant-numeric: tabular-nums;
}

/* ---------- Résumé d'erreurs ---------- */
.tpa-error-summary {
	background: #fdecec;
	border: 1px solid rgba(226, 75, 74, .35);
	border-radius: 12px;
	padding: 14px 16px;
	margin: 0 0 16px;
	color: #8b1f1f;
	font-size: 14px;
	box-shadow: 0 8px 24px -16px rgba(226, 75, 74, .45);
}
.tpa-error-summary[hidden] { display: none; }
.tpa-error-summary__title { font-weight: 600; margin: 0 0 6px; }
.tpa-error-summary ul { margin: 0; padding-left: 20px; }
.tpa-error-summary a { color: #8b1f1f; text-decoration: underline; }

/* ---------- Signal de confiance RGPD ---------- */
.tpa-trust {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--tpa-muted);
	margin: 12px 0 0;
}
.tpa-trust svg { flex-shrink: 0; color: var(--tpa-muted); }

/* ---------- En-tête ---------- */
.tpa-header { text-align: center; margin-bottom: 24px; }
.tpa-dots { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; }
.tpa-dot {
	width: 14px; height: 14px;
	border-radius: 50%;
	display: inline-block;
	vertical-align: middle;
	box-shadow: 0 4px 12px -4px currentColor;
}
.tpa-dot--blue   { background: var(--tpa-blue);   color: var(--tpa-blue); }
.tpa-dot--orange { background: var(--tpa-orange); color: var(--tpa-orange); }
.tpa-dot--red    { background: var(--tpa-red);    color: var(--tpa-red); }
.tpa-title {
	font-size: 30px;
	font-weight: 700;
	margin: 0 0 10px;
	color: var(--tpa-ink);
	line-height: 1.15;
}
.tpa-subtitle {
	font-size: 15px;
	color: var(--tpa-muted);
	margin: 0;
	max-width: 540px;
	margin-inline: auto;
	line-height: 1.55;
}

/* ---------- Wizard : une étape à la fois ---------- */
.tpa-steps { position: relative; }
.tpa-step { display: none; }
.tpa-step.is-active {
	display: block;
	animation: tpa-step-in .42s cubic-bezier(.22, 1, .36, 1);
}
.tpa-step.is-active--reverse {
	animation: tpa-step-in-reverse .42s cubic-bezier(.22, 1, .36, 1);
}
@keyframes tpa-step-in {
	from { opacity: 0; transform: translateX(28px); }
	to   { opacity: 1; transform: none; }
}
@keyframes tpa-step-in-reverse {
	from { opacity: 0; transform: translateX(-28px); }
	to   { opacity: 1; transform: none; }
}

/* Navigation wizard (prev / compteur / next) */
.tpa-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-top: 18px;
	padding: 16px 18px;
	background: #fff;
	border: 1px solid var(--tpa-border);
	border-radius: 14px;
	box-shadow: var(--tpa-shadow-md);
}
.tpa-nav[hidden] { display: none; }
.tpa-step-counter {
	font-size: 13px;
	color: var(--tpa-muted);
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	text-align: center;
}
.tpa-btn-nav {
	font-family: inherit;
	font-size: 14.5px;
	font-weight: 600;
	color: var(--tpa-ink);
	background: var(--tpa-soft);
	border: 1.5px solid var(--tpa-border);
	border-radius: 10px;
	padding: 11px 18px;
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .25s ease;
}
.tpa-btn-nav:hover {
	background: #fff;
	border-color: var(--tpa-blue);
	color: var(--tpa-blue);
}
.tpa-btn-nav:active { transform: scale(.98); }
.tpa-btn-nav:focus-visible {
	outline: none;
	border-color: var(--tpa-blue);
	box-shadow: 0 0 0 4px rgba(55, 138, 221, .18);
}
.tpa-btn-prev[hidden] { visibility: hidden; display: inline-flex !important; pointer-events: none; }
.tpa-btn-next {
	background: var(--tpa-blue);
	border-color: var(--tpa-blue);
	color: #fff;
	box-shadow: 0 8px 22px -10px rgba(55, 138, 221, .55);
}
.tpa-btn-next:hover {
	background: #2c79c8;
	border-color: #2c79c8;
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 12px 28px -10px rgba(55, 138, 221, .65);
}
.tpa-btn-next[hidden] { display: none !important; }

/* L'étape 6 contient le bouton submit — pas besoin du Next. Le submit fait le travail. */

/* ---------- Cartes (sections) ---------- */
.tpa-card {
	background: var(--tpa-bg-card);
	border: 1px solid var(--tpa-border);
	border-radius: var(--tpa-radius);
	padding: 26px 26px 16px;
	margin: 0;
	box-shadow: var(--tpa-shadow-md);
	transition: border-color .25s ease, box-shadow .25s ease;
}
.tpa-card:focus-within {
	border-color: var(--tpa-blue);
	box-shadow: 0 1px 2px rgba(55, 138, 221, .12), 0 16px 36px -20px rgba(55, 138, 221, .35);
}

.tpa-card__title {
	font-size: 17px;
	font-weight: 600;
	padding: 0 4px;
	color: var(--tpa-ink);
}
.tpa-prompt { font-size: 15px; color: var(--tpa-ink); margin: 4px 4px 14px; }

/* ---------- Champs ---------- */
.tpa-grid { display: grid; gap: 16px; }
.tpa-grid--2 { grid-template-columns: 1fr 1fr; }
.tpa-grid--3 { grid-template-columns: repeat(3, 1fr); }
.tpa-field { display: flex; flex-direction: column; margin-bottom: 14px; }
.tpa-grid .tpa-field { margin-bottom: 0; }
.tpa-label {
	font-size: 13px;
	color: var(--tpa-muted);
	margin-bottom: 7px;
	font-weight: 500;
}
.tpa-req { color: var(--tpa-red); }

.tpa-input {
	width: 100%;
	font-family: inherit;
	font-size: 15px;
	color: var(--tpa-ink);
	padding: 12px 14px;
	border: 1.5px solid var(--tpa-border);
	border-radius: 10px;
	background: var(--tpa-soft);
	transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
	appearance: none;
	font-variant-numeric: tabular-nums;
}
.tpa-input:hover  { background: #fff; border-color: #d4d7dd; }
.tpa-input:focus  {
	outline: none;
	background: #fff;
	border-color: var(--tpa-blue);
	box-shadow: 0 0 0 4px rgba(55, 138, 221, .14);
}
select.tpa-input {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 38px;
}
.tpa-input.tpa-input--error {
	border-color: var(--tpa-red);
	background: #fff8f8;
	box-shadow: 0 0 0 3px rgba(226, 75, 74, .14);
}
.tpa-error { color: var(--tpa-red); font-size: 12.5px; margin-top: 6px; min-height: 0; display: none; font-weight: 500; }
.tpa-error.is-visible { display: block; }

/* ---------- Consentement RGPD ---------- */
.tpa-consent { margin: 4px 4px 20px; }
.tpa-consent__label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 13.5px;
	color: var(--tpa-muted);
	cursor: pointer;
	min-height: 44px;
	padding: 4px 0;
}
.tpa-consent__label input {
	margin-top: 3px; flex: 0 0 auto;
	width: 18px; height: 18px;
	accent-color: var(--tpa-blue);
}
.tpa-consent__label input:focus-visible { outline: 2px solid var(--tpa-blue); outline-offset: 2px; }
.tpa-legal-links { font-size: 12.5px; margin: 8px 0 0 28px; }
.tpa-legal-links a { color: var(--tpa-blue); padding: 4px 2px; }

/* ---------- Bouton submit ---------- */
.tpa-actions { text-align: center; margin: 12px 0 6px; }
.tpa-submit {
	font-family: inherit;
	font-size: 17px;
	font-weight: 600;
	color: #fff;
	background: linear-gradient(180deg, #ec5957 0%, var(--tpa-red) 100%);
	border: none;
	border-radius: 12px;
	padding: 16px 36px;
	cursor: pointer;
	min-width: 260px;
	box-shadow: 0 8px 24px -8px rgba(226, 75, 74, .55), inset 0 1px 0 rgba(255, 255, 255, .15);
	transition: transform .15s ease, box-shadow .25s ease, opacity .15s ease;
}
.tpa-submit:hover {
	transform: translateY(-1px);
	box-shadow: 0 14px 32px -8px rgba(226, 75, 74, .65), inset 0 1px 0 rgba(255, 255, 255, .15);
}
.tpa-submit:active { transform: translateY(0) scale(.99); }
.tpa-submit:focus-visible {
	outline: none;
	box-shadow: 0 0 0 4px rgba(226, 75, 74, .35), 0 8px 24px -8px rgba(226, 75, 74, .55);
}
.tpa-submit[disabled] { opacity: .6; cursor: progress; transform: none; }
.tpa-form-error { display: block; color: var(--tpa-red); font-size: 13px; margin-top: 10px; font-weight: 500; }

/* Spinner inline du bouton */
.tpa-submit__spinner {
	display: inline-block;
	width: 14px; height: 14px;
	margin-right: 8px;
	border: 2px solid rgba(255, 255, 255, .35);
	border-top-color: #fff;
	border-radius: 50%;
	vertical-align: -2px;
	animation: tpa-spin .8s linear infinite;
}
@keyframes tpa-spin { to { transform: rotate(360deg); } }

/* ---------- Panneau résultat — DRAMA ---------- */
.tpa-result {
	margin-top: 32px;
	border: 1px solid #ececec;
	border-radius: 18px;
	padding: 32px 28px 28px;
	background:
		radial-gradient(circle at 50% 0%, rgba(55, 138, 221, .08) 0%, transparent 45%),
		radial-gradient(circle at 50% 100%, rgba(226, 75, 74, .10) 0%, transparent 50%),
		#ffffff;
	box-shadow: var(--tpa-shadow-lg);
	position: relative;
	overflow: hidden;
	animation: tpa-fade .45s cubic-bezier(.22, 1, .36, 1);
}
@keyframes tpa-fade {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: none; }
}
.tpa-result__head {
	font-size: 24px;
	font-weight: 700;
	margin: 0 0 22px;
	text-align: center;
	color: var(--tpa-ink);
	letter-spacing: -.01em !important;
}
.tpa-result__body {
	display: flex;
	gap: 28px;
	align-items: stretch;
}

/* Thermomètre — bloc gauche, agrandi */
.tpa-thermo { flex: 0 0 200px; display: flex; flex-direction: column; align-items: center; }
.tpa-svg { width: 200px; height: 320px; display: block; }

/* Métriques — bloc droit, drame chirurgical sur les chiffres */
.tpa-metrics { flex: 1 1 auto; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.tpa-metric { border-radius: 14px; padding: 18px 20px; border: 1px solid transparent; }
.tpa-metric__label {
	font-size: 12.5px;
	color: var(--tpa-muted);
	margin: 0 0 6px;
	font-weight: 500;
	text-transform: uppercase !important;
	letter-spacing: .04em !important;
}
.tpa-metric__value {
	font-weight: 700;
	margin: 0;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
	letter-spacing: -.02em !important;
}
.tpa-metric--avg {
	background: linear-gradient(180deg, rgba(239, 159, 39, .18) 0%, rgba(239, 159, 39, .10) 100%);
	border-color: rgba(239, 159, 39, .25);
}
.tpa-metric--avg .tpa-metric__value { font-size: 36px; color: #b9740b; }
.tpa-metric--range {
	background: #f6f7f9;
	border-color: #ececec;
}
.tpa-metric--range .tpa-metric__value { font-size: 18px; color: var(--tpa-ink); font-weight: 600; }
.tpa-metric--annual {
	background: linear-gradient(180deg, rgba(226, 75, 74, .18) 0%, rgba(226, 75, 74, .10) 100%);
	border-color: rgba(226, 75, 74, .28);
}
.tpa-metric--annual .tpa-metric__value { font-size: 42px; color: #c4302e; }

/* CTA (bloc bas du panneau) */
.tpa-cta {
	margin-top: 26px;
	padding-top: 22px;
	border-top: 1px solid #ececec;
	text-align: center;
}
.tpa-cta__msg { font-size: 17px; font-weight: 500; margin: 0 0 18px; color: var(--tpa-ink); }
.tpa-cta__btn {
	display: inline-block;
	font-weight: 600;
	color: #fff;
	text-decoration: none;
	padding: 16px 30px;
	border-radius: 12px;
	font-size: 16px;
	box-shadow: 0 10px 28px -10px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .15);
	transition: transform .15s ease, box-shadow .25s ease, opacity .15s ease;
}
.tpa-cta__btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 14px 36px -10px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .15);
	color: #fff;
}
.tpa-cta__btn:active { transform: translateY(0); }
.tpa-cta__btn:focus-visible {
	outline: none;
	box-shadow: 0 0 0 4px rgba(0, 0, 0, .18), 0 10px 28px -10px rgba(0, 0, 0, .35);
}

/* ---------- Définitions des zones (légende bas de page) ---------- */
.tpa-zones {
	margin-top: 26px;
	padding: 18px 20px;
	font-size: 13px;
	color: var(--tpa-muted);
	background: #fafbfc;
	border: 1px solid #ececec;
	border-radius: 14px;
}
.tpa-zones p { margin: 8px 0; display: flex; align-items: center; gap: 10px; }
.tpa-zones strong { color: var(--tpa-ink); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
	.tpa-wrap { padding: 18px 12px; border-radius: 0; }
	.tpa-grid--2, .tpa-grid--3 { grid-template-columns: 1fr; }
	.tpa-title { font-size: 24px; }
	.tpa-result { padding: 22px 18px; }
	.tpa-result__body { flex-direction: column; align-items: center; gap: 18px; }
	.tpa-thermo { flex-basis: auto; }
	.tpa-svg { width: 168px; height: 268px; }
	.tpa-metrics { width: 100%; }
	.tpa-metric--avg .tpa-metric__value { font-size: 30px; }
	.tpa-metric--annual .tpa-metric__value { font-size: 34px; }
	.tpa-submit { width: 100%; min-width: 0; }
	.tpa-nav { padding: 12px 14px; gap: 10px; flex-wrap: wrap; }
	.tpa-btn-nav { padding: 10px 14px; font-size: 14px; flex: 1 1 0; min-width: 0; }
	.tpa-step-counter { order: -1; flex-basis: 100%; text-align: center; padding-bottom: 4px; }
}

/* ---------- Mouvement réduit (a11y) ---------- */
@media (prefers-reduced-motion: reduce) {
	.tpa-progress__bar,
	.tpa-input,
	.tpa-submit,
	.tpa-cta__btn,
	.tpa-btn-nav,
	.tpa-card { transition: none; }
	.tpa-result,
	.tpa-card,
	.tpa-step.is-active,
	.tpa-step.is-active--reverse { animation: none; }
	.tpa-progress__bar.is-near { animation: none; }
	.tpa-submit__spinner { animation-duration: 1.6s; }
}
