/* ==========================================================================
   Archihub Map Locate Bar — floating pill search bar
   Shared by: dashboard template (archihub-locate.php)
              homepage shortcode ([archihub_locate_bar])
   ========================================================================== */

/* ── Pill container ─────────────────────────────────────────────────────── */
/*
 * Guppy launcher (.at-chatfloatholder) is position:fixed z-index:10000.
 * The pill lives inside position:relative .archihub-map-area so its own
 * stacking context never competes with Guppy's fixed layer.
 */
.archihub-locate-bar {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;

  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 52px;
  padding: 6px 6px 6px 18px;

  background: #fff;
  border-radius: 50px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  max-width: calc(100% - 40px);
  box-sizing: border-box;

  /* Neutralise plugin CSS variables so color-mix(--fc-primary) resolves to
   * brand teal instead of the plugin's default blue (#4390ff). */
  --fc-primary: #75cdd4;
  --fc-dark: #111827;
}

/* ── Career dropdown ────────────────────────────────────────────────────── */
.archihub-locate-bar .archihub-discipline-select {
  flex: 0 0 auto;
  width: 180px;
  height: 38px;
  line-height: normal;
  padding: 0 28px 0 2px;
  font-size: 13px;
  border: none;
  border-radius: 0;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 8px center;
  background-size: 14px;
  color: #111827;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  box-sizing: border-box;
  outline: none;
}
.archihub-locate-bar .archihub-discipline-select:focus { outline: none; }

/* ── Separator ──────────────────────────────────────────────────────────── */
.archihub-locate-bar .archihub-bar-sep {
  width: 1px;
  height: 26px;
  background: #e5e7eb;
  flex-shrink: 0;
  margin: 0 4px;
}

/* ── Location input wrapper ─────────────────────────────────────────────── */
/* Bug 1 fix: wrapper and input both flex-grow so they fill available space  */
.archihub-locate-bar .archihub-autocomplete-wrapper {
  flex: 1 1 0;
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
}
.archihub-locate-bar .archihub-location-input {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
  height: 38px;
  line-height: normal;
  padding: 0 10px;
  font-size: 13px;
  border: none;
  background: transparent;
  color: #111827;
  box-sizing: border-box;
  outline: none;
}
.archihub-locate-bar .archihub-location-input::placeholder { color: #9ca3af; }

/* ── Autocomplete dropdown ──────────────────────────────────────────────── */
.archihub-locate-bar .wpgmp-autosuggest-results {
  position: absolute;
  bottom: calc(100% + 8px);
  top: auto;
  left: -12px;
  right: -12px;
  z-index: 9999;
  background: #fff;
  border: 1.5px solid #d1d5db;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 220px;
  overflow-y: auto;
}
.archihub-locate-bar .wpgmp-autosuggest-results li {
  padding: 9px 12px;
  font-size: 13px;
  color: #111827;
  cursor: pointer;
  line-height: 1.4;
}
/* Plugin wpgmp_all_backend.css line 10416 wins at (0,2,1) with color-mix(--fc-primary).
 * Third class pushes us to (0,3,1); !important covers any remaining load-order ties. */
.archihub-locate-bar .wpgmp-autosuggest-results li:hover,
.archihub-locate-bar .wpgmp-autosuggest-results li.active,
.archihub-locate-bar ul.wpgmp-autosuggest-results li:hover {
  background: rgba(117, 205, 212, 0.12) !important;
  color: #75cdd4 !important;
}

/* ── Search button ──────────────────────────────────────────────────────── */
.archihub-locate-bar .archihub-search-btn {
  flex-shrink: 0;
  height: 40px;
  padding: 0 20px;
  font-size: 13px;
  font-weight: 600;
  background: #111827;
  color: #fff;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
}
.archihub-locate-bar .archihub-search-btn:hover    { background: #374151; }
.archihub-locate-bar .archihub-search-btn:disabled { background: #6b7280; }

/* ── Reset button ───────────────────────────────────────────────────────── */
.archihub-locate-bar .archihub-reset-btn {
  flex-shrink: 0;
  height: 40px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: 50px;
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
}
.archihub-locate-bar .archihub-reset-btn:hover { color: #111827; }

/* ── Fullscreen: native :fullscreen selector ────────────────────────────── */
/*
 * When the browser owns the fullscreen surface the pill's position:absolute
 * parent is no longer in the viewport — force fixed so it stays visible.
 * z-index 10001 is only relevant inside the fullscreen stacking context;
 * Guppy's fixed button doesn't render there anyway.
 */
:-webkit-full-screen .archihub-locate-bar,
:-moz-full-screen    .archihub-locate-bar,
:fullscreen          .archihub-locate-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
}

/* ── Homepage shortcode context: pill flows in-document, not overlaid ─────── */
/*
 * When rendered via [archihub_locate_bar] the pill is not inside a map canvas
 * so position:absolute makes no sense. The --inline modifier resets it to a
 * normal flex row that sits above the map shortcode in the page flow.
 */
.archihub-locate-bar--inline {
  position: relative;
  bottom: auto;
  left: auto;
  right: auto;
  transform: none;
  width: 100%;
  max-width: 100%;
  display: flex;
  border-radius: 50px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
/*
 * Guppy launcher is position:fixed; bottom:44px; right:44px; ~56px wide.
 * Switch from left:50%/translateX (shrink-wraps with inline-flex) to
 * left/right inset + display:flex so the absolutely-positioned pill stretches
 * between the insets rather than shrinking to content width.
 * right:100px = 44px Guppy offset + 56px button width = guaranteed clearance.
 */
@media (max-width: 768px) {
  .archihub-locate-bar {
    display: flex;
    bottom: 12px;
    left: 12px;
    right: 100px;
    width: auto;
    max-width: none;
    transform: none;
    border-radius: 30px;
  }
}

@media (max-width: 640px) {
  .archihub-locate-bar {
    padding: 6px 6px 6px 14px;
  }
  .archihub-locate-bar .archihub-discipline-select { width: 130px; }
  .archihub-locate-bar .archihub-bar-sep           { display: none; }
  .archihub-locate-bar .archihub-reset-btn         { display: none; }
}

/* ── Elementor homepage section background override ─────────────────────── */
/* The Elementor container carrying the [archihub_locate_bar] shortcode has a
 * custom class `local` applied. Strip the background from it and its inner
 * wrapper so the pill floats clean on the page. */
.elementor .local,
.elementor .local > .e-con-inner {
  background: transparent !important;
  background-color: transparent !important;
}

/* Fallback: target any Elementor element that directly contains the inline
 * pill, in case the `local` class is removed or renamed in the editor. */
.elementor-element:has(.archihub-locate-bar--inline) {
  background: transparent !important;
  background-color: transparent !important;
}
