/* ==========================================================================
   Greenshead Portal — Search Filter
   Mirrors the layout already on the site; the colours all run off variables
   so the Elementor Style tab re-skins the whole panel.
   ========================================================================== */

.ghp-search{
  --ghp-brand:#1D9E75;
  --ghp-brand-600:#17835F;
  --ghp-brand-50:#E9F7F2;
  --ghp-ink:#111827;
  --ghp-muted:#9CA3AF;
  --ghp-line:#E0E5E0;
  --ghp-card:#fff;
  --ghp-soft:#F3F4F6;
  --ghp-radius:20px;

  background:var(--ghp-card);
  border-radius:var(--ghp-radius);
  padding:22px 26px;
  max-width:960px;
  width:100%;
  margin:0 auto;
  box-shadow:0 4px 40px rgba(0,0,0,.08);
  position:relative;
  z-index:5;
  color:var(--ghp-ink);
  line-height:1.5;
}
:where(.ghp-search) *{box-sizing:border-box}
:where(.ghp-search) button{font:inherit;color:inherit}
:where(.ghp-search) ul{list-style:none;margin:0;padding:0}

.ghp-search .ghp-i{width:1em;height:1em;flex:0 0 auto;fill:none;stroke:currentColor;
  stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* ---------- NAV ---------- */
.ghp-s-nav{display:flex;align-items:center;gap:4px;margin-bottom:18px;padding-bottom:16px;
  border-bottom:1px solid var(--ghp-line);flex-wrap:wrap}
.ghp-s-nav-item{padding:8px 16px;font-size:14px;font-weight:500;color:#6b7280;cursor:pointer;
  border-radius:10px;border:1px solid transparent;transition:all .18s;white-space:nowrap;
  text-decoration:none;user-select:none;display:inline-block}
.ghp-s-nav-item.is-on{color:var(--ghp-brand);border-color:var(--ghp-brand);background:var(--ghp-brand-50)}
.ghp-s-nav-item:not(.is-on):hover{color:#fff;background:var(--ghp-brand-600);border-color:var(--ghp-brand-600)}

/* ---------- ROWS ---------- */
.ghp-s-row1{display:flex;gap:10px;align-items:center;margin-bottom:12px;flex-wrap:wrap}
.ghp-s-row2{display:flex;gap:10px;align-items:center;flex-wrap:wrap}

/* ---------- TOGGLES ---------- */
.ghp-s-toggle{display:flex;background:var(--ghp-soft);border-radius:12px;padding:4px;gap:2px;flex-shrink:0}
.ghp-s-tg{padding:9px 20px;border-radius:9px;border:0;cursor:pointer;font-size:14px;font-weight:500;
  background:transparent;color:#6b7280;transition:all .18s;white-space:nowrap}
.ghp-s-toggle-sm .ghp-s-tg{padding:7px 15px;font-size:13px;border-radius:8px}
.ghp-s-tg.is-on{background:var(--ghp-brand);color:#fff;box-shadow:0 2px 8px rgba(29,158,117,.25)}
.ghp-s-tg:not(.is-on):hover{color:#fff;background:var(--ghp-brand-600)}

/* ---------- LOCATION ---------- */
.ghp-s-locfield{position:relative;flex:1;min-width:220px}
.ghp-s-loc{display:flex;align-items:center;gap:10px;border:1.5px solid var(--ghp-line);
  border-radius:12px;padding:0 14px;height:48px;background:#fff;transition:border-color .18s;width:100%}
.ghp-s-locfield.is-open .ghp-s-loc,.ghp-s-loc:focus-within{border-color:var(--ghp-brand);
  box-shadow:0 0 0 3px rgba(29,158,117,.1)}
.ghp-s-loc .ghp-i{width:18px;height:18px;color:var(--ghp-brand)}
.ghp-s-locinput{border:0;outline:0;flex:1;font-size:14px;color:var(--ghp-ink);background:transparent;min-width:0}
.ghp-s-locinput::placeholder{color:#aab0aa}

.ghp-s-pop-loc{position:absolute;top:calc(100% + 8px);left:0;width:100%;min-width:260px;z-index:99999;
  background:#fff;border:1px solid #e8ede8;border-radius:14px;box-shadow:0 12px 40px rgba(0,0,0,.14);
  padding:6px;display:none;max-height:360px;overflow-y:auto}
.ghp-s-locfield.is-open .ghp-s-pop-loc{display:block}
.ghp-s-loc-item{display:flex;justify-content:space-between;align-items:center;gap:12px;
  padding:11px 14px;cursor:pointer;border-radius:9px;transition:background .14s}
.ghp-s-loc-item:hover{background:var(--ghp-brand-50)}
.ghp-s-loc-name{font-size:14px;color:#1f2937;font-weight:500}
.ghp-s-loc-sub{font-size:12px;color:var(--ghp-muted);white-space:nowrap;text-align:right;flex-shrink:0}
.ghp-s-loc-empty{padding:14px;text-align:center;color:var(--ghp-muted);font-size:13px}

/* ---------- FIND ---------- */
.ghp-find{background:var(--ghp-brand);color:#fff;border:0;border-radius:12px;padding:0 38px;height:48px;
  font-size:15px;font-weight:600;cursor:pointer;transition:background .18s,transform .12s;
  white-space:nowrap;flex-shrink:0}
.ghp-find:hover{background:var(--ghp-brand-600)}
.ghp-find:active{transform:scale(.97)}

/* ---------- FIELDS ---------- */
.ghp-s-field{position:relative}
.ghp-s-trigger{display:flex;align-items:center;gap:8px;border:1.5px solid var(--ghp-line);
  border-radius:12px;padding:0 12px;height:48px;background:#fff;cursor:pointer;
  transition:border-color .18s;user-select:none;min-width:150px;width:100%}
.ghp-s-row2 .ghp-s-trigger{height:40px;border-radius:10px;min-width:140px}
.ghp-s-trigger:hover{border-color:var(--ghp-brand-600)}
.ghp-s-field.is-open .ghp-s-trigger{border-color:var(--ghp-brand);box-shadow:0 0 0 3px rgba(29,158,117,.1)}
.ghp-s-trigger .ghp-i:first-child{width:18px;height:18px;color:var(--ghp-brand)}
.ghp-s-label{flex:1;font-size:14px;font-weight:500;color:#374151;white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis;text-align:left}
.ghp-s-row2 .ghp-s-label{font-size:13px}
.ghp-s-label.is-ph{color:var(--ghp-muted);font-weight:400}
.ghp-s-trigger .ghp-i:last-child{width:14px;height:14px;color:var(--ghp-muted);transition:transform .18s}
.ghp-s-field.is-open .ghp-s-trigger .ghp-i:last-child{transform:rotate(180deg)}
.ghp-s-city{flex:0 0 190px}
.ghp-s-field-sm .ghp-s-trigger{min-width:120px}

/* ---------- POPOVER (base show/hide — every popover obeys this) ---------- */
.ghp-s-pop{position:absolute;top:calc(100% + 8px);left:0;z-index:99990;background:#fff;
  border:1px solid #e8ede8;border-radius:14px;box-shadow:0 12px 40px rgba(0,0,0,.14);
  padding:14px;display:none}
.ghp-s-field.is-open .ghp-s-pop{display:block}

.ghp-s-pop-city{width:260px;padding:12px}
.ghp-s-search{width:100%;border:1.5px solid var(--ghp-line);border-radius:9px;padding:9px 12px;
  font-size:13px;outline:0;margin-bottom:8px}
.ghp-s-search:focus{border-color:var(--ghp-brand)}
.ghp-s-city-list{max-height:240px;overflow-y:auto}
.ghp-s-city-list li{padding:9px 12px;font-size:13px;color:#374151;cursor:pointer;
  border-radius:8px;transition:all .14s}
.ghp-s-city-list li:hover{background:var(--ghp-brand-50);color:var(--ghp-brand)}
.ghp-s-city-list li.is-sel{background:var(--ghp-brand);color:#fff;font-weight:500}

.ghp-s-pop-type{width:360px}
.ghp-s-tabs{display:flex;gap:6px;border-bottom:1px solid #e8ede8;padding-bottom:10px;margin-bottom:12px}
.ghp-s-ttab{flex:1;padding:8px 6px;border:0;background:transparent;cursor:pointer;font-size:13px;
  font-weight:600;color:var(--ghp-muted);border-radius:8px;transition:all .16s}
.ghp-s-ttab:hover{color:var(--ghp-brand-600)}
.ghp-s-ttab.is-on{color:var(--ghp-brand);background:var(--ghp-brand-50)}
.ghp-s-panel{display:none;grid-template-columns:1fr 1fr;gap:8px}
.ghp-s-panel.is-on{display:grid}
.ghp-s-topt{padding:11px 10px;border:1.5px solid var(--ghp-line);background:#fff;cursor:pointer;
  font-size:13px;font-weight:500;color:#374151;border-radius:10px;transition:all .16s;text-align:center}
.ghp-s-topt:hover{border-color:var(--ghp-brand);color:var(--ghp-brand);background:var(--ghp-brand-50)}
.ghp-s-topt.is-sel{border-color:var(--ghp-brand);background:var(--ghp-brand);color:#fff}

.ghp-s-pop-range{width:320px}
.ghp-s-rhead{font-size:13px;font-weight:600;color:var(--ghp-brand);text-align:center;margin-bottom:12px}
.ghp-s-rcols{display:flex;gap:12px}
.ghp-s-rcol{flex:1;min-width:0}
.ghp-s-rttl{font-size:11px;font-weight:600;letter-spacing:.05em;color:var(--ghp-muted);
  text-align:center;margin-bottom:8px}
.ghp-s-rinput{width:100%;border:1.5px solid var(--ghp-line);border-radius:9px;padding:8px 10px;
  font-size:13px;outline:0;margin-bottom:8px;text-align:center}
.ghp-s-rinput:focus{border-color:var(--ghp-brand)}
.ghp-s-rlist{max-height:180px;overflow-y:auto;border:1px solid #f0f1f0;border-radius:9px}
.ghp-s-rlist li{padding:8px 10px;font-size:13px;color:#374151;cursor:pointer;text-align:center;
  transition:all .12s;border-bottom:1px solid #f5f6f5}
.ghp-s-rlist li:last-child{border-bottom:0}
.ghp-s-rlist li:hover{background:var(--ghp-brand-50);color:var(--ghp-brand)}
.ghp-s-rlist li.is-sel{background:var(--ghp-brand);color:#fff;font-weight:500}

.ghp-s-pop-list{width:160px;max-height:280px;overflow-y:auto;padding:8px}
.ghp-s-lopt{display:block;width:100%;padding:9px 12px;border:0;background:transparent;cursor:pointer;
  font-size:13px;font-weight:500;color:#374151;border-radius:8px;transition:all .14s;text-align:left}
.ghp-s-lopt:hover{background:var(--ghp-brand-50);color:var(--ghp-brand)}
.ghp-s-lopt.is-sel{background:var(--ghp-brand);color:#fff}

/* ============================================================
   UNIT FIELD - COMPLETE FIX
   The issue was that [data-pop="unit"] .ghp-s-pop was missing
   display:none, so it overrode the base .ghp-s-pop rule.
   ============================================================ */

/* 1. HIDE by default - BOTH the container AND the list */
[data-pop="unit"] .ghp-s-pop,
[data-pop="unit"] .ghp-s-pop-list {
    display: none !important;
}

/* 2. SHOW ONLY when .is-open is present */
[data-pop="unit"].is-open .ghp-s-pop,
[data-pop="unit"].is-open .ghp-s-pop-list {
    display: block !important;
}

/* 3. When open, use flex layout for the list */
[data-pop="unit"].is-open .ghp-s-pop-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    max-height: 240px !important;
    overflow-y: auto !important;
    padding: 0 !important;
    width: auto !important;
}

/* 4. Popover container styles */
[data-pop="unit"] .ghp-s-pop {
    min-width: 120px;
    width: auto;
    padding: 8px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e8ede8;
    box-shadow: 0 8px 30px rgba(0,0,0,.12);
    z-index: 99999 !important;
}

/* 5. Individual option styles */
[data-pop="unit"] .ghp-s-lopt {
    display: block;
    width: 100%;
    padding: 8px 14px;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    text-align: left;
    transition: all .15s ease;
}

[data-pop="unit"] .ghp-s-lopt:hover {
    background: var(--ghp-brand-50);
    color: var(--ghp-brand);
}

[data-pop="unit"] .ghp-s-lopt.is-sel {
    background: var(--ghp-brand);
    color: #fff;
    font-weight: 600;
}

[data-pop="unit"] .ghp-s-lopt.is-sel:hover {
    background: var(--ghp-brand-600);
    color: #fff;
}

/* 6. Trigger button styles */
[data-pop="unit"] .ghp-s-trigger {
    min-width: 90px;
    height: 40px;
    border-radius: 10px;
    padding: 0 12px;
    gap: 6px;
}

[data-pop="unit"] .ghp-s-trigger .ghp-s-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    text-align: center;
    flex: none;
}

[data-pop="unit"] .ghp-s-trigger .ghp-i:last-child {
    width: 12px;
    height: 12px;
    color: var(--ghp-muted);
}

.ghp-s-foot{display:flex;justify-content:space-between;align-items:center;margin-top:12px;
  padding-top:10px;border-top:1px solid #e8ede8}
.ghp-s-reset{background:none;border:0;color:#6b7280;cursor:pointer;font-size:12px;font-weight:500}
.ghp-s-reset:hover{color:var(--ghp-brand-600)}
.ghp-s-done{background:var(--ghp-brand);color:#fff;border:0;border-radius:8px;padding:7px 18px;
  cursor:pointer;font-size:12px;font-weight:600}
.ghp-s-done:hover{background:var(--ghp-brand-600)}

.ghp-s-optbar{display:flex;gap:18px;align-items:center;margin-top:14px;padding-top:6px;flex-wrap:wrap}
.ghp-s-link{background:none;border:0;cursor:pointer;color:var(--ghp-brand);font-size:12.5px;font-weight:500}
.ghp-s-link:hover{color:var(--ghp-brand-600);text-decoration:underline}

@media (max-width:760px){
  .ghp-search{padding:18px}
  .ghp-s-locfield{min-width:100%;order:3}
  .ghp-find{width:100%;order:4}
  .ghp-s-city{flex:1 1 auto}
  .ghp-s-pop-type{width:300px}
  .ghp-s-pop-range{width:280px}
  .ghp-s-row2 .ghp-s-field{flex:1 1 46%}
  .ghp-s-row2 .ghp-s-trigger{min-width:0}
  [data-pop="unit"] .ghp-s-trigger{min-width:70px;padding:0 10px}
  [data-pop="unit"] .ghp-s-label{font-size:12px}
  [data-pop="unit"] .ghp-s-pop{min-width:100px}
  [data-pop="unit"] .ghp-s-lopt{font-size:12px;padding:6px 12px}
}
@media (prefers-reduced-motion:reduce){
  .ghp-search *{transition-duration:.01ms !important}
}