/* Certif-ID Wizard — styles isolés (préfixe .ciw- pour éviter tout conflit avec le thème) */

/* Garantit que l'attribut [hidden] est toujours respecté, même sur un
   élément dont on force par ailleurs display:flex/grid (ex: .ciw-customer-form
   label, .ciw-analysis-report) — sans ça, ce display explicite gagne sur
   la règle par défaut du navigateur pour [hidden], et l'élément reste
   visible à l'écran malgré l'attribut. Placé en tout premier pour que
   rien plus bas dans ce fichier ne puisse la surclasser. */
[hidden] {
	display: none !important;
}

.ciw-wizard {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.ciw-wizard.is-open {
	display: block;
}
body.ciw-no-scroll {
	overflow: hidden;
}

.ciw-wizard__overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
	animation: ciw-fade-in 0.2s ease-out;
}

.ciw-wizard__panel {
	position: relative;
	max-width: 720px;
	width: 92%;
	max-height: 90vh;
	margin: 5vh auto;
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: ciw-slide-up 0.25s ease-out;
}

.ciw-wizard__close {
	position: absolute;
	top: 14px;
	right: 18px;
	background: none;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #64748b;
	z-index: 2;
}
.ciw-wizard__close:hover {
	color: #1e293b;
}

.ciw-wizard__progress {
	padding: 24px 28px 12px;
}
.ciw-wizard__progress-bar {
	height: 6px;
	background: #e2e8f0;
	border-radius: 999px;
	overflow: hidden;
}
.ciw-wizard__progress-bar span {
	display: block;
	height: 100%;
	width: 0%;
	background: #3f5366;
	border-radius: 999px;
	transition: width 0.3s ease;
}
.ciw-wizard__progress-labels {
	display: flex;
	justify-content: space-between;
	list-style: none;
	margin: 10px 0 0;
	padding: 0;
	font-size: 11px;
	color: #94a3b8;
}
.ciw-wizard__progress-labels li.is-active {
	color: #3f5366;
	font-weight: 600;
}

.ciw-wizard__body {
	padding: 10px 28px 20px;
	overflow-y: auto;
	flex: 1;
}

.ciw-step h2 {
	font-size: 22px;
	color: #1e293b;
	margin-bottom: 20px;
}

.ciw-procedure-grid,
.ciw-photo-choices,
.ciw-yesno {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}

.ciw-choice-btn {
	padding: 16px;
	border: 2px solid #e2e8f0;
	border-radius: 12px;
	background: #fff;
	cursor: pointer;
	font-size: 14px;
	color: #334155;
	text-align: center;
	transition: border-color 0.15s ease, background 0.15s ease;
}
.ciw-choice-btn:hover {
	border-color: #94a3b8;
}
.ciw-choice-btn.is-selected {
	border-color: #3f5366;
	background: #f1f5f9;
	font-weight: 600;
}

.ciw-upload-progress {
	margin-top: 18px;
}
.ciw-upload-progress__label {
	font-size: 12px;
	color: #64748b;
	margin: 0 0 6px;
	text-align: center;
}
.ciw-upload-progress__bar {
	height: 6px;
	background: #e2e8f0;
	border-radius: 999px;
	overflow: hidden;
}
.ciw-upload-progress__bar span {
	display: block;
	height: 100%;
	width: 40%;
	background: #3f5366;
	animation: ciw-indeterminate 1s infinite linear;
}

.ciw-photo-preview {
	margin-top: 20px;
	text-align: center;
}
.ciw-photo-preview img {
	max-width: 220px;
	border-radius: 12px;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}
.ciw-photo-size-info {
	margin: 10px 0 0;
	font-size: 12px;
	color: #16a34a;
	font-weight: 600;
}
.ciw-link-btn {
	display: block;
	margin: 10px auto 0;
	background: none;
	border: none;
	color: #3f5366;
	text-decoration: underline;
	cursor: pointer;
	font-size: 13px;
}

.ciw-signature-block {
	margin-top: 20px;
}
.ciw-signature-tabs {
	display: flex;
	gap: 8px;
	margin-bottom: 12px;
}
.ciw-signature-tabs button {
	flex: 1;
	padding: 10px;
	border: 1px solid #e2e8f0;
	background: #f8fafc;
	border-radius: 8px;
	cursor: pointer;
	font-size: 13px;
}
.ciw-signature-tabs button.is-active {
	background: #3f5366;
	color: #fff;
	border-color: #3f5366;
}

#ciw-signature-canvas {
	width: 100%;
	max-width: 600px;
	height: 220px;
	border: 2px dashed #cbd5e1;
	border-radius: 12px;
	touch-action: none;
	background: #fff;
}
.ciw-signature-actions {
	display: flex;
	gap: 10px;
	margin-top: 10px;
}
.ciw-signature-actions button {
	padding: 8px 16px;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
	font-size: 13px;
}

.ciw-signature-import-preview {
	margin-top: 16px;
	text-align: center;
}
.ciw-signature-import-preview img {
	max-width: 300px;
	max-height: 150px;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 10px;
}

.ciw-analysis-loader {
	text-align: center;
	padding: 40px 0;
}
.ciw-spinner {
	width: 42px;
	height: 42px;
	margin: 0 auto 16px;
	border: 4px solid #e2e8f0;
	border-top-color: #3f5366;
	border-radius: 50%;
	animation: ciw-spin 0.8s linear infinite;
}
.ciw-analysis-report {
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
}
.ciw-analysis-item {
	padding: 8px 12px;
	border-radius: 8px;
	font-size: 13px;
}
.ciw-analysis-item--ok {
	background: #e6f4ea;
	color: #16a34a;
}
.ciw-analysis-item--warning {
	background: #fef3c7;
	color: #b45309;
}

