/* Liste de location publique — thème clair, lisible d'un coup d'œil, conçu pour un iframe Squarespace. */
:root {
  --ink: #1b2430;
  --muted: #5b6675;
  --line: #e3e8ee;
  --bg: #f6f8fa;
  --card: #ffffff;
  --accent: #1f4e79;
  --accent-ink: #ffffff;
  --ok-bg: #e6f4ea;
  --ok-ink: #1e6b3a;
  --soon-bg: #fff4e0;
  --soon-ink: #8a5a00;
  --no-bg: #fdecea;
  --no-ink: #a93226;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* En-tête */
.site-header { margin-bottom: 20px; }
.site-header h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.01em; }
.site-sub { margin: 0; color: var(--muted); font-size: 14px; }
.empty-all {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; text-align: center; color: var(--muted);
}

/* Filtre (grandeurs, prix, date) — ouvert sur ordinateur, replié derrière un bouton sur mobile */
.filters-toggle { margin-bottom: 12px; }
/* [hidden] doit l'emporter sur .btn (display) : bouton réservé au mobile, posé par viewer.js */
.filters-toggle[hidden] { display: none; }
.filters {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; margin-bottom: 22px;
}
.filters.is-collapsed { display: none; }
.filters-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.filters-title { font-weight: 700; font-size: 15px; }
.filters-count { color: var(--muted); font-size: 14px; }
.filters-reset {
  margin-left: auto; background: none; border: none; color: var(--accent); font: inherit; font-size: 14px;
  font-weight: 600; cursor: pointer; padding: 4px 0; text-decoration: underline;
}
.filters-reset:disabled { color: var(--muted); text-decoration: none; cursor: default; opacity: 0.6; }
.filters-body { display: grid; grid-template-columns: 1.2fr 1.4fr 1fr; gap: 14px 24px; }
.filter-group { border: none; margin: 0; padding: 0; min-width: 0; }
.filter-group legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-size: 14px; font-weight: 600; user-select: none;
}
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip-count { font-size: 12px; font-weight: 500; color: var(--muted); }
.chip:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip:has(input:checked) .chip-count { color: rgba(255, 255, 255, 0.8); }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.price-fields { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; }
.price-fields label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.price-fields input {
  width: 84px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px;
  color: var(--ink); background: var(--card); text-align: right;
}
.price-sep { color: var(--muted); }
.range { position: relative; height: 36px; }
.range-track { position: absolute; left: 0; right: 0; top: 50%; height: 6px; transform: translateY(-50%); background: var(--line); border-radius: 3px; }
.range-fill { position: absolute; top: 50%; height: 6px; transform: translateY(-50%); background: var(--accent); border-radius: 3px; }
.range input[type="range"] {
  position: absolute; left: 0; top: 0; width: 100%; height: 36px; margin: 0; background: none;
  pointer-events: none; -webkit-appearance: none; appearance: none;
}
.range input[type="range"]::-webkit-slider-runnable-track { background: none; height: 36px; }
.range input[type="range"]::-moz-range-track { background: none; height: 36px; }
.range input[type="range"]::-webkit-slider-thumb {
  pointer-events: auto; -webkit-appearance: none; appearance: none; width: 22px; height: 22px; margin-top: 7px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); cursor: pointer;
}
.range input[type="range"]::-moz-range-thumb {
  pointer-events: auto; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); cursor: pointer;
}
.range input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--ink); }
.filter-date input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; color: var(--ink); background: var(--card); max-width: 100%; }
.filter-hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.section-empty { margin: 0; padding: 14px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: 14px; }
.unit[hidden], .section-empty[hidden] { display: none; }

/* Section par immeuble ou groupe */
.building-section { margin-bottom: 28px; }
.section-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px;
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--accent);
}
.section-head h2 { margin: 0; font-size: 20px; }
.section-addr { margin: 0; color: var(--muted); font-size: 14px; }
.section-buildings { margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 14px; flex-basis: 100%; }
.section-count { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }

/* Cartes de logements */
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.unit {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.unit-building { font-size: 13px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; }
/* Bloc du haut : grandeur / étage + loyer à gauche, bouton « Voir le plan » centré en hauteur à droite */
.unit-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.unit-top-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.unit-top .plan-link { flex-shrink: 0; }
.unit-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.unit-type { font-size: 28px; font-weight: 700; line-height: 1; }
.unit-meta { color: var(--muted); font-size: 14px; }
.unit-rent { font-size: 20px; font-weight: 700; }
.unit-rent-ask { font-size: 16px; font-weight: 600; color: var(--muted); }
.avail-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.avail-label { font-size: 14px; color: var(--muted); }
.avail { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.avail-now { background: var(--ok-bg); color: var(--ok-ink); }
.avail-date { background: var(--soon-bg); color: var(--soon-ink); }
.unit-desc { margin: 0; font-size: 15px; white-space: pre-line; }

/* Inclusions : pictogrammes avec infobulle */
.incl-block { display: flex; flex-direction: column; gap: 6px; }
.incl-head { font-size: 14px; color: var(--muted); }
.incl { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line);
  color: var(--accent); cursor: default; outline: none;
}
.badge:hover, .badge:focus-visible { border-color: var(--accent); background: #eef3f8; }
.badge-forbidden { background: var(--no-bg); border-color: #f3c4bf; color: var(--muted); }
.badge-forbidden:hover, .badge-forbidden:focus-visible { border-color: var(--no-ink); background: #fbe1dd; }
.badge svg { display: block; }
/* Infobulle flottante unique, positionnée par viewer.js dans la fenêtre visible (jamais coupée) */
.tip {
  position: fixed; z-index: 2000; pointer-events: none; opacity: 0; transition: opacity 0.1s;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 500; line-height: 1.2;
  padding: 5px 9px; border-radius: 6px; white-space: nowrap; max-width: calc(100vw - 16px);
}
.tip.is-visible { opacity: 1; }
.unit-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; font-family: inherit;
}
.btn:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--card); color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* Immeubles sans disponibilité */
.no-availability { margin-top: 12px; }
.no-availability h2 { font-size: 18px; margin: 0 0 8px; }
.no-availability ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.no-availability li {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px;
}
.nb-name { font-weight: 600; grid-column: 1; }
.nb-addr { color: var(--muted); grid-column: 1; }
.nb-status { grid-column: 2; grid-row: 1 / 3; align-self: center; color: var(--muted); font-size: 13px; white-space: nowrap; }

/* Coordonnées : page plein écran seulement (masquées dans un cadre, voir viewer.js) */
.contact { margin-top: 28px; padding: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; text-align: center; }
.is-framed .contact { display: none; }

/* Page d'un plan */
.plan-header .back-link { display: inline-block; margin-bottom: 8px; font-size: 14px; }
.plan-units { margin: 6px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 14px; }
.plan-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.plan-host {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: auto; min-height: 200px; padding: 8px;
}
.plan-canvas { display: block; width: 100%; height: auto; margin: 0 auto; background: #fff; }
.plan-loading, .plan-error { color: var(--muted); text-align: center; padding: 40px 16px; }

/* Visionneuse en surimpression (ordinateur) */
.viewer {
  position: fixed; inset: 0; z-index: 1000; background: rgba(17, 24, 39, 0.6);
  display: flex; align-items: stretch; justify-content: center; padding: 16px;
}
.viewer-panel {
  background: var(--card); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  width: min(1100px, 100%); display: flex; flex-direction: column; overflow: hidden;
}
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.viewer-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.viewer-body { flex: 1; overflow: auto; background: #eef1f5; padding: 12px; }
.viewer-body .plan-canvas { box-shadow: var(--shadow); }
body.viewer-open { overflow: hidden; }

@media (max-width: 768px) {
  .wrap { padding: 12px; }
  .site-header h1 { font-size: 22px; }
  .units { grid-template-columns: 1fr; }
  .no-availability li { grid-template-columns: 1fr; }
  .filters-body { grid-template-columns: 1fr; }
  .nb-status { grid-column: 1; grid-row: auto; white-space: normal; }
}
