/* =========================================================
   KEYS99 - SEARCH PAGE
   Layered on css/index.css + css/hub.css.
========================================================= */

.search-page .hub-head{
  margin-bottom:16px;
}

.search-filters{
  position:relative;
  display:grid;
  gap:12px;
  padding:16px;
  border:1px solid #d3e0dc;
  border-radius:16px;
  background:#fff;
  box-shadow:0 5px 20px rgba(0,0,0,.03);
}

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

.sf-field > span{
  font-size:var(--fs-label);
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.5px;
  color:var(--muted);
}

.sf-query{
  position:relative;                 /* anchors the suggestion list */
}

.sf-query > span{
  position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap;
}

.sf-query .suggest-dropdown{ top:calc(100% + 6px); }

.sf-query input{
  width:100%;
  box-sizing:border-box;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fafcfb;
  font-size:var(--fs-input);
  color:var(--ink);
  outline:0;
}

.sf-query input:focus{
  border-color:var(--green);
  box-shadow:0 0 0 3px rgba(0,107,91,.12);
}

/* ---------- Filters + Sort row, under the search bar ---------- */

.sf-toolbar{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.sf-toolbar .sf-btn{ width:auto; }

.sf-btn{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  box-sizing:border-box;
  width:100%;
  min-width:0;
  min-height:44px;
  padding:0 14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  color:var(--ink);
  font:inherit;
  font-size:var(--fs-ui);
  font-weight:700;
  cursor:pointer;
  transition:border-color .15s, background .15s;
}

.sf-btn:hover,
.sf-btn:focus-within,
.sf-btn[aria-expanded="true"]{
  border-color:var(--green);
  background:var(--green-soft);
}

.sf-btn-icon{ color:var(--green); font-size:16px; line-height:1; }

.sf-badge{
  display:inline-grid;
  place-items:center;
  min-width:20px;
  height:20px;
  padding:0 6px;
  border-radius:999px;
  background:var(--green);
  color:#fff;
  font-size:var(--fs-label);
}
.sf-badge[hidden]{ display:none; }

/* The select fills the button, so a tap anywhere opens the native
   picker; its text shows the current order. */
.sf-sort-label{ color:var(--muted); font-weight:600; }
@media (max-width:420px){ .sf-sort-label{ display:none; } }
.sf-sort select{
  flex:0 1 auto;
  width:auto;
  min-width:0;
  max-width:100%;
  height:auto;
  box-shadow:none;
  padding:0 18px 0 0;
  border:0;
  background:transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23006b5b' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right center;
  color:var(--ink);
  font:inherit;
  font-weight:700;
  appearance:none;
  -webkit-appearance:none;
  cursor:pointer;
  outline:0;
  text-overflow:ellipsis;
}

/* ---------- Active filters, removable ---------- */

.sf-chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.sf-chips[hidden]{ display:none; }

.sf-chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px 6px 12px;
  border:1px solid #b9dcd2;
  border-radius:999px;
  background:var(--green-soft);
  color:var(--green-dark);
  font:inherit;
  font-size:var(--fs-small);
  font-weight:700;
  cursor:pointer;
}
.sf-chip span{ font-size:14px; line-height:1; }
.sf-chip:hover{ border-color:var(--green); }

/* ---------- Filter panel: drops down on desktop ---------- */

.sf-backdrop[hidden],
.sf-panel[hidden]{ display:none; }

.sf-panel{
  padding-top:4px;
  border-top:1px solid #eef3f1;
}

.sf-panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin:8px 0 12px;
}

.sf-panel-head strong{ font-size:var(--fs-lead); color:var(--ink); }

.sf-close{
  width:36px;
  height:36px;
  border:0;
  border-radius:50%;
  background:#f1f6f4;
  color:var(--ink);
  font-size:16px;
  cursor:pointer;
}

.sf-grid{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:12px;
}

.sf-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:14px;
}

.search-summary{
  margin:18px 0 12px;
  font-size:var(--fs-ui);
  font-weight:600;
  color:var(--muted);
}

.search-summary p,
.search-summary h2{ margin:0; font-size:inherit; font-weight:inherit; color:inherit; }

.search-page .property-card[hidden]{ display:none; }

.search-empty{
  padding:36px 20px;
  border:1px dashed #c7d8d3;
  border-radius:16px;
  text-align:center;
  color:var(--muted);
}

.search-empty strong{
  display:block;
  margin-bottom:6px;
  font-size:var(--fs-lead);
  color:var(--ink);
}

.search-empty p{ margin:0 0 16px; }

@media (max-width:900px){
  .sf-grid{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
}

/* Phones: the filters open as a sheet from the bottom of the screen. */
@media (max-width:700px){
  .search-filters{ padding:12px; gap:10px; }

  /* Two equal buttons across the full width. */
  .sf-toolbar{ display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1fr); }
  .sf-toolbar .sf-btn{ width:100%; }

  .sf-backdrop{
    position:fixed;
    inset:0;
    z-index:1000;
    background:rgba(9,44,61,.45);
  }

  .sf-panel{
    position:fixed;
    left:0;
    right:0;
    bottom:0;
    z-index:1001;
    max-height:85vh;
    overflow-y:auto;
    padding:4px 16px calc(16px + env(safe-area-inset-bottom));
    border:0;
    border-radius:20px 20px 0 0;
    background:#fff;
    box-shadow:0 -10px 30px rgba(0,0,0,.18);
  }

  .sf-panel-head{
    position:sticky;
    top:0;
    z-index:1;
    margin:0 -16px 12px;
    padding:14px 16px 10px;
    background:#fff;
    border-bottom:1px solid #eef3f1;
  }

  .sf-actions{
    position:sticky;
    bottom:calc(-16px - env(safe-area-inset-bottom));
    margin:16px -16px 0;
    padding:12px 16px;
    background:#fff;
    border-top:1px solid #eef3f1;
  }

  .sf-actions button{ flex:1; }
}

body.sf-sheet-open{ overflow:hidden; }

.suggest-sub{ display:block; font-size:var(--fs-label); color:var(--muted); }
