/* =========================================================================
   Hygiène Office – Formulaire de devis v1.2.0
   Container queries (s'adapte au conteneur : colonne Divi, modal, sidebar)
   · modal intégrée · sticky · mobile-first · léger
   ========================================================================= */

.hod-wrap *, .hod-wrap *::before, .hod-wrap *::after { box-sizing: border-box; }

.hod-wrap {
	--hod-radius: 14px;
	--hod-radius-sm: 10px;
	--hod-shadow: 0 10px 40px rgba(0,0,0,.08);
	--hod-border: #e4e9ef;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--hod-text, #1F2A37);
	width: 100%;
	max-width: var(--hod-max-width, 100%); /* v1.4.1 : pleine largeur de la colonne */
	margin: 0 auto;
	line-height: 1.5;
	container-type: inline-size;
	container-name: hodform;
}

.hod-wrap .hod-form {
	background: var(--hod-bg, #fff);
	border: 1px solid var(--hod-border);
	border-radius: var(--hod-radius);
	box-shadow: var(--hod-shadow);
	padding: clamp(16px, 4cqw, 36px);
	position: relative;
}

/* ---- Progression ---- */
.hod-wrap .hod-progress { margin-bottom: 22px; }
.hod-wrap .hod-progress-bar { height: 6px; background: var(--hod-border); border-radius: 99px; overflow: hidden; }
.hod-wrap .hod-progress-fill {
	display: block; height: 100%;
	background: linear-gradient(90deg, var(--hod-primary), var(--hod-secondary));
	border-radius: 99px; transition: width .45s cubic-bezier(.4,0,.2,1);
}
.hod-wrap .hod-steps-label {
	display: flex; justify-content: space-between; margin-top: 10px;
	font-size: 13px; font-weight: 600; color: #9aa5b1;
}
.hod-wrap .hod-steps-label .active { color: var(--hod-primary); }

/* ---- Étapes ---- */
.hod-wrap .hod-step { display: none; }
.hod-wrap .hod-step.is-active { display: block; animation: hodFade .4s ease both; }
@keyframes hodFade { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.hod-wrap .hod-step.hod-anim-left  { animation: hodSlideL .42s cubic-bezier(.4,0,.2,1) both; }
.hod-wrap .hod-step.hod-anim-right { animation: hodSlideR .42s cubic-bezier(.4,0,.2,1) both; }
@keyframes hodSlideL { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
@keyframes hodSlideR { from { opacity: 0; transform: translateX(-36px); } to { opacity: 1; transform: none; } }

.hod-wrap .hod-title { font-size: clamp(19px, 4.2cqw, 24px); margin: 0 0 4px; font-weight: 800; }
.hod-wrap .hod-subtitle { margin: 0 0 16px; color: #6b7785; font-size: 15px; }
.hod-wrap .hod-opt { color: #9aa5b1; font-weight: 400; font-size: 13px; }

/* ---- Cartes services ---- */
.hod-wrap .hod-services { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.hod-wrap .hod-service-card {
	position: relative; display: flex; flex-direction: column; gap: 4px;
	padding: 15px 13px; cursor: pointer; min-height: 44px;
	border: 2px solid var(--hod-border); border-radius: var(--hod-radius-sm);
	background: #fff; transition: border-color .2s, transform .15s, box-shadow .2s;
}
.hod-wrap .hod-service-card:hover { border-color: var(--hod-secondary); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.07); }
.hod-wrap .hod-service-card input { position: absolute; opacity: 0; pointer-events: none; }
.hod-wrap .hod-service-card:has(input:checked) {
	border-color: var(--hod-primary);
	background: color-mix(in srgb, var(--hod-primary) 8%, #fff);
}
.hod-wrap .hod-service-card:has(input:checked)::after {
	content: "✓"; position: absolute; top: 8px; right: 10px;
	width: 22px; height: 22px; display: grid; place-items: center;
	background: var(--hod-primary); color: #fff; border-radius: 50%;
	font-size: 13px; font-weight: 700;
}
.hod-wrap .hod-service-icon { font-size: 25px; }
.hod-wrap .hod-service-body { display: flex; flex-direction: column; gap: 2px; }
.hod-wrap .hod-service-label { font-weight: 700; font-size: 15px; }
.hod-wrap .hod-service-desc { font-size: 12.5px; color: #7a8794; }
.hod-wrap .hod-service-card.hod-bounce { animation: hodBounce .45s cubic-bezier(.2,.8,.3,1.4); }
@keyframes hodBounce { 0%{transform:scale(1)} 35%{transform:scale(1.06) translateY(-3px)} 70%{transform:scale(.98)} 100%{transform:scale(1)} }
.hod-wrap .hod-service-card.hod-bounce .hod-service-icon { animation: hodIconPop .45s cubic-bezier(.2,.8,.3,1.6); }
@keyframes hodIconPop { 0%{transform:scale(1)} 40%{transform:scale(1.35) rotate(-8deg)} 100%{transform:scale(1)} }

/* ---- Chips ---- */
.hod-wrap .hod-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hod-wrap .hod-chip { cursor: pointer; }
.hod-wrap .hod-chip input { position: absolute; opacity: 0; }
.hod-wrap .hod-chip span {
	display: inline-flex; align-items: center; min-height: 40px; padding: 8px 15px;
	border-radius: 99px; border: 2px solid var(--hod-border);
	font-size: 14px; font-weight: 600; color: #5a6573;
	transition: all .18s; background: #fff;
}
.hod-wrap .hod-chip:hover span { border-color: var(--hod-secondary); }
.hod-wrap .hod-chip input:checked + span { background: var(--hod-primary); border-color: var(--hod-primary); color: #fff; }

/* ---- Champs ---- */
.hod-wrap .hod-field { margin-bottom: 15px; }
.hod-wrap .hod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hod-wrap .hod-field > label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.hod-wrap input[type="text"], .hod-wrap input[type="tel"], .hod-wrap input[type="email"], .hod-wrap textarea {
	width: 100%; padding: 12px 14px;
	font-size: 16px; /* ≥16px = pas de zoom auto iOS */
	font-family: inherit; border: 2px solid var(--hod-border);
	border-radius: var(--hod-radius-sm); background: #fff; color: var(--hod-text);
	transition: border-color .18s, box-shadow .18s;
}
.hod-wrap input:focus, .hod-wrap textarea:focus {
	outline: none; border-color: var(--hod-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--hod-primary) 18%, transparent);
}
.hod-wrap textarea { resize: vertical; min-height: 76px; }
.hod-wrap .hod-field.has-error input, .hod-wrap .hod-field.has-error textarea { border-color: #e23b3b; }
.hod-wrap .hod-error { display: none; color: #e23b3b; font-size: 13px; margin-top: 5px; }
.hod-wrap .hod-field.has-error .hod-error, .hod-wrap .hod-error.show { display: block; }

/* ---- Conditionnels ---- */
.hod-wrap .hod-conditional:not(:empty) { margin-bottom: 15px; }
.hod-wrap .hod-cond-anim { animation: hodFade .4s ease both; }

/* ---- Collapse (mode express) ---- */
.hod-wrap .hod-collapse {
	border: 1px dashed var(--hod-border); border-radius: var(--hod-radius-sm);
	padding: 0 14px; margin-bottom: 16px; background: #fafbfc;
}
.hod-wrap .hod-collapse summary {
	cursor: pointer; padding: 12px 0; font-weight: 600; font-size: 14.5px;
	color: var(--hod-secondary); list-style: none; min-height: 44px; display: flex; align-items: center;
}
.hod-wrap .hod-collapse summary::-webkit-details-marker { display: none; }
.hod-wrap .hod-collapse[open] summary { border-bottom: 1px dashed var(--hod-border); margin-bottom: 12px; }
.hod-wrap .hod-collapse-inner { padding-bottom: 8px; animation: hodFade .35s ease both; }

/* ---- RGPD / honeypot ---- */
.hod-wrap .hod-rgpd { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: #5a6573; margin: 6px 0 4px; cursor: pointer; }
.hod-wrap .hod-rgpd input { margin-top: 3px; width: 18px; height: 18px; flex: 0 0 auto; }
.hod-wrap .hod-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Boutons ---- */
.hod-wrap .hod-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.hod-wrap .hod-btn {
	appearance: none; border: none; cursor: pointer; font-family: inherit;
	font-size: 16px; font-weight: 700; padding: 14px 26px; min-height: 48px;
	border-radius: var(--hod-radius-sm); transition: transform .15s, box-shadow .2s, filter .2s;
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.hod-wrap .hod-next, .hod-wrap .hod-submit, .hod-wrap .hod-cta {
	background: var(--hod-accent); color: #fff; margin-left: auto;
	box-shadow: 0 6px 16px color-mix(in srgb, var(--hod-accent) 35%, transparent);
}
.hod-wrap .hod-cta { margin-left: 0; }
.hod-wrap .hod-next:hover, .hod-wrap .hod-submit:hover, .hod-wrap .hod-cta:hover { transform: translateY(-2px); filter: brightness(1.05); }
.hod-wrap .hod-ghost { background: transparent; color: #6b7785; border: 2px solid var(--hod-border); }
.hod-wrap .hod-ghost:hover { border-color: var(--hod-secondary); color: var(--hod-secondary); }
.hod-wrap .hod-btn:disabled { opacity: .65; cursor: not-allowed; }
.hod-wrap .hod-spinner {
	width: 17px; height: 17px; border: 2.5px solid rgba(255,255,255,.4);
	border-top-color: #fff; border-radius: 50%; display: none; animation: hodSpin .7s linear infinite;
}
.hod-wrap .hod-submit.loading .hod-spinner { display: inline-block; }
@keyframes hodSpin { to { transform: rotate(360deg); } }

/* ---- Succès ---- */
.hod-wrap .hod-success-screen { text-align: center; padding: 20px 0; }
.hod-wrap .hod-check {
	width: 70px; height: 70px; margin: 0 auto 14px; border-radius: 50%;
	background: var(--hod-primary); color: #fff; font-size: 36px; font-weight: 700;
	display: grid; place-items: center; animation: hodPop .5s cubic-bezier(.2,.8,.3,1.4) both;
}
@keyframes hodPop { from { transform: scale(0); } to { transform: scale(1); } }
.hod-wrap .hod-success-text { color: #5a6573; font-size: 15.5px; max-width: 440px; margin: 0 auto; }

/* ---- Téléphone ---- */
.hod-wrap .hod-phone-line { text-align: center; margin: 18px 0 0; font-size: 14px; color: #6b7785; }
.hod-wrap .hod-phone-line a { color: var(--hod-primary); font-weight: 700; text-decoration: none; }

/* ---- Dropzone / previews ---- */
.hod-wrap .hod-dropzone {
	border: 2px dashed var(--hod-border); border-radius: var(--hod-radius-sm);
	padding: 20px 14px; text-align: center; cursor: pointer;
	transition: border-color .2s, background .2s, transform .15s; background: #fafbfc;
}
.hod-wrap .hod-dropzone:hover, .hod-wrap .hod-dropzone.is-drag {
	border-color: var(--hod-primary);
	background: color-mix(in srgb, var(--hod-primary) 6%, #fff);
}
.hod-wrap .hod-dropzone.is-drag { transform: scale(1.01); }
.hod-wrap .hod-dropzone-icon { font-size: 28px; display: block; margin-bottom: 4px; }
.hod-wrap .hod-dropzone-text { font-size: 14px; color: #6b7785; font-weight: 600; }
.hod-wrap .hod-dropzone-text small { font-weight: 400; color: #9aa5b1; }
.hod-wrap .hod-previews { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.hod-wrap .hod-preview {
	position: relative; width: 78px; height: 78px; border-radius: 10px; overflow: hidden;
	border: 1px solid var(--hod-border); animation: hodPop .35s cubic-bezier(.2,.8,.3,1.4) both;
}
.hod-wrap .hod-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hod-wrap .hod-preview-del {
	position: absolute; top: 0; right: 0; width: 30px; height: 30px;
	border: none; border-bottom-left-radius: 10px; background: rgba(0,0,0,.6); color: #fff;
	font-size: 17px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.hod-wrap .hod-preview-del:hover { background: #e23b3b; }

/* =========================================================================
   MODAL
   ========================================================================= */
html.hod-no-scroll, html.hod-no-scroll body { overflow: hidden; }

.hod-modal { position: fixed; inset: 0; z-index: 99999; display: grid; place-items: center; padding: 16px; }
.hod-modal[hidden] { display: none; }
.hod-modal-overlay {
	position: absolute; inset: 0; background: rgba(15, 25, 35, .55);
	backdrop-filter: blur(3px); opacity: 0; transition: opacity .22s ease;
}
.hod-modal.is-open .hod-modal-overlay { opacity: 1; }
.hod-modal-dialog {
	position: relative; width: 100%; max-width: 640px;
	max-height: min(92dvh, 860px); overflow-y: auto; overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	border-radius: var(--hod-radius, 14px);
	transform: translateY(24px) scale(.97); opacity: 0;
	transition: transform .24s cubic-bezier(.2,.8,.3,1.2), opacity .2s ease;
	container-type: inline-size; container-name: hodform;
}
.hod-modal.is-open .hod-modal-dialog { transform: none; opacity: 1; }
.hod-modal-dialog .hod-form { box-shadow: none; border: none; min-height: 100%; }
.hod-modal-close {
	position: absolute; top: 10px; right: 10px; z-index: 3;
	width: 40px; height: 40px; border: none; border-radius: 50%;
	background: rgba(0,0,0,.08); color: #444; font-size: 22px; cursor: pointer;
	display: grid; place-items: center; transition: background .15s;
}
.hod-modal-close:hover { background: rgba(0,0,0,.16); }

/* Progression sticky + actions sticky dans la modal */
.hod-modal-dialog .hod-progress {
	position: sticky; top: 0; z-index: 2;
	background: var(--hod-bg, #fff); padding: 14px 0 10px; margin: -4px 0 16px;
}
.hod-modal-dialog .hod-actions {
	position: sticky; bottom: 0; z-index: 2;
	background: linear-gradient(transparent, var(--hod-bg, #fff) 35%);
	padding: 14px 0 4px; margin-top: 18px;
}

/* Sur mobile : la modal devient une feuille plein écran (bottom sheet) */
@media (max-width: 600px) {
	.hod-modal { padding: 0; align-items: end; }
	.hod-modal-dialog {
		max-width: 100%; max-height: 100dvh; height: 100dvh;
		border-radius: 0; transform: translateY(40px);
	}
}

/* =========================================================================
   CONTAINER QUERIES — adaptation au CONTENEUR (colonne Divi, modal, sidebar)
   ========================================================================= */
@container hodform (max-width: 520px) {
	.hod-wrap .hod-services, .hod-form .hod-services { grid-template-columns: 1fr; }
	.hod-wrap .hod-grid, .hod-form .hod-grid { grid-template-columns: 1fr; }
	.hod-wrap .hod-actions, .hod-form .hod-actions { flex-direction: column-reverse; }
	.hod-wrap .hod-btn, .hod-form .hod-btn { width: 100%; margin-left: 0; }
	.hod-wrap .hod-service-card, .hod-form .hod-service-card {
		flex-direction: row; align-items: center; gap: 12px; padding: 12px;
	}
	.hod-wrap .hod-service-icon, .hod-form .hod-service-icon { font-size: 22px; }
}

/* Repli pour navigateurs sans container queries */
@supports not (container-type: inline-size) {
	@media (max-width: 560px) {
		.hod-wrap .hod-services { grid-template-columns: 1fr; }
		.hod-wrap .hod-grid { grid-template-columns: 1fr; }
		.hod-wrap .hod-actions { flex-direction: column-reverse; }
		.hod-wrap .hod-btn { width: 100%; margin-left: 0; }
		.hod-wrap .hod-service-card { flex-direction: row; align-items: center; gap: 12px; }
	}
}

/* ---- Accessibilité ---- */
@media (prefers-reduced-motion: reduce) {
	.hod-wrap *, .hod-wrap *::before, .hod-wrap *::after,
	.hod-modal, .hod-modal * { animation: none !important; transition: none !important; }
}

/* =========================================================================
   v1.4 — Menus déroulants modernes, image d'icône, liste de services
   ========================================================================= */

/* --- Select stylé (type de lieu, urgence, questions conditionnelles) --- */
.hod-wrap .hod-select-wrap { position: relative; }
.hod-wrap .hod-select-wrap::after {
	content: ""; position: absolute; right: 16px; top: 50%; width: 10px; height: 10px;
	border-right: 2px solid var(--hod-primary); border-bottom: 2px solid var(--hod-primary);
	transform: translateY(-70%) rotate(45deg); pointer-events: none; transition: transform .2s var(--hod-ease, ease);
}
.hod-wrap select.hod-select {
	width: 100%; font-size: 16px; font-family: inherit; color: var(--hod-text);
	padding: 13px 42px 13px 15px; background: #fff;
	border: 2px solid var(--hod-border); border-radius: var(--hod-radius-sm, 12px);
	appearance: none; -webkit-appearance: none; cursor: pointer;
	transition: border-color .2s ease, box-shadow .2s ease;
}
.hod-wrap select.hod-select:hover { border-color: var(--hod-secondary); }
.hod-wrap select.hod-select:focus {
	outline: none; border-color: var(--hod-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--hod-primary) 18%, transparent);
}
.hod-wrap .hod-select-wrap:focus-within::after { transform: translateY(-30%) rotate(225deg); }

/* --- Image d'icône de service (prime sur emoji) --- */
.hod-wrap .hod-service-img {
	width: 34px; height: 34px; object-fit: contain; display: block;
}
.hod-wrap .hod-service-card:has(input:checked) .hod-service-img { transform: scale(1.05); }
.hod-wrap .hod-service-img { transition: transform .3s var(--hod-spring, cubic-bezier(.2,.8,.3,1.4)); }

/* --- Mode "menu déroulant" pour le choix des services (liste compacte) --- */
.hod-wrap .hod-services-select { display: flex; flex-direction: column; gap: 8px; }
.hod-wrap .hod-service-line {
	display: flex; align-items: center; gap: 12px; cursor: pointer;
	padding: 12px 14px; border: 2px solid var(--hod-border); border-radius: var(--hod-radius-sm, 12px);
	background: #fff; transition: border-color .2s ease, background .2s ease, transform .15s ease;
}
.hod-wrap .hod-service-line:hover { border-color: var(--hod-secondary); transform: translateX(2px); }
.hod-wrap .hod-service-line input { position: absolute; opacity: 0; pointer-events: none; }
.hod-wrap .hod-service-line-ico { font-size: 22px; line-height: 1; flex: 0 0 auto; width: 26px; text-align: center; }
.hod-wrap .hod-service-line-ico .hod-service-img { width: 26px; height: 26px; }
.hod-wrap .hod-service-line-label { flex: 1; font-weight: 600; font-size: 15px; }
.hod-wrap .hod-service-line-check {
	flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
	background: var(--hod-border); color: #fff; font-size: 14px; transform: scale(.6); opacity: 0;
	transition: transform .25s var(--hod-spring, cubic-bezier(.2,.8,.3,1.4)), opacity .2s ease, background .2s ease;
}
.hod-wrap .hod-service-line:has(input:checked) {
	border-color: var(--hod-primary); background: color-mix(in srgb, var(--hod-primary) 7%, #fff);
}
.hod-wrap .hod-service-line:has(input:checked) .hod-service-line-check {
	transform: scale(1); opacity: 1; background: var(--hod-primary);
}

/* =========================================================================
   v1.4.1 — Menus déroulants sur 2 colonnes (desktop ET mobile)
   ========================================================================= */
.hod-wrap .hod-select-grid,
.hod-wrap .hod-conditional {
	display: grid;
	grid-template-columns: 1fr 1fr;
	column-gap: 14px;
}
.hod-wrap .hod-conditional:empty { display: none; }
/* Sélecteurs alignés en bas même si un libellé passe sur 2 lignes */
.hod-wrap .hod-select-grid > .hod-field,
.hod-wrap .hod-conditional > .hod-field {
	display: flex; flex-direction: column; justify-content: flex-end; min-width: 0;
}
.hod-wrap .hod-select-grid select.hod-select,
.hod-wrap .hod-conditional select.hod-select { min-width: 0; text-overflow: ellipsis; }

/* Conteneur étroit (mobile) : on garde 2 colonnes, en version compacte */
@container hodform (max-width: 520px) {
	.hod-wrap .hod-select-grid, .hod-wrap .hod-conditional { column-gap: 10px; }
	.hod-wrap .hod-select-grid > .hod-field, .hod-wrap .hod-conditional > .hod-field { margin-bottom: 12px; }
	.hod-wrap .hod-select-grid label, .hod-wrap .hod-conditional label { font-size: 13px; margin-bottom: 5px; line-height: 1.25; }
	.hod-wrap .hod-select-grid select.hod-select, .hod-wrap .hod-conditional select.hod-select { padding: 11px 30px 11px 12px; }
	.hod-wrap .hod-select-grid .hod-select-wrap::after, .hod-wrap .hod-conditional .hod-select-wrap::after { right: 11px; width: 8px; height: 8px; }
}
/* Très petit écran (< 300 px de conteneur) : une colonne */
@container hodform (max-width: 300px) {
	.hod-wrap .hod-select-grid, .hod-wrap .hod-conditional { grid-template-columns: 1fr; }
}
@supports not (container-type: inline-size) {
	@media (max-width: 330px) { .hod-wrap .hod-select-grid, .hod-wrap .hod-conditional { grid-template-columns: 1fr; } }
}
