/**
 * MAJ - Lots Immo — styles front (DA sobre BARNES)
 *
 * Tout est préfixé .maj-lots-immo (aucune fuite de style).
 * La couleur d'accent --maj-accent est injectée en inline par le PHP (option Salient accent-color),
 * avec repli sur la variable Salient --nectar-accent-color puis sur un beige sobre.
 */

.maj-lots-immo {
	--maj-accent: var(--nectar-accent-color, #bfa78f);
	--maj-beige: #f7f3ef;        /* fond de ligne alternée, beige très clair */
	--maj-hairline: #e4ded6;     /* filets fins */
	--maj-ink: #1d1b19;          /* texte principal */
	--maj-muted: #8a8178;        /* en-têtes / labels discrets */
	--maj-thead-top: 0px;        /* décalage du thead collant : à augmenter si un header de site fixe le recouvre */

	color: var(--maj-ink);
	font-family: inherit;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

.maj-lots-immo *,
.maj-lots-immo *::before,
.maj-lots-immo *::after {
	box-sizing: border-box;
}

.maj-lots-immo__empty {
	color: var(--maj-muted);
	font-style: italic;
	padding: 24px 0;
}

/* ---------- Accordéon ---------- */

.maj-lots-immo__group {
	border-top: 1px solid var(--maj-hairline);
}

.maj-lots-immo__group:last-of-type {
	border-bottom: 1px solid var(--maj-hairline);
}

.maj-lots-immo__heading {
	margin: 0;
	padding: 0;
	font: inherit;
}

.maj-lots-immo__toggle {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin: 0;
	padding: 24px 4px;
	background: none;
	border: 0;
	cursor: pointer;
	color: inherit;
	font-family: inherit;
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	text-align: left;
	transition: color 0.25s ease;
}

.maj-lots-immo__toggle:hover,
.maj-lots-immo__toggle:focus-visible {
	color: var(--maj-accent);
}

.maj-lots-immo__toggle:focus-visible {
	outline: 2px solid var(--maj-accent);
	outline-offset: 3px;
}

.maj-lots-immo__typo {
	display: inline-block;
}

.maj-lots-immo__chevron {
	display: inline-flex;
	flex: 0 0 auto;
	color: var(--maj-muted);
	transition: transform 0.3s ease, color 0.25s ease;
}

.maj-lots-immo__toggle[aria-expanded="true"] .maj-lots-immo__chevron {
	transform: rotate(180deg);
	color: var(--maj-accent);
}

/* Panneau : ouvert par défaut (no-JS = tout visible, crawlable).
   Le collapse animé n'est activé que lorsque le JS ajoute .is-js. */
.maj-lots-immo__panel {
	overflow: hidden;
}

.maj-lots-immo.is-js .maj-lots-immo__panel {
	max-height: 0;
	transition: max-height 0.35s ease;
}

.maj-lots-immo__panel-inner {
	padding: 4px 0 30px;
}

/* ---------- Tableau ---------- */

.maj-lots-immo__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.maj-lots-immo__table thead th {
	position: sticky;
	top: var(--maj-thead-top, 0px);
	z-index: 2;
	padding: 12px 16px;
	background: #fff;
	/* box-shadow plutôt que border-bottom : le filet collant reste rendu de façon fiable
	   au scroll (border-collapse + sticky = bord parfois masqué selon le navigateur). */
	box-shadow: inset 0 -1px 0 var(--maj-hairline);
	color: var(--maj-muted);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-align: left;
	white-space: nowrap;
}

.maj-lots-immo__table tbody td {
	padding: 15px 16px;
	border-bottom: 1px solid var(--maj-hairline);
	vertical-align: middle;
}

.maj-lots-immo__table tbody tr:nth-child(even) {
	background: var(--maj-beige);
}

.maj-lots-immo__price {
	font-weight: 600;
	white-space: nowrap;
}

.maj-lots-immo__note {
	margin: 16px 0 0;
	color: var(--maj-muted);
	font-size: 12.5px;
	font-style: italic;
}

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

.maj-lots-immo__contact-cell {
	text-align: right;
	white-space: nowrap;
}

.maj-lots-immo__contact {
	display: inline-block;
	padding: 7px 18px;
	background: none;
	border: 1px solid var(--maj-accent);
	color: var(--maj-accent);
	font-family: inherit;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.maj-lots-immo__contact:hover,
.maj-lots-immo__contact:focus-visible {
	background: var(--maj-accent);
	color: #fff;
}

.maj-lots-immo__contact:focus-visible {
	outline: 2px solid var(--maj-accent);
	outline-offset: 2px;
}

/* ---------- Colonne « Plan » (bouton picto PDF) ---------- */

.maj-lots-immo__plan-cell {
	text-align: center;
	white-space: nowrap;
}

.maj-lots-immo__plan {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px;
	background: none;
	border: 0;
	color: var(--maj-muted);
	cursor: pointer;
	line-height: 0;
	transition: color 0.2s ease, transform 0.2s ease;
}

.maj-lots-immo__plan:hover,
.maj-lots-immo__plan:focus-visible {
	color: var(--maj-accent);
	transform: translateY(-1px);
}

.maj-lots-immo__plan:focus-visible {
	outline: 2px solid var(--maj-accent);
	outline-offset: 2px;
}

.maj-lots-immo__plan-icon {
	display: block;
}

/* ---------- Modale plan PDF ---------- */

.maj-lots-immo__pdf-modal {
	/* Hauteur AUTO : la modale épouse la hauteur du plan rendu (fit-largeur), plafonnée à 90vh.
	   → plus d'aplat gris en bas pour les plans paysage. Largeur ~20% de plus qu'avant. */
	width: min(1080px, calc(100vw - 40px));
	max-width: 1080px;
	max-height: 90vh;
	padding: 0;
	border: 0;
	background: #fff;
	color: var(--maj-ink);
	box-shadow: 0 24px 70px rgba(20, 18, 15, 0.22);
	overflow: hidden; /* coins nets ; le scroll vit dans le viewport */
}

/* display:flex uniquement à l'ouverture (sinon on écraserait le display:none natif du <dialog> fermé). */
.maj-lots-immo__pdf-modal[open] {
	display: flex;
	flex-direction: column;
}

.maj-lots-immo__pdf-modal::backdrop {
	background: rgba(20, 18, 15, 0.55);
}

.maj-lots-immo__pdf-inner {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
}

.maj-lots-immo__pdf-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex: 0 0 auto;
	padding: 14px 18px;
	border-bottom: 1px solid var(--maj-hairline);
}

.maj-lots-immo__pdf-title {
	margin: 0;
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.maj-lots-immo__pdf-tools {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 0 0 auto;
}

.maj-lots-immo__pdf-tool {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: #fff;
	border: 1px solid var(--maj-hairline);
	border-radius: 3px;
	color: var(--maj-ink);
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	transition: border-color 0.2s ease, color 0.2s ease;
}

.maj-lots-immo__pdf-tool:hover,
.maj-lots-immo__pdf-tool:focus-visible {
	border-color: var(--maj-accent);
	color: var(--maj-accent);
}

.maj-lots-immo__pdf-close {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	margin-left: 4px;
	padding: 0;
	background: none;
	border: 0;
	color: var(--maj-muted);
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	transition: color 0.2s ease;
}

.maj-lots-immo__pdf-close:hover,
.maj-lots-immo__pdf-close:focus-visible {
	color: var(--maj-accent);
}

/* Viewport défilable + pages rendues en canvas par PDF.js.
   min-height : taille stable pendant le chargement (évite une modale minuscule qui grandit).
   Quand le plan est plus grand, le viewport prend la place dispo et scrolle (zoom). */
.maj-lots-immo__pdf-viewport {
	flex: 1 1 auto;
	min-height: 280px;
	overflow: auto;
	background: #525659; /* gris « visionneuse PDF » */
	-webkit-overflow-scrolling: touch;
}

.maj-lots-immo__pdf-pages {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	width: max-content;
	min-width: 100%;
	margin: 0 auto;
	padding: 16px;
	box-sizing: border-box;
}

.maj-lots-immo__pdf-page {
	display: block;
	max-width: none;
	background: #fff;
	box-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

.maj-lots-immo__pdf-msg {
	margin: 0;
	padding: 48px 16px;
	color: #fff;
	font-size: 14px;
	text-align: center;
}

/* ---------- Responsive : cartes empilées (< 768px) ---------- */

@media (max-width: 767px) {
	.maj-lots-immo__table,
	.maj-lots-immo__table tbody,
	.maj-lots-immo__table tr,
	.maj-lots-immo__table td {
		display: block;
		width: 100%;
	}

	/* En-tête de tableau masqué visuellement (les libellés passent en ::before). */
	.maj-lots-immo__table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		padding: 0;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		border: 0;
	}

	.maj-lots-immo__table tr {
		margin-bottom: 18px;
		border: 1px solid var(--maj-hairline);
		background: #fff;
	}

	.maj-lots-immo__table tbody tr:nth-child(even) {
		background: var(--maj-beige);
	}

	.maj-lots-immo__table tbody td {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 16px;
		padding: 11px 15px;
		border: 0;
		border-bottom: 1px solid var(--maj-hairline);
		text-align: right;
	}

	.maj-lots-immo__table tbody td:last-child {
		border-bottom: 0;
	}

	.maj-lots-immo__table tbody td::before {
		content: attr(data-label);
		flex: 0 0 45%;
		color: var(--maj-muted);
		font-size: 10.5px;
		font-weight: 500;
		letter-spacing: 0.07em;
		text-transform: uppercase;
		text-align: left;
	}

	.maj-lots-immo__contact-cell {
		text-align: right;
	}

	.maj-lots-immo__contact {
		width: 100%;
		padding: 10px 18px;
	}

	/* Cellule Contact : pas de label ::before (bouton pleine largeur). */
	.maj-lots-immo__contact-cell::before {
		content: "";
		flex: 0;
	}
}

/* ---------- Modale (dialog natif) ---------- */

.maj-lots-immo__modal {
	width: min(750px, calc(100vw - 32px));
	max-width: 750px;
	padding: 0;
	border: 0;
	background: #fff;
	color: var(--maj-ink);
	box-shadow: 0 24px 70px rgba(20, 18, 15, 0.22);
}

.maj-lots-immo__modal::backdrop {
	background: rgba(20, 18, 15, 0.45);
}

.maj-lots-immo__modal-inner {
	position: relative;
	padding: 38px 34px 34px;
}

.maj-lots-immo__modal-close {
	position: absolute;
	top: 12px;
	right: 14px;
	width: 36px;
	height: 36px;
	padding: 0;
	background: none;
	border: 0;
	color: var(--maj-muted);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	transition: color 0.2s ease;
}

.maj-lots-immo__modal-close:hover,
.maj-lots-immo__modal-close:focus-visible {
	color: var(--maj-accent);
}

.maj-lots-immo__modal-title {
	margin: 0 0 18px;
	padding-right: 24px;
	font-size: 19px;
	font-weight: 500;
	letter-spacing: 0.04em;
}

.maj-lots-immo__modal-confirm {
	margin: 0;
	padding: 16px 0;
	color: var(--maj-accent);
	font-size: 15px;
}

/* ---------- Accessibilité ---------- */

.maj-lots-immo__sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	border: 0;
	white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
	.maj-lots-immo.is-js .maj-lots-immo__panel,
	.maj-lots-immo__chevron,
	.maj-lots-immo__contact,
	.maj-lots-immo__toggle {
		transition: none;
	}
}