.ciw-analysis-layout {
	display: flex;
	gap: 32px;
	align-items: flex-start;
	flex-wrap: wrap;
}
.ciw-analysis-main {
	flex: 1;
	min-width: 220px;
}
.ciw-analysis-preview {
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 172px;
}
.ciw-preview-label {
	font-size: 12px;
	color: #64748b;
	margin: 0 0 10px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.ciw-analysis-photo-card {
	width: 172px;
}
.ciw-analysis-photo-svg {
	width: 100%;
	height: auto;
	display: block;
}
.ciw-preview-note {
	max-width: 220px;
	margin: 10px 0 0;
	font-size: 11px;
	color: #94a3b8;
	line-height: 1.5;
	text-align: center;
}

.ciw-customer-type {
	margin-bottom: 20px;
}
.ciw-customer-type .ciw-yesno {
	max-width: 320px;
}
.ciw-customer-form {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}
.ciw-customer-form label {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 13px;
	color: #475569;
}
.ciw-customer-form label[hidden] {
	/* `display: flex` ci-dessus a plus de priorité que l'attribut [hidden]
	   du navigateur (règle par défaut, faible priorité) — sans cette
	   ligne, un label "caché" restait quand même visible à l'écran. */
	display: none !important;
}
.ciw-customer-form input {
	padding: 10px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	font-size: 14px;
}
.ciw-customer-form .ciw-field--full {
	grid-column: 1 / -1;
}

.ciw-summary {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px 16px;
}
.ciw-summary dt {
	color: #64748b;
	font-size: 13px;
}
.ciw-summary dd {
	margin: 0;
	color: #1e293b;
	font-weight: 600;
	font-size: 14px;
}
.ciw-print-option {
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px solid #e2e8f0;
}
.ciw-print-option p {
	margin-bottom: 10px;
	font-size: 14px;
}
.ciw-print-option .ciw-yesno {
	max-width: 280px;
}
.ciw-order-note {
	margin-top: 20px;
}
.ciw-order-note label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #334155;
	margin-bottom: 6px;
}
.ciw-order-note textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	font-size: 14px;
	font-family: inherit;
	resize: vertical;
}
.ciw-order-note textarea.is-invalid {
	border-color: #dc2626;
}
.ciw-order-note-hint {
	margin: 6px 0 0;
	font-size: 12px;
	color: #b45309;
}
.ciw-info-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	margin-left: 6px;
	border-radius: 50%;
	border: 1px solid #94a3b8;
	background: #fff;
	color: #64748b;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	vertical-align: middle;
	padding: 0;
}
.ciw-info-btn:hover {
	border-color: #3f5366;
	color: #3f5366;
}
.ciw-info-text {
	margin: 4px 0 10px;
	font-size: 12px;
	color: #64748b;
	background: #f8fafc;
	border-radius: 8px;
	padding: 8px 12px;
}
.ciw-trust-bar {
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px solid #e2e8f0;
	text-align: center;
}
.ciw-trust-stars {
	margin: 0 0 6px;
	font-size: 14px;
	color: #1e293b;
}
.ciw-trust-stars span {
	color: #64748b;
	margin-left: 4px;
}
.ciw-trust-badges {
	margin: 0;
	font-size: 13px;
	color: #16a34a;
}

.ciw-wizard__footer {
	display: flex;
	justify-content: space-between;
	padding: 16px 28px;
	border-top: 1px solid #e2e8f0;
}
.ciw-btn {
	padding: 12px 26px;
	border-radius: 10px;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	border: none;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.ciw-btn:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}
.ciw-btn-spinner {
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: ciw-spin 0.7s linear infinite;
	flex-shrink: 0;
}
.ciw-btn--primary {
	background: #3f5366;
	color: #fff;
	margin-left: auto;
}
.ciw-btn--primary:hover {
	background: #2f3f4f;
}
.ciw-btn--ghost {
	background: none;
	border: 1px solid #cbd5e1;
	color: #475569;
}

@keyframes ciw-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}
@keyframes ciw-slide-up {
	from { opacity: 0; transform: translateY(20px); }
	to { opacity: 1; transform: translateY(0); }
}
@keyframes ciw-spin {
	to { transform: rotate(360deg); }
}
@keyframes ciw-indeterminate {
	0% { margin-left: -40%; }
	100% { margin-left: 100%; }
}

/* MOBILE */
@media (max-width: 600px) {
	.ciw-wizard__panel {
		width: 100%;
		max-height: 100vh;
		height: 100vh;
		/* 100vh ne suit pas la vraie zone visible sur Safari iOS (barre
		   d'adresse/barre du bas dynamiques) — 100dvh corrige ça. Les
		   navigateurs qui ne connaissent pas dvh ignorent simplement cette
		   ligne et gardent la valeur 100vh au-dessus. */
		height: 100dvh;
		max-height: 100dvh;
		margin: 0;
		border-radius: 0;
	}
	.ciw-wizard__footer {
		/* Évite que le bouton se retrouve sous l'encoche/barre du bas iOS. */
		padding-bottom: calc(16px + env(safe-area-inset-bottom));
	}
	.ciw-procedure-grid,
	.ciw-photo-choices,
	.ciw-yesno,
	.ciw-customer-form,
	.ciw-summary,
	.ciw-analysis-report {
		grid-template-columns: 1fr;
	}
	.ciw-wizard__progress-labels {
		display: none;
	}
	.ciw-analysis-layout {
		flex-direction: column;
		align-items: center;
	}
}
