/* ==========================================================================
   CENTURY 21 Tunisie — barre de recherche de l'en-tête (pages intérieures)
   Tout est préfixé .c21s pour ne rien casser ailleurs dans le thème.
   Ordinateur : une ligne compacte de 48 px. Mobile : panneau plein écran.
   ========================================================================== */

.c21s {
  --c21-gold: #beaf87;
  --c21-gold-hover: #cfc29e;
  --c21-gold-text: #6e5f40;  /* or foncé : lisible sur fond blanc */
  --c21-ink: #252526;
  --c21-line: #d9d3c2;
  --c21-soft: #f1ede3;
  --c21-muted: #6b6b6b;
  --c21-h: 48px;
  --c21-radius: 8px;
  --c21-shadow: 0 16px 40px rgba(37, 37, 38, .22);
  position: relative;
  color: var(--c21-ink);
  font-size: 15px;
  line-height: 1.4;
  text-align: left;
}
.c21s *, .c21s *::before, .c21s *::after { box-sizing: border-box; }
.c21s button { font-family: inherit; }
.c21s [hidden] { display: none !important; }
.c21s fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.c21s legend { float: none; width: auto; padding: 0; border: 0; }

.c21s-section.advanced-search { padding-top: 12px; padding-bottom: 12px; }

/* Éléments réservés au mobile */
.c21s .c21s-trigger,
.c21s .c21s-panel__head,
.c21s .c21s-ref--mobile,
.c21s .c21s-panel__foot { display: none; }

/* --------------------------------------------------------------------------
   Barre (ordinateur)
   ------------------------------------------------------------------------ */
.c21s-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.c21s-field { position: relative; min-width: 0; }

.c21s-label {
  display: block;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c21-gold-text);
}
/* Dans la barre, les libellés restent lisibles par les lecteurs d'écran seulement. */
.c21s-bar > .c21s-field > .c21s-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.c21s input[type="text"] {
  border: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
  margin: 0;
  height: auto;
  min-width: 0;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--c21-ink);
}
.c21s input[type="text"]::placeholder { color: #767676; font-weight: 500; opacity: 1; }

/* Champs de la barre : même hauteur, fond blanc, bordure fine */
.c21s-field--where,
.c21s-field--budget,
.c21s-dd__btn,
.c21s-filters-btn {
  min-height: var(--c21-h);
  background: #fff;
  border: 1px solid var(--c21-line);
  border-radius: var(--c21-radius);
}
.c21s-field--where:focus-within,
.c21s-field--budget:focus-within,
.c21s-dd__btn:hover,
.c21s-dd.is-open > .c21s-dd__btn,
.c21s-filters-btn:hover,
.c21s-dd.is-open > .c21s-filters-btn { border-color: var(--c21-ink); }

.c21s-field--status { flex: 0 0 auto; }
.c21s-field--where { flex: 1 1 260px; display: flex; align-items: center; padding: 0 12px; }
.c21s-field--type { flex: 0 1 210px; }
.c21s-field--budget { flex: 0 1 220px; display: flex; align-items: center; padding: 0 14px; }
.c21s-field--budget input[type="text"] { width: 100%; }
.c21s-field--filters { flex: 0 0 auto; }

/* Où ? */
.c21s-where__box { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; cursor: text; }
.c21s-where__box > svg { flex: 0 0 auto; color: var(--c21-muted); }
.c21s-chips { display: flex; gap: 4px; flex: 0 1 auto; min-width: 0; overflow: hidden; }
.c21s-where__input { flex: 1 1 90px; }
.c21s-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  background: var(--c21-soft);
  border-radius: 999px;
  padding: 2px 2px 2px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--c21-ink);
  white-space: nowrap;
}
.c21s-chip__x {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--c21-gold-text);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.c21s-chip__x:hover { background: rgba(37, 37, 38, .08); color: var(--c21-ink); }

.c21s-suggest {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 280px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--c21-shadow);
  max-height: 320px;
  overflow-y: auto;
}
.c21s-suggest [role="option"] {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.c21s-suggest [role="option"][aria-selected="true"],
.c21s-suggest [role="option"]:hover { background: var(--c21-soft); }
.c21s-suggest__name { font-weight: 600; }
.c21s-suggest__city { font-size: 13px; color: var(--c21-muted); }
.c21s-suggest__empty { padding: 12px; color: var(--c21-muted); font-size: 14px; }

/* Menus déroulants */
.c21s-dd__btn {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0 38px 0 14px;
  text-align: left;
  cursor: pointer;
  position: relative;
  color: var(--c21-ink);
}
.c21s-dd__btn::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23252526' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform .15s;
}
.c21s-dd.is-open > .c21s-dd__btn::after { transform: rotate(180deg); }
.c21s-dd__value { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c21s-field--type .c21s-dd__value:not(.is-set) { color: #767676; font-weight: 500; }
.c21s-field--status .c21s-dd__btn { font-weight: 700; }

.c21s-dd__panel {
  display: none;
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  left: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--c21-shadow);
  padding: 16px;
  color: var(--c21-ink);
}
.c21s-dd.is-open > .c21s-dd__panel { display: block; }

/* Transaction : liste verticale */
.c21s-tabs { min-width: 240px; padding: 6px; }
.c21s-tab { position: relative; display: block; margin: 0; cursor: pointer; }
.c21s-tab input { position: absolute; opacity: 0; pointer-events: none; }
.c21s-tab span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
}
.c21s-tab:hover span { background: var(--c21-soft); }
.c21s-tab input:checked + span { font-weight: 700; }
.c21s-tab input:checked + span::after {
  content: "";
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e5f40' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / contain no-repeat;
}
.c21s-tab input:focus-visible + span { outline: 2px solid var(--c21-ink); outline-offset: -2px; }

/* Type de bien */
.c21s-dd__panel--types { width: 460px; max-width: calc(100vw - 32px); }
.c21s-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; max-height: 360px; overflow-y: auto; }
.c21s-types__group legend { margin-bottom: 8px; }
.c21s-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.c21s-check--child { padding-left: 26px; font-size: 14px; }
.c21s-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--c21-ink); flex: 0 0 auto; }
.c21s-dd__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #e6e2d8;
  margin-top: 14px;
  padding-top: 12px;
}

/* Bouton Filtres */
.c21s-filters-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--c21-ink);
  cursor: pointer;
}
.c21s-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--c21-gold);
  color: var(--c21-ink);
  font-size: 12px;
  font-weight: 700;
}

/* Panneau Filtres */
.c21s-more { left: auto; right: 0; width: 580px; max-width: calc(100vw - 32px); padding: 20px; }
.c21s .c21s-more > * + * { margin-top: 18px; }
.c21s-rooms legend, .c21s-features legend { margin-bottom: 10px; }
.c21s-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.c21s-pill { position: relative; margin: 0; cursor: pointer; }
.c21s-pill input { position: absolute; opacity: 0; pointer-events: none; }
.c21s-pill span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--c21-line);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  color: var(--c21-ink);
  transition: background .15s, border-color .15s, color .15s;
}
.c21s-pill:hover span { border-color: var(--c21-ink); }
.c21s-pill input:checked + span { background: var(--c21-ink); border-color: var(--c21-ink); color: #fff; }
.c21s-pill input:focus-visible + span { outline: 2px solid var(--c21-ink); outline-offset: 2px; }

.c21s-more__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.c21s-box {
  border: 1px solid var(--c21-line);
  border-radius: var(--c21-radius);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.c21s-box:focus-within { border-color: var(--c21-ink); }
.c21s-money { display: flex; align-items: baseline; gap: 6px; }
.c21s-money input { flex: 1 1 auto; width: 100%; }
.c21s-unit { font-size: 13px; font-weight: 600; color: var(--c21-muted); white-space: nowrap; }

/* Autres critères : champs personnalisés Houzez (Fields Builder) */
.c21s-custom legend { margin-bottom: 10px; }
.c21s-custom__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.c21s-custom__item { min-width: 0; }
.c21s .c21s-custom__item .form-group { margin: 0; }
.c21s .c21s-custom__item label { display: block; margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c21-gold-text); }
.c21s .c21s-custom__item .bootstrap-select,
.c21s .c21s-custom__item .bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) { width: 100% !important; }
.c21s .c21s-custom__item .form-control,
.c21s .c21s-custom__item select,
.c21s .c21s-custom__item .bootstrap-select > .dropdown-toggle {
  width: 100%;
  min-height: 44px;
  height: auto;
  padding: 0 12px;
  margin: 0;
  border: 1px solid var(--c21-line);
  border-radius: var(--c21-radius);
  background: #fff;
  box-shadow: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--c21-ink);
  line-height: 42px;
}
.c21s .c21s-custom__item .bootstrap-select > .dropdown-toggle:focus,
.c21s .c21s-custom__item .form-control:focus { border-color: var(--c21-ink); outline: none; }
.c21s .c21s-custom__item .bootstrap-select .dropdown-menu { z-index: 60; }

