/* =========================================================
   Aquatiqa – Devis Osmose Inverse
   Formulaire 3 étapes. Toutes les couleurs pilotées par
   variables CSS (injectées depuis les réglages).
   ========================================================= */

.adg-wrap {
	--adg-primary: #0a4d68;
	--adg-accent: #05bfdb;
	--adg-dark: #0b2d3a;
	--adg-radius: 14px;

	--adg-ink: #12333f;
	--adg-muted: #6a7f88;
	--adg-line: #dbe7ec;
	--adg-soft: #f2f8fb;
	--adg-white: #ffffff;
	--adg-danger: #d64545;
	--adg-shadow: 0 18px 50px -22px rgba(10, 77, 104, 0.45);

	box-sizing: border-box;
	max-width: 780px;
	margin: 0 auto;
	color: var(--adg-ink);
	font-family: inherit;
}
.adg-wrap *,
.adg-wrap *::before,
.adg-wrap *::after { box-sizing: border-box; }

/* ---------- Carte ---------- */
.adg-card {
	position: relative;
	background: var(--adg-white);
	border: 1px solid var(--adg-line);
	border-radius: calc(var(--adg-radius) + 6px);
	box-shadow: var(--adg-shadow);
	overflow: hidden;
}

/* ---------- En-tête ---------- */
.adg-head {
	position: relative;
	padding: 34px 34px 22px;
	background:
		radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--adg-accent) 22%, transparent) 0%, transparent 55%),
		linear-gradient(135deg, var(--adg-primary), var(--adg-dark));
	color: #fff;
}
.adg-title {
	margin: 0 0 6px;
	font-size: 1.55rem;
	line-height: 1.2;
	font-weight: 700;
	color: #fff;
}
.adg-sub {
	margin: 0 0 22px;
	font-size: 0.95rem;
	opacity: 0.85;
	color: #eaf6fa;
}

/* ---------- Progression ---------- */
.adg-steps {
	display: flex;
	list-style: none;
	margin: 0;
	padding: 0;
	gap: 6px;
}
.adg-steps li {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 0.82rem;
	color: rgba(255, 255, 255, 0.6);
	position: relative;
}
.adg-steps li span {
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	border: 1.5px solid rgba(255, 255, 255, 0.25);
	font-weight: 700;
	font-size: 0.85rem;
	flex: 0 0 auto;
	transition: all 0.25s ease;
}
.adg-steps li em { font-style: normal; white-space: nowrap; }
.adg-steps li.is-active { color: #fff; }
.adg-steps li.is-active span {
	background: var(--adg-accent);
	border-color: var(--adg-accent);
	color: var(--adg-dark);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--adg-accent) 30%, transparent);
}
.adg-steps li.is-done span {
	background: rgba(255, 255, 255, 0.9);
	border-color: rgba(255, 255, 255, 0.9);
	color: var(--adg-primary);
}
@media (max-width: 560px) {
	.adg-steps li em { display: none; }
	.adg-steps li { flex: 0 0 auto; }
	.adg-steps { justify-content: center; gap: 14px; }
}

/* ---------- Panneaux ---------- */
.adg-form { padding: 30px 34px 34px; }
.adg-hp {
	position: absolute !important;
	left: -9999px !important;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
.adg-panel { display: none; animation: adg-fade 0.35s ease; }
.adg-panel.is-active { display: block; }
@keyframes adg-fade {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ---------- Grille de champs ---------- */
.adg-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 18px 20px;
}
.adg-col-2 { grid-column: 1 / -1; }
@media (max-width: 560px) {
	.adg-grid { grid-template-columns: 1fr; }
	.adg-col-2 { grid-column: auto; }
	.adg-head, .adg-form { padding-left: 20px; padding-right: 20px; }
}

.adg-field { display: flex; flex-direction: column; }
.adg-field label {
	font-size: 0.85rem;
	font-weight: 600;
	margin-bottom: 7px;
	color: var(--adg-dark);
}
.adg-req { color: var(--adg-accent); }

.adg-field input,
.adg-field select {
	width: 100%;
	padding: 12px 14px;
	font-size: 0.95rem;
	font-family: inherit;
	color: var(--adg-ink);
	background: var(--adg-white);
	border: 1.5px solid var(--adg-line);
	border-radius: var(--adg-radius);
	transition: border-color 0.18s, box-shadow 0.18s;
	appearance: none;
}
.adg-field select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236a7f88' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 40px;
	cursor: pointer;
}
.adg-field input:focus,
.adg-field select:focus {
	outline: none;
	border-color: var(--adg-accent);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--adg-accent) 22%, transparent);
}
.adg-field.has-error input,
.adg-field.has-error select { border-color: var(--adg-danger); }

.adg-err {
	display: none;
	margin-top: 6px;
	font-size: 0.78rem;
	color: var(--adg-danger);
}
.adg-field.has-error .adg-err,
.adg-err.is-visible { display: block; }

/* ---------- Étape 3 : choix ---------- */
.adg-legend {
	margin: 0 0 16px;
	font-size: 0.92rem;
	color: var(--adg-muted);
}
.adg-choices {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
	margin-bottom: 22px;
}
@media (max-width: 560px) { .adg-choices { grid-template-columns: 1fr; } }

.adg-choice { cursor: pointer; }
.adg-choice input { position: absolute; opacity: 0; pointer-events: none; }
.adg-choice-box {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 18px 18px 16px;
	border: 1.5px solid var(--adg-line);
	border-radius: var(--adg-radius);
	background: var(--adg-white);
	transition: all 0.18s ease;
	height: 100%;
}
.adg-choice-box svg { color: var(--adg-muted); transition: color 0.18s; }
.adg-choice-box strong { font-size: 0.98rem; color: var(--adg-dark); }
.adg-choice-box em { font-style: normal; font-size: 0.82rem; color: var(--adg-muted); }
.adg-choice input:checked + .adg-choice-box {
	border-color: var(--adg-accent);
	background: var(--adg-soft);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--adg-accent) 16%, transparent);
}
.adg-choice input:checked + .adg-choice-box svg,
.adg-choice input:checked + .adg-choice-box strong { color: var(--adg-primary); }
.adg-choice input:focus-visible + .adg-choice-box { outline: 2px solid var(--adg-accent); outline-offset: 2px; }

/* ---------- Sous-panneaux ---------- */
.adg-sub-panel { display: none; }
.adg-sub-panel.is-active { display: block; animation: adg-fade 0.3s ease; }

/* Dropzone */
.adg-dropzone {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 38px 22px;
	text-align: center;
	border: 2px dashed var(--adg-line);
	border-radius: var(--adg-radius);
	background: var(--adg-soft);
	cursor: pointer;
	transition: border-color 0.18s, background 0.18s;
}
.adg-dropzone:hover,
.adg-dropzone.is-drag { border-color: var(--adg-accent); background: color-mix(in srgb, var(--adg-accent) 8%, var(--adg-white)); }
.adg-dropzone svg { color: var(--adg-primary); }
.adg-dropzone input[type="file"] {
	position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.adg-dz-main { margin: 4px 0 0; font-weight: 600; color: var(--adg-dark); font-size: 0.95rem; }
.adg-dz-hint { margin: 0; font-size: 0.8rem; color: var(--adg-muted); }
.adg-dz-file {
	margin: 8px 0 0; font-size: 0.88rem; font-weight: 600; color: var(--adg-primary);
	display: inline-flex; align-items: center; gap: 8px;
}

/* Tableau des ions */
.adg-table-wrap {
	border: 1.5px solid var(--adg-line);
	border-radius: var(--adg-radius);
	overflow: hidden;
}
.adg-ions { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.adg-ions thead th {
	background: linear-gradient(135deg, var(--adg-primary), var(--adg-dark));
	color: #fff;
	text-align: left;
	padding: 12px 16px;
	font-weight: 600;
	font-size: 0.82rem;
	letter-spacing: 0.02em;
}
.adg-ions th.adg-num, .adg-ions td.adg-num { text-align: right; }
.adg-ions tbody tr { border-top: 1px solid var(--adg-line); }
.adg-ions tbody tr:nth-child(even) { background: var(--adg-soft); }
.adg-ion-name { padding: 6px 16px; color: var(--adg-dark); font-weight: 500; }
.adg-ions td.adg-num { padding: 6px 12px; width: 150px; }
.adg-ions input {
	width: 100%;
	padding: 8px 10px;
	text-align: right;
	border: 1.5px solid var(--adg-line);
	border-radius: 9px;
	font-family: inherit;
	font-size: 0.9rem;
	background: var(--adg-white);
	transition: border-color 0.15s, box-shadow 0.15s;
}
.adg-ions input:focus {
	outline: none;
	border-color: var(--adg-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--adg-accent) 20%, transparent);
}
.adg-ions input.adg-cell-error {
	border-color: var(--adg-danger);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--adg-danger) 18%, transparent);
}
.adg-ions-hint {
	margin: 0 0 12px;
	font-size: 0.83rem;
	color: var(--adg-muted);
}

