/**
 * Sophia – Réservations : modale et formulaire
 *
 * La modale est déplacée à la racine de <body> par booking.js : ses styles ne
 * dépendent donc pas de la page qui l'a générée. Les sélecteurs sont volontairement
 * précis pour résister aux styles de formulaires du thème et d'Elementor.
 */

.sfr-modal {
	--sfr-gold: #d4af37;
	--sfr-gold-soft: rgba(212, 175, 55, 0.14);
	--sfr-gold-line: rgba(212, 175, 55, 0.38);
	--sfr-ink: #2c2a27;
	--sfr-muted: #6f6a63;
	--sfr-line: rgba(44, 42, 39, 0.16);
	--sfr-field: #fbf9f5;
	--sfr-error: #b3261e;
	/* Survol des boutons (couleurs de la marque). */
	--sfr-hover: #762228;
	--sfr-hover-text: #fff4e8;

	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	font-size: 16px;
	line-height: 1.6;
	color: var(--sfr-ink);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.sfr-modal[hidden],
.sfr-modal [hidden] {
	display: none !important;
}

.sfr-modal.is-open {
	opacity: 1;
}

.sfr-modal *,
.sfr-modal *::before,
.sfr-modal *::after {
	box-sizing: border-box;
}

.sfr-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(20, 17, 12, 0.6);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

.sfr-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 620px;
	max-height: calc(100vh - 48px);
	max-height: calc(100dvh - 48px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 44px 44px 34px;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 30px 80px rgba(20, 17, 12, 0.35);
	transform: translateY(16px);
	transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sfr-modal.is-open .sfr-modal__dialog {
	transform: none;
}

.sfr-modal__dialog:focus {
	outline: none;
}

/* ------------------------------------------------------------ Fermeture */

.sfr-modal .sfr-modal__close {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 1px solid var(--sfr-line);
	border-radius: 50%;
	background: #fff;
	box-shadow: none;
	color: var(--sfr-muted);
	cursor: pointer;
	transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

/* :focus redéfini : sinon le bouton garde la couleur de focus du thème. */
.sfr-modal .sfr-modal__close:focus {
	border-color: var(--sfr-line);
	background: #fff;
	color: var(--sfr-muted);
}

.sfr-modal .sfr-modal__close:hover,
.sfr-modal .sfr-modal__close:focus-visible,
.sfr-modal .sfr-modal__close:active {
	border-color: var(--sfr-hover);
	background: var(--sfr-hover);
	color: var(--sfr-hover-text);
}

/* --------------------------------------------------------------- En-tête */

.sfr-modal__head {
	margin: 0 0 28px;
	text-align: center;
}

.sfr-modal .sfr-modal__eyebrow {
	margin: 0 0 10px;
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--sfr-gold);
}

.sfr-modal .sfr-modal__title {
	position: relative;
	margin: 0;
	padding: 0 0 16px;
	font-family: Georgia, "Times New Roman", "Playfair Display", serif;
	font-size: clamp(1.4rem, 3.4vw, 1.85rem);
	font-weight: 400;
	line-height: 1.25;
	letter-spacing: 0;
	text-transform: none;
	color: var(--sfr-ink);
}

.sfr-modal .sfr-modal__title::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 0;
	width: 48px;
	height: 2px;
	transform: translateX(-50%);
	background: var(--sfr-gold);
}

.sfr-modal .sfr-modal__intro {
	max-width: 460px;
	margin: 16px auto 0;
	font-size: 0.9rem;
	line-height: 1.65;
	color: var(--sfr-muted);
}

/* ------------------------------------------------------------ Formulaire */

.sfr-modal .sfr-form {
	margin: 0;
}

.sfr-form__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 18px;
}

.sfr-field {
	display: flex;
	flex-direction: column;
	gap: 7px;
	min-width: 0;
}

.sfr-field--full {
	grid-column: 1 / -1;
}

.sfr-modal .sfr-field label {
	display: block;
	margin: 0;
	padding: 0;
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--sfr-ink);
}

.sfr-req {
	margin-left: 2px;
	color: var(--sfr-gold);
}

.sfr-opt {
	margin-left: 4px;
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
	color: var(--sfr-muted);
}

.sfr-modal .sfr-field input,
.sfr-modal .sfr-field select,
.sfr-modal .sfr-field textarea {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	min-height: 50px;
	margin: 0;
	padding: 13px 15px;
	border: 1px solid var(--sfr-line);
	border-radius: 8px;
	background-color: var(--sfr-field);
	box-shadow: none;
	font-family: inherit;
	font-size: 16px; /* Évite le zoom automatique de Safari iOS. */
	font-weight: 400;
	line-height: 1.4;
	color: var(--sfr-ink);
	outline: none;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.sfr-modal .sfr-field textarea {
	min-height: 110px;
	resize: vertical;
}

.sfr-modal .sfr-field select {
	padding-right: 42px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d4af37' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 9 7 7 7-7'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 15px center;
	background-size: 12px;
	cursor: pointer;
}

.sfr-modal .sfr-field input::placeholder,
.sfr-modal .sfr-field textarea::placeholder {
	color: #a59e93;
	opacity: 1;
}

.sfr-modal .sfr-field input::-webkit-date-and-time-value {
	text-align: left;
}

.sfr-modal .sfr-field input:focus,
.sfr-modal .sfr-field select:focus,
.sfr-modal .sfr-field textarea:focus {
	border-color: var(--sfr-gold);
	background-color: #fff;
	box-shadow: 0 0 0 3px var(--sfr-gold-soft);
}

.sfr-modal .sfr-field [aria-invalid="true"] {
	border-color: var(--sfr-error);
	box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.1);
}

.sfr-field__error {
	font-size: 0.78rem;
	line-height: 1.4;
	color: var(--sfr-error);
}

.sfr-field__error:empty {
	display: none;
}

/* Champ piège pour les robots : invisible, hors tabulation. */
.sfr-form__trap {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---------------------------------------------------------- Consentement */

.sfr-modal .sfr-consent {
	display: flex;
	align-items: flex-start;
	gap: 11px;
	margin: 22px 0 0;
	padding: 0;
	font-size: 0.84rem;
	font-weight: 400;
	line-height: 1.5;
	letter-spacing: 0;
	text-transform: none;
	color: var(--sfr-muted);
	cursor: pointer;
}

.sfr-modal .sfr-consent input {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin: 2px 0 0;
	accent-color: var(--sfr-gold);
	cursor: pointer;
}

.sfr-modal .sfr-consent input[aria-invalid="true"] {
	outline: 2px solid var(--sfr-error);
	outline-offset: 2px;
}

.sfr-consent + .sfr-field__error {
	display: block;
	margin: 6px 0 0 29px;
}

.sfr-consent + .sfr-field__error:empty {
	display: none;
}

/* ------------------------------------------------------- Message d'erreur */

.sfr-modal .sfr-form__alert {
	margin: 20px 0 0;
	padding: 12px 15px;
	border-left: 3px solid var(--sfr-error);
	border-radius: 6px;
	background: #fbeeed;
	font-size: 0.86rem;
	line-height: 1.5;
	color: var(--sfr-error);
}

/* ----------------------------------------------------------------- Bouton */

.sfr-modal .sfr-submit {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	width: 100%;
	min-height: 0;
	margin: 24px 0 0;
	padding: 17px 22px;
	border: 1px solid var(--sfr-gold);
	border-radius: 6px;
	background: var(--sfr-gold);
	box-shadow: 0 8px 20px rgba(212, 175, 55, 0.3);
	font-family: inherit;
	font-size: 0.78rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
	white-space: normal;
	color: #fff;
	cursor: pointer;
	transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.sfr-modal .sfr-submit:focus {
	border-color: var(--sfr-gold);
	background: var(--sfr-gold);
	color: #fff;
}

.sfr-modal .sfr-submit--ghost {
	width: auto;
	margin: 26px auto 0;
	padding: 15px 34px;
}

.sfr-modal .sfr-submit--ghost,
.sfr-modal .sfr-submit--ghost:focus {
	background: transparent;
	box-shadow: none;
	color: var(--sfr-gold);
}

.sfr-modal .sfr-submit:hover,
.sfr-modal .sfr-submit:focus-visible,
.sfr-modal .sfr-submit:active {
	border-color: var(--sfr-hover);
	background: var(--sfr-hover);
	box-shadow: 0 12px 26px rgba(118, 34, 40, 0.3);
	color: var(--sfr-hover-text);
	transform: translateY(-2px);
}

.sfr-modal .sfr-submit:focus-visible {
	outline: 2px solid var(--sfr-ink);
	outline-offset: 2px;
}

.sfr-modal .sfr-submit[disabled],
.sfr-modal .sfr-submit[disabled]:hover {
	border-color: var(--sfr-gold);
	background: var(--sfr-gold);
	box-shadow: none;
	color: #fff;
	opacity: 0.8;
	cursor: progress;
	transform: none;
}

.sfr-spinner {
	display: none;
	width: 15px;
	height: 15px;
	border: 2px solid rgba(255, 255, 255, 0.45);
	border-top-color: currentColor;
	border-radius: 50%;
	animation: sfr-spin 0.8s linear infinite;
}

.sfr-submit.is-loading .sfr-spinner {
	display: inline-block;
}

@keyframes sfr-spin {
	to {
		transform: rotate(360deg);
	}
}

.sfr-modal .sfr-form__note {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	margin: 14px 0 0;
	font-size: 0.76rem;
	line-height: 1.4;
	color: var(--sfr-muted);
}

/* ------------------------------------------------------------ Confirmation */

.sfr-modal__done {
	padding: 10px 0 4px;
	text-align: center;
}

.sfr-modal__done-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 68px;
	height: 68px;
	margin-bottom: 20px;
	border: 1px solid var(--sfr-gold-line);
	border-radius: 50%;
	background: var(--sfr-gold-soft);
	color: var(--sfr-gold);
}

.sfr-modal .sfr-modal__done .sfr-modal__intro {
	margin-top: 18px;
}

/* ------------------------------------------------------------- Responsive */

@media (max-width: 600px) {
	/* Sur mobile, la fenêtre monte depuis le bas de l'écran. */
	.sfr-modal {
		align-items: flex-end;
		padding: 0;
	}

	.sfr-modal__dialog {
		max-width: none;
		max-height: 94vh;
		max-height: 94dvh;
		padding: 48px 20px calc(26px + env(safe-area-inset-bottom, 0px));
		border-radius: 18px 18px 0 0;
		transform: translateY(40px);
	}

	.sfr-form__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}

	.sfr-modal .sfr-modal__close {
		top: 12px;
		right: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sfr-modal,
	.sfr-modal__dialog,
	.sfr-modal .sfr-submit {
		transition: none !important;
	}

	.sfr-spinner {
		animation-duration: 1.6s;
	}
}
