/* ============================================================
   Orpi-style filter bar (shared between index.html + nos-biens.html)
   ============================================================ */

.fbar {
  --fbar-bg: #ffffff;
  --fbar-border: #e4e4e4;
  --fbar-text: #1a1a2e;
  --fbar-muted: #6b7380;
  --fbar-red: var(--color-red, #E30513);
  --fbar-red-dark: #b40510;
  --fbar-green: #00a651;
  --fbar-green-bg: #e6f7ee;
  --fbar-radius: 14px;
  --fbar-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 20;
  max-width: 1180px;
  margin: 0 auto;
}

/* Acheter / Louer tabs */
.fbar__tabs {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  margin-left: 8px;
}
.fbar__tab {
  appearance: none; border: none; background: transparent;
  padding: 12px 28px;
  font: inherit; font-size: 14px; font-weight: 600;
  color: var(--fbar-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.fbar__tab.is-active {
  background: #fff;
  color: var(--fbar-text);
}

/* Main filter bar row */
.fbar__row {
  background: var(--fbar-bg);
  border-radius: 0 var(--fbar-radius) var(--fbar-radius) var(--fbar-radius);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(5, 1fr) auto auto;
  gap: 8px;
  align-items: stretch;
  box-shadow: var(--fbar-shadow);
}
@media (max-width: 1100px) {
  .fbar__row { grid-template-columns: repeat(3, 1fr); }
  .fbar__row .fbar-actions { grid-column: 1 / -1; justify-self: stretch; }
}
@media (max-width: 640px) {
  .fbar__row { grid-template-columns: 1fr 1fr; padding: 8px; }
}

/* Field button (the dropdown trigger) */
.fbar-field {
  position: relative;
}
.fbar-field__btn {
  appearance: none;
  width: 100%;
  background: #fff;
  border: 1px solid var(--fbar-border);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit; font-size: 13px; font-weight: 500;
  color: var(--fbar-text);
  text-align: left;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 48px;
}
.fbar-field__btn:hover { border-color: #c8ccd2; }
.fbar-field__btn[aria-expanded="true"] {
  border-color: var(--fbar-red);
  box-shadow: 0 0 0 2px rgba(227, 5, 19, 0.08);
}
.fbar-field__label {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fbar-field__btn svg.fbar-chevron {
  width: 16px; height: 16px; color: var(--fbar-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.fbar-field__btn[aria-expanded="true"] svg.fbar-chevron {
  transform: rotate(180deg);
}
.fbar-field__btn svg.fbar-pin,
.fbar-field__btn svg.fbar-price,
.fbar-field__btn svg.fbar-surface,
.fbar-field__btn svg.fbar-rooms,
.fbar-field__btn svg.fbar-home {
  width: 18px; height: 18px; color: var(--fbar-muted);
  flex-shrink: 0;
}
.fbar-field__btn .fbar-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  background: var(--fbar-red); color: #fff;
  border-radius: 999px;
  font-size: 11px; font-weight: 700;
  margin-left: 4px;
}

/* Dropdown panel */
.fbar-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 320px;
  max-width: 420px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
  padding: 24px 24px 16px 24px;
  z-index: 50;
  display: none;
}
.fbar-panel.is-open { display: block; }
.fbar-field:nth-last-of-type(2) .fbar-panel,
.fbar-field:nth-last-of-type(1) .fbar-panel { right: 0; left: auto; }
@media (max-width: 640px) {
  .fbar-panel { left: 0; right: 0; max-width: none; min-width: 0; }
}
.fbar-panel__heading {
  font-size: 16px; font-weight: 700;
  color: var(--fbar-text);
  margin: 0 0 16px 0;
}
.fbar-panel__footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}
.fbar-panel__reset {
  appearance: none; background: none; border: none;
  font: inherit; font-size: 13px; color: var(--fbar-muted);
  text-decoration: underline; cursor: pointer; padding: 0;
}
.fbar-panel__reset:hover { color: var(--fbar-red); }
.fbar-panel__apply {
  appearance: none; border: none;
  background: var(--fbar-red); color: #fff;
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 10px 20px; border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.fbar-panel__apply:hover { background: var(--fbar-red-dark); }

/* Type(s) de bien — checkboxes */
.fbar-types { display: flex; flex-direction: column; gap: 10px; }
.fbar-types label {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--fbar-text);
  cursor: pointer;
  padding: 4px 0;
}
.fbar-types input[type="checkbox"] {
  appearance: none;
  width: 20px; height: 20px;
  border: 1.5px solid #c8ccd2;
  border-radius: 5px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.15s;
}
.fbar-types input[type="checkbox"]:checked {
  background: var(--fbar-red);
  border-color: var(--fbar-red);
}
.fbar-types input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px; top: 1px;
  width: 6px; height: 11px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Localisation input */
.fbar-loc-input {
  position: relative;
}
.fbar-loc-input input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 1.5px solid var(--fbar-border);
  border-radius: 10px;
  font: inherit; font-size: 14px;
  color: var(--fbar-text);
  background: #fff;
}
.fbar-loc-input input:focus { outline: none; border-color: var(--fbar-red); }
.fbar-loc-input svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  color: var(--fbar-muted);
  pointer-events: none;
}

/* Prix / Surface — range inputs */
.fbar-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fbar-range label {
  display: block;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--fbar-muted);
  margin-bottom: 6px;
}
.fbar-range__input {
  position: relative;
}
.fbar-range__input input {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border: 1.5px solid var(--fbar-border);
  border-radius: 8px;
  font: inherit; font-size: 14px;
  color: var(--fbar-text);
  background: #fff;
  -moz-appearance: textfield;
}
.fbar-range__input input::-webkit-outer-spin-button,
.fbar-range__input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fbar-range__input input:focus { outline: none; border-color: var(--fbar-red); }
.fbar-range__suffix {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 13px; color: var(--fbar-muted);
  pointer-events: none;
}

/* Budget estimation box (green) */
.fbar-estim {
  margin-top: 16px;
  background: var(--fbar-green-bg);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.fbar-estim__text {
  font-size: 13px; color: #1a3a1a; line-height: 1.4;
  font-weight: 500;
}
.fbar-estim__btn {
  appearance: none; border: 1.5px solid var(--fbar-green);
  background: #fff; color: var(--fbar-green);
  font: inherit; font-size: 12px; font-weight: 600;
  padding: 8px 14px; border-radius: 999px;
  cursor: pointer; white-space: nowrap;
  text-decoration: none;
}
.fbar-estim__btn:hover { background: var(--fbar-green); color: #fff; }

/* Pièces — pill buttons */
.fbar-pieces {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.fbar-pieces button {
  appearance: none;
  background: #fff;
  border: 1.5px solid var(--fbar-border);
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit; font-size: 13px; font-weight: 500;
  color: var(--fbar-text);
  cursor: pointer;
  transition: all 0.15s;
  min-width: 48px;
}
.fbar-pieces button:hover { border-color: var(--fbar-red); }
.fbar-pieces button[aria-pressed="true"] {
  background: var(--fbar-red); color: #fff; border-color: var(--fbar-red);
}

/* Main action buttons (alerte + Rechercher) */
.fbar-actions {
  display: flex; gap: 8px; align-items: stretch;
}
.fbar__alerte {
  appearance: none;
  background: #fff;
  border: 1.5px solid var(--fbar-green);
  color: var(--fbar-green);
  padding: 0 18px;
  border-radius: 10px;
  font: inherit; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.fbar__alerte:hover { background: var(--fbar-green); color: #fff; }
.fbar__alerte svg { width: 16px; height: 16px; }

.fbar__submit {
  appearance: none;
  background: var(--fbar-red);
  color: #fff;
  border: none;
  padding: 0 26px;
  border-radius: 10px;
  font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.fbar__submit:hover { background: var(--fbar-red-dark); }

/* Empty state for nos-biens */
.properties__empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--color-brown, #6b7380);
  font-size: 16px;
}

/* Pagination controls */
.fbar-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 40px auto 0;
  padding: 8px 0;
  max-width: 1180px;
}
.fbar-page {
  appearance: none;
  background: #fff;
  border: 1px solid var(--fbar-border, #e4e4e4);
  color: var(--fbar-text, #1a1a2e);
  min-width: 40px; height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.fbar-page:hover:not([disabled]):not(.is-active) {
  border-color: var(--fbar-red, #E30513);
  color: var(--fbar-red, #E30513);
}
.fbar-page.is-active {
  background: var(--fbar-red, #E30513);
  color: #fff;
  border-color: var(--fbar-red, #E30513);
}
.fbar-page[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.fbar-page--prev, .fbar-page--next {
  font-size: 20px;
  padding: 0;
}
.fbar-page--ellipsis {
  color: var(--fbar-muted, #6b7380);
  border: none;
  cursor: default;
  background: transparent;
  min-width: 20px;
}
.fbar-page-info {
  margin-left: 12px;
  font-size: 13px;
  color: var(--fbar-muted, #6b7380);
  font-weight: 500;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .fbar-page-info { width: 100%; text-align: center; margin-left: 0; margin-top: 8px; }
  .fbar-page { min-width: 44px; height: 44px; font-size: 13px; }
}

/* ================================================================
   MOBILE-ONLY OVERRIDES — audit fixes, scoped to mobile.
   ================================================================ */

/* C1 — iOS auto-zoom fix: filter bar inputs need ≥ 16px on mobile */
@media (max-width: 767px) {
  .fbar-loc-input input,
  .fbar-range__input input { font-size: 16px; }
}

/* M1 — Filter dropdown panels full-width at tablet to prevent right-edge clip */
@media (max-width: 1099px) {
  .fbar-panel { left: 0; right: 0; max-width: none; min-width: 0; }
}

/* M4 — Pagination buttons already bumped from 36→44 at 640px above */