/* RGPD */
.adg-rgpd {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-top: 20px;
	font-size: 0.85rem;
	color: var(--adg-muted);
	cursor: pointer;
	line-height: 1.5;
}
.adg-rgpd input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--adg-accent); flex: 0 0 auto; }

/* Turnstile */
.adg-turnstile { margin-top: 20px; }

/* ---------- Actions ---------- */
.adg-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 28px;
	gap: 12px;
}
.adg-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 13px 26px;
	font-size: 0.95rem;
	font-weight: 600;
	font-family: inherit;
	border: none;
	border-radius: var(--adg-radius);
	cursor: pointer;
	transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.adg-btn:active { transform: translateY(1px); }
.adg-next, .adg-submit {
	color: #fff;
	background: linear-gradient(135deg, var(--adg-accent), var(--adg-primary));
	box-shadow: 0 12px 24px -12px color-mix(in srgb, var(--adg-primary) 80%, transparent);
}
.adg-next:hover, .adg-submit:hover { box-shadow: 0 16px 30px -12px color-mix(in srgb, var(--adg-primary) 90%, transparent); }
.adg-ghost {
	color: var(--adg-primary);
	background: var(--adg-soft);
	border: 1.5px solid var(--adg-line);
}
.adg-ghost:hover { background: color-mix(in srgb, var(--adg-accent) 10%, var(--adg-white)); }
.adg-btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.adg-btn.is-loading { position: relative; color: transparent; }
.adg-btn.is-loading::after {
	content: "";
	position: absolute;
	width: 18px; height: 18px;
	top: 50%; left: 50%;
	margin: -9px 0 0 -9px;
	border: 2.5px solid rgba(255, 255, 255, 0.5);
	border-top-color: #fff;
	border-radius: 50%;
	animation: adg-spin 0.7s linear infinite;
}
@keyframes adg-spin { to { transform: rotate(360deg); } }

/* ---------- Succès ---------- */
.adg-success {
	padding: 60px 34px;
	text-align: center;
	animation: adg-fade 0.4s ease;
}
.adg-success-icon {
	display: grid;
	place-items: center;
	width: 84px; height: 84px;
	margin: 0 auto 22px;
	border-radius: 50%;
	color: #fff;
	background: linear-gradient(135deg, var(--adg-accent), var(--adg-primary));
	box-shadow: 0 16px 34px -14px color-mix(in srgb, var(--adg-primary) 85%, transparent);
}
.adg-success h3 { margin: 0 0 10px; font-size: 1.5rem; color: var(--adg-dark); }
.adg-success-msg { margin: 0 auto; max-width: 460px; color: var(--adg-muted); font-size: 1rem; line-height: 1.6; }

/* ---------- Bandeau d'erreur global ---------- */
.adg-alert {
	margin: 0 0 18px;
	padding: 12px 16px;
	border-radius: var(--adg-radius);
	background: color-mix(in srgb, var(--adg-danger) 10%, #fff);
	border: 1px solid color-mix(in srgb, var(--adg-danger) 40%, #fff);
	color: var(--adg-danger);
	font-size: 0.88rem;
	display: none;
}
.adg-alert.is-visible { display: block; }