.c21s-more__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #e6e2d8;
  padding-top: 14px;
}
.c21s-more__actions { display: inline-flex; align-items: center; gap: 16px; }

/* Référence */
.c21s-ref {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--c21-line);
  border-radius: 999px;
  padding: 0 4px 0 14px;
  min-height: 44px;
  background: #fff;
}
.c21s-ref:focus-within { border-color: var(--c21-ink); }
.c21s-ref label { margin: 0; font-size: 13px; font-weight: 700; color: var(--c21-gold-text); white-space: nowrap; }
.c21s-ref input[type="text"] { width: 110px; font-size: 14px; }
.c21s-ref__go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: var(--c21-ink);
  color: var(--c21-gold);
  cursor: pointer;
}

/* Boutons */
.c21s-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--c21-h);
  padding: 0 22px;
  border: 0;
  border-radius: var(--c21-radius);
  background: var(--c21-gold);
  color: var(--c21-ink);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.c21s-submit:hover { background: var(--c21-gold-hover); }
.c21s-btn {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.c21s-btn--dark { background: var(--c21-ink); color: #fff; }
.c21s-link {
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  color: var(--c21-gold-text);
  text-decoration: underline;
  cursor: pointer;
}
.c21s-link:hover { color: var(--c21-ink); }
.c21s button:focus-visible { outline: 2px solid var(--c21-ink); outline-offset: 2px; }

/* Critères actifs (page de résultats) */
.c21s-active {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}
.c21s-chip--link {
  background: #fff;
  border: 1px solid var(--c21-line);
  padding: 5px 12px;
  min-height: 34px;
  text-decoration: none;
}
.c21s-chip--link:hover { border-color: var(--c21-ink); color: var(--c21-ink); text-decoration: none; }
.c21s-chip--link span { color: var(--c21-gold-text); font-size: 16px; line-height: 1; }
.c21s-active .c21s-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff;
  text-decoration: none;
}

/* Écrans moyens : la barre passe sur deux lignes proprement */
@media (min-width: 768px) and (max-width: 1099.98px) {
  .c21s-field--where { flex-basis: 100%; }
  .c21s-field--status, .c21s-field--type, .c21s-field--budget { flex: 1 1 0; }
}

/* ==========================================================================
   Mobile : bouton résumé + panneau plein écran
   ========================================================================== */
@media (max-width: 767.98px) {
  .c21s-section.advanced-search { display: block !important; padding: 10px 0; }

  .c21s .c21s-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    padding: 0 6px 0 16px;
    border: 1px solid var(--c21-line);
    border-radius: 999px;
    background: #fff;
    color: var(--c21-ink);
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
  }
  .c21s-trigger__text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .c21s-trigger__more {
    flex: 0 0 auto;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--c21-ink);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
  }

  .c21s-panel { display: none; }
  .c21s.is-open .c21s-panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: #fff;
    overflow: hidden;
  }
  .c21s.is-open .c21s-form { flex: 1 1 auto; overflow-y: auto; padding: 16px 20px 0; }

  .c21s .c21s-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    padding: 6px 6px 6px 20px;
    border-bottom: 1px solid #e6e2d8;
  }
  .c21s-panel__title { font-size: 18px; font-weight: 700; }
  .c21s-close { width: 44px; height: 44px; border: 0; background: transparent; font-size: 28px; line-height: 1; color: var(--c21-ink); cursor: pointer; }

  .c21s .c21s-ref--mobile { display: flex; border-radius: var(--c21-radius); background: #faf8f3; min-height: 52px; margin-bottom: 18px; }
  .c21s-ref--mobile input[type="text"] { flex: 1 1 auto; width: auto; font-size: 15px; }
  .c21s-ref--mobile .c21s-ref__go { width: 44px; height: 44px; border-radius: 8px; }
  .c21s .c21s-ref--desktop, .c21s .c21s-more__foot { display: none; }

  /* Les champs s'empilent, libellés visibles */
  .c21s-bar { flex-direction: column; flex-wrap: nowrap; gap: 18px; }
  .c21s-bar > .c21s-field { flex: 0 0 auto; }
  .c21s-bar > .c21s-field > .c21s-label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    margin-bottom: 8px;
    font-size: 13px;
  }
  .c21s-field--where, .c21s-field--budget { flex-direction: column; align-items: stretch; padding: 0; border: 0; background: transparent; }
  .c21s-where__box, .c21s-field--budget input[type="text"] {
    min-height: 52px;
    padding: 6px 12px;
    border: 1px solid var(--c21-line);
    border-radius: var(--c21-radius);
    background: #fff;
  }
  .c21s-where__box { flex-wrap: wrap; }
  .c21s-chips { flex-wrap: wrap; overflow: visible; }
  .c21s-suggest { top: 100%; }

  /* Transaction : grille de 2 × 2, toujours visible */
  .c21s-field--status > .c21s-dd__btn { display: none; }
  .c21s-field--status > .c21s-dd__panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    position: static;
    min-width: 0;
    padding: 4px;
    background: var(--c21-soft);
    border-radius: 12px;
    box-shadow: none;
  }
  .c21s-tab span { justify-content: center; border-radius: 9px; font-size: 14px; text-align: center; color: var(--c21-muted); }
  .c21s-tab:hover span { background: transparent; }
  .c21s-tab input:checked + span { background: #fff; color: var(--c21-ink); box-shadow: 0 1px 4px rgba(37, 37, 38, .15); }
  .c21s-tab input:checked + span::after { display: none; }

  /* Type de bien : la liste s'ouvre dans le flux */
  .c21s-field--type .c21s-dd__btn { min-height: 52px; }
  .c21s-dd__panel--types { position: static; width: auto; max-width: none; margin-top: 8px; box-shadow: none; border: 1px solid var(--c21-line); }
  .c21s-types { grid-template-columns: 1fr; max-height: none; }

  /* Filtres : toujours dépliés */
  .c21s-field--filters > .c21s-filters-btn { display: none; }
  .c21s-field--filters > .c21s-more {
    display: block;
    position: static;
    width: auto;
    max-width: none;
    padding: 18px 0 0;
    border-top: 1px solid #e6e2d8;
    border-radius: 0;
    box-shadow: none;
  }
  .c21s-more__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c21s-custom__grid { grid-template-columns: 1fr; }
  .c21s-more__grid .c21s-box:first-child { grid-column: 1 / -1; }
  .c21s-pill span { min-height: 44px; }

  .c21s-submit--bar { display: none; }
  .c21s .c21s-panel__foot {
    display: flex;
    align-items: center;
    gap: 14px;
    position: sticky;
    bottom: 0;
    margin: 20px -20px 0;
    padding: 12px 20px calc(16px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid #e6e2d8;
    box-shadow: 0 -6px 16px rgba(37, 37, 38, .06);
  }
  .c21s-panel__foot .c21s-link { color: var(--c21-ink); }
  .c21s-submit--panel { flex: 1 1 auto; min-height: 52px; }

  .c21s-active { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .c21s-active > * { flex: 0 0 auto; }

  html.c21s-lock, html.c21s-lock body { overflow: hidden; }
}
