/* stylelint-disable selector-class-pattern */

/* =========================================================
   JSC COMPONENT CONTRACT
   File: jsc-idx-header-compact-search.css
   Layer: IDX / Compact Header Search
   Version: 1.2

   PURPOSE
   ----------------------------------------------------------------
   Owns:
   - Compact IDX search rail
   - Real FlexMLS compact location + submit integration
   - Custom Advanced Search toggle button
   - Elementor wrapper enforcement for compact search
   - Compact search responsive behavior

   ELEMENTOR CLASS MAP
   ----------------------------------------------------------------
   - .jsc-idx-searchbar
   - .jsc-idx-searchbar__inner
   - .jsc-idx-searchbar__main
   - .jsc-idx-searchbar__field
   - .jsc-idx-searchbar__actions
   - .jsc-idx-searchbar__advanced-wrap
   - .jsc-idx-searchbar__advanced

   NOTES
   ----------------------------------------------------------------
   - The FlexMLS widget inside .jsc-idx-searchbar__field is the
     real compact search form.
   - The widget's own submit button is restyled as the compact
     Search CTA.
   - The right-side custom action remains the Advanced Search toggle.
   - Any legacy custom compact Search button container is hidden.
========================================================= */

/* #region TOKENS */
:root{
  /* compact search layout */
  --jsc-idx-searchbar-pad-top: 10px;

  --jsc-idx-searchbar-pad-bottom: 14px;

  --jsc-idx-searchbar-gap: 12px;

  --jsc-idx-searchbar-actions-gap: 12px;

  /* compact control sizing */
  --jsc-idx-searchbar-min-h: 56px;

  --jsc-idx-searchbar-pad-x: 20px;

  --jsc-idx-searchbar-btn-pad-x: 22px;

  /* compact search colors */
  --jsc-idx-search-field-border: rgb(var(--jsc-rgb-black) / var(--jsc-o-12));

  --jsc-idx-search-field-bg: rgb(var(--jsc-rgb-white) / 92%);

  --jsc-idx-search-submit-bg: var(--jsc-accent);

  --jsc-idx-search-submit-text: var(--jsc-text-on-light);

  --jsc-idx-input-focus: rgb(var(--jsc-rgb-black) / 25%);

  --jsc-idx-input-focus-ring: rgb(var(--jsc-rgb-black) / var(--jsc-o-06));
}

/* #endregion TOKENS */

/* =========================================================
   1) COMPACT IDX SEARCHBAR SHELL
========================================================= */

/* #region COMPACT IDX SEARCHBAR SHELL */
.jsc-idx-searchbar.elementor-element{
  width: 100%;
  padding-inline: var(--jsc-idx-shell-pad-inline);
  padding-top: var(--jsc-idx-searchbar-pad-top);
  padding-bottom: var(--jsc-idx-searchbar-pad-bottom);
  border-top: 1px solid rgb(var(--jsc-rgb-black) / var(--jsc-o-08));
  background: var(--jsc-surface-light);
}

.jsc-idx-searchbar__inner.elementor-element{
  width: 100%;
  max-width: var(--jsc-idx-shell-max);
  min-width: 0;
  margin-inline: auto;
}

.jsc-idx-searchbar__main.elementor-element{
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: var(--jsc-idx-searchbar-gap);
  width: 100%;
  min-width: 0;
}

/* #endregion COMPACT IDX SEARCHBAR SHELL */

/* =========================================================
   2) FIELD + ACTION RAIL STRUCTURE
========================================================= */

/* #region FIELD + ACTION RAIL STRUCTURE */
.jsc-idx-searchbar__field.elementor-element{
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0;
}

.jsc-idx-searchbar__actions.elementor-element{
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: var(--jsc-idx-searchbar-actions-gap);
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: fit-content;
}

/* legacy custom compact submit is no longer used */
.jsc-idx-searchbar__submit-wrap,
.jsc-idx-searchbar__submit{
  display: none !important;
}

/* #endregion FIELD + ACTION RAIL STRUCTURE */

/* =========================================================
   3) ELEMENTOR WRAPPER NORMALIZATION
========================================================= */

/* #region ELEMENTOR WRAPPER NORMALIZATION */
.jsc-idx-searchbar .elementor-widget,
.jsc-idx-searchbar .elementor-widget-container{
  min-width: 0;
}

.jsc-idx-searchbar__field > .elementor-widget{
  width: 100%;
  max-width: 100%;
}

.jsc-idx-searchbar__advanced .elementor-widget-container,
.jsc-idx-searchbar__advanced .elementor-button-wrapper{
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  background: transparent;
}

/* #endregion ELEMENTOR WRAPPER NORMALIZATION */

/* =========================================================
   4) ADVANCED SEARCH BUTTON (SECONDARY CTA)
========================================================= */

/* #region ADVANCED SEARCH BUTTON (SECONDARY CTA) */
.jsc-idx-searchbar__advanced-wrap{
  align-items:center;
}

.jsc-idx-searchbar__advanced{
  align-items:center;
  width:auto;
  margin:0;
  padding:0;
  background:transparent;
  border:0;
}

/* actual button */

.jsc-idx-searchbar__advanced a.elementor-button,
.jsc-idx-searchbar__advanced .elementor-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:var(--jsc-idx-searchbar-min-h);
  padding-inline:var(--jsc-idx-searchbar-btn-pad-x);
  border-radius:var(--jsc-radius-pill);
  border:1px solid rgb(var(--jsc-rgb-black) / var(--jsc-o-12));
  background:rgb(var(--jsc-rgb-white) / var(--jsc-o-100));
  color:var(--jsc-text-on-light);
  font:inherit;
  line-height:1;
  text-decoration:none;
  white-space:nowrap;
  transition:
    transform var(--jsc-idx-fast) var(--jsc-idx-ease),
    box-shadow var(--jsc-idx-med) var(--jsc-idx-ease),
    border-color var(--jsc-idx-fast) var(--jsc-idx-ease);
  box-shadow:none;
}

/* hover */

.jsc-idx-searchbar__advanced a.elementor-button:hover,
.jsc-idx-searchbar__advanced .elementor-button:hover{
  transform:translateY(-1px);
  border-color:rgb(var(--jsc-rgb-black) / var(--jsc-o-18));
  box-shadow:
    0 8px 18px rgb(var(--jsc-rgb-black) / var(--jsc-o-10));
}

/* focus */

.jsc-idx-searchbar__advanced a.elementor-button:focus-visible,
.jsc-idx-searchbar__advanced .elementor-button:focus-visible{
  outline:var(--jsc-outline-w) solid rgb(var(--jsc-rgb-black) / var(--jsc-o-18));
  outline-offset:2px;
}

/* active */

.jsc-idx-searchbar__advanced a.elementor-button:active,
.jsc-idx-searchbar__advanced .elementor-button:active{
  transform:translateY(0);
  box-shadow:none;
}

/* open state */

.jsc-idx-searchbar__advanced[aria-expanded="true"] a.elementor-button,
.jsc-idx-searchbar__advanced[aria-expanded="true"] .elementor-button{
  border-color:rgb(var(--jsc-rgb-black) / var(--jsc-o-18));
  box-shadow:
    0 0 0 3px rgb(var(--jsc-rgb-black) / var(--jsc-o-05));
}

/* #endregion ADVANCED SEARCH BUTTON (SECONDARY CTA) */

/* =========================================================
   5) COMPACT FLEXMLS WIDGET RESET
========================================================= */

/* #region COMPACT FLEXMLS WIDGET RESET */

.jsc-idx-searchbar__field .elementor-widget-fmc-widget-fmcsearch,
.jsc-idx-searchbar__field .elementor-widget-container,
.jsc-idx-searchbar__field .flexmls_connect__search,
.jsc-idx-searchbar__field .flexmls_connect__search *{
  box-sizing: border-box;
}

.jsc-idx-searchbar__field .elementor-widget-fmc-widget-fmcsearch,
.jsc-idx-searchbar__field .elementor-widget-container{
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.jsc-idx-searchbar__field .flexmls_connect__search,
.jsc-idx-searchbar__field .flexmls_connect__search.flexmls_connect__search_new{
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  font-family: inherit !important;
  color: var(--jsc-text-on-light);
}

/* strip plugin chrome not needed in compact mode */
.jsc-idx-searchbar__field .flexmls_connect__search_new_title,
.jsc-idx-searchbar__field .flexmls_connect__search_field > label,
.jsc-idx-searchbar__field .query,
.jsc-idx-searchbar__field input[type="hidden"]{
  display: none !important;
}

/* #endregion COMPACT FLEXMLS WIDGET RESET */

/* =========================================================
   6) COMPACT FLEXMLS FORM LAYOUT
========================================================= */

/* #region COMPACT FLEXMLS FORM LAYOUT */

.jsc-idx-searchbar__field .flexmls_connect__search.flexmls_connect__search_new form{
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  align-items: center;
  column-gap: var(--jsc-idx-searchbar-actions-gap);
  row-gap: 0;
  margin: 0;
  width: 100%;
  transition: grid-template-columns var(--jsc-idx-med) var(--jsc-idx-ease);
}

.jsc-idx-searchbar__field .flexmls_connect__search_field{
  width: 100%;
  min-width: 0;
  margin: 0;
}

.jsc-idx-searchbar__field .flexmls_connect__search_new_links{
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  width: auto;
  overflow: hidden;
  max-width: 220px;
  opacity: 1;
  transform: translateX(0);
  transition:
    max-width var(--jsc-idx-med) var(--jsc-idx-ease),
    opacity var(--jsc-idx-fast) var(--jsc-idx-ease),
    transform var(--jsc-idx-fast) var(--jsc-idx-ease),
    margin var(--jsc-idx-med) var(--jsc-idx-ease);
}

/* #endregion COMPACT FLEXMLS FORM LAYOUT */

/* =========================================================
   7) COMPACT LOCATION FIELD / SELECT2
========================================================= */

/* #region COMPACT LOCATION FIELD / SELECT2 */

.jsc-idx-searchbar__field .select2,
.jsc-idx-searchbar__field .select2-container,
.jsc-idx-searchbar__field .select2-container--default{
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.jsc-idx-searchbar__field .select2-container{
  position: relative !important;
}

.jsc-idx-searchbar__field .select2-selection--multiple{
  position: relative;
  min-height: var(--jsc-idx-searchbar-min-h);
  border: var(--jsc-stroke-hairline) solid var(--jsc-idx-search-field-border);
  border-radius: var(--jsc-radius-pill) !important;
  background: var(--jsc-idx-search-field-bg);
  box-shadow: none;
  padding:
    8px
    var(--jsc-idx-searchbar-pad-x)
    8px
    calc(var(--jsc-idx-searchbar-pad-x) + 22px);
  display: block !important;
  transition:
    border-color var(--jsc-idx-fast) var(--jsc-idx-ease),
    box-shadow var(--jsc-idx-fast) var(--jsc-idx-ease),
    background var(--jsc-idx-fast) var(--jsc-idx-ease);
}

.jsc-idx-searchbar__field .select2-container--focus .select2-selection--multiple,
.jsc-idx-searchbar__field .select2-selection--multiple:focus-within{
  border-color: rgb(var(--jsc-rgb-black) / var(--jsc-o-18));
  box-shadow: 0 0 0 3px rgb(var(--jsc-rgb-black) / var(--jsc-o-05));
  background: rgb(var(--jsc-rgb-white) / var(--jsc-o-96));
}

.jsc-idx-searchbar__field .select2-selection--multiple::before{
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  opacity: 0.5;
  pointer-events: none;
  z-index: 2;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Ccircle cx='7' cy='7' r='4.75' stroke='%23131A2F' stroke-width='1.5'/%3E%3Cpath d='M10.5 10.5L14 14' stroke='%23131A2F' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

.jsc-idx-searchbar__field .select2-selection__rendered{
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  align-content: center !important;
  gap: 8px !important;
  width: 100% !important;
  min-height: calc(var(--jsc-idx-searchbar-min-h) - 16px);
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

.jsc-idx-searchbar__field .select2-selection__choice{
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  float: none !important;
  margin: 0 !important;
  padding: 10px 14px 10px 28px !important;
  border: 1px solid rgb(var(--jsc-rgb-black) / var(--jsc-o-18)) !important;
  border-radius: 10px !important;
  background: rgb(var(--jsc-rgb-white) / var(--jsc-o-100)) !important;
  color: var(--jsc-text-on-light) !important;
  font: inherit !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}

.jsc-idx-searchbar__field .select2-selection__choice__remove{
  position: absolute !important;
  left: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 12px !important;
  height: 12px !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
  cursor: pointer !important;
  color: rgb(var(--jsc-rgb-black) / 0.45) !important;
  border: 0 !important;
  background: transparent !important;
}

.jsc-idx-searchbar__field .select2-selection__choice__remove:hover{
  color: rgb(var(--jsc-rgb-black) / 0.75) !important;
}

.jsc-idx-searchbar__field .select2-search--inline{
  float: none !important;
  display: inline-flex !important;
  align-items: center !important;
  flex: 1 1 140px !important;
  min-width: 140px !important;
  margin: 0 !important;
  padding: 0 !important;
}

.jsc-idx-searchbar__field .select2-search--inline .select2-search__field{
  width: 100% !important;
  min-width: 80px !important;
  height: auto !important;
  font: inherit !important;
  color: var(--jsc-text-on-light) !important;
  line-height: 1.2 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
  text-indent: 0 !important;
}

.jsc-idx-searchbar__field .select2-selection__placeholder{
  color: var(--jsc-text-on-light-muted) !important;
  opacity: 1 !important;
}

/* COMPACT SEARCH SELECT2 DROPDOWN */
.select2-container--open .select2-dropdown{
  border: 1px solid rgb(var(--jsc-rgb-black) / var(--jsc-o-12));
  border-radius: 20px;
  background: rgb(var(--jsc-rgb-white) / var(--jsc-o-100));
  box-shadow: 0 16px 40px rgb(var(--jsc-rgb-black) / var(--jsc-o-10));
  overflow: hidden;
}

.select2-container--open .select2-search--dropdown{
  padding: 12px 14px 8px;
}

.select2-container--open .select2-search__field{
  min-height: 44px;
  border: 1px solid rgb(var(--jsc-rgb-black) / var(--jsc-o-10));
  border-radius: 999px;
  padding: 0 14px;
  background: rgb(var(--jsc-rgb-white) / var(--jsc-o-100));
}

.select2-container--open .select2-results__options{
  padding: 6px;
}

.select2-container--open .select2-results__option{
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
}

.select2-container--open .select2-results__option--highlighted[aria-selected]{
  background: rgb(var(--jsc-rgb-black) / var(--jsc-o-05));
  color: var(--jsc-text-on-light);
}

/* #endregion COMPACT LOCATION FIELD / SELECT2 */

/* =========================================================
   8) COMPACT REAL SUBMIT BUTTON
========================================================= */

/* #region COMPACT REAL SUBMIT BUTTON */

.jsc-idx-searchbar__field input[type="submit"].flexmls_connect__search_new_submit{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  min-height: var(--jsc-idx-searchbar-min-h);
  padding-inline: clamp(22px, 2vw, 30px);
  border: 1px solid transparent ;
  border-radius: var(--jsc-radius-pill);
  background: var(--jsc-idx-search-submit-bg);
  color: var(--jsc-idx-search-submit-text);
  font: inherit;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
  transition:
    background var(--jsc-idx-fast) var(--jsc-idx-ease),
    border-color var(--jsc-idx-fast) var(--jsc-idx-ease),
    color var(--jsc-idx-fast) var(--jsc-idx-ease),
    transform var(--jsc-idx-fast) var(--jsc-idx-ease),
    box-shadow var(--jsc-idx-med) var(--jsc-idx-ease);
}

.jsc-idx-searchbar__field input[type="submit"].flexmls_connect__search_new_submit:hover{
  transform: translateY(-1px);
  box-shadow: 0 5px 5px rgb(var(--jsc-rgb-black) / var(--jsc-o-08));
}

.jsc-idx-searchbar__field input[type="submit"].flexmls_connect__search_new_submit:focus-visible{
  outline: var(--jsc-outline-w) solid rgb(var(--jsc-rgb-black) / var(--jsc-o-18));
  outline-offset: 2px;
}

.jsc-idx-searchbar__field input[type="submit"].flexmls_connect__search_new_submit:active{
  transform: translateY(0);
}

/* #endregion COMPACT REAL SUBMIT BUTTON */

/* =========================================================
   9) ADVANCED OPEN STATE
   Apply .jsc-advanced-open to .jsc-idx-searchbar__main via JS
========================================================= */

/* #region ADVANCED OPEN STATE */
.jsc-idx-searchbar__main.jsc-advanced-open .jsc-idx-searchbar__field input[type="submit"].flexmls_connect__search_new_submit,
.jsc-idx-searchbar__main.jsc-advanced-open .jsc-idx-searchbar__field .flexmls_connect__search_new_links{
  display: none !important;
}

/* #endregion ADVANCED OPEN STATE */

/* =========================================================
   10) SCROLLED STATE
========================================================= */

/* #region SCROLLED STATE */

.jsc-idx-fixed-shell.jsc-scrolled .jsc-idx-searchbar{
  padding-top: var(--jsc-idx-searchbar-pad-top);
  padding-bottom: var(--jsc-idx-searchbar-pad-bottom);
}

.jsc-idx-fixed-shell.jsc-scrolled .jsc-idx-searchbar__field .select2-selection--multiple,
.jsc-idx-fixed-shell.jsc-scrolled .jsc-idx-searchbar__advanced .elementor-button,
.jsc-idx-fixed-shell.jsc-scrolled .jsc-idx-searchbar__field input[type="submit"].flexmls_connect__search_new_submit{
  min-height: 54px !important;
}

/* #endregion SCROLLED STATE */


/* =========================================================
   11) ADVANCED TOGGLE LABEL + DISABLED COMPACT FIELD
========================================================= */

/* #region ADVANCED TOGGLE LABEL + DISABLED COMPACT FIELD */

.jsc-idx-searchbar__main.jsc-advanced-open .jsc-idx-searchbar__field .select2-selection--multiple,
.jsc-idx-searchbar__main.jsc-advanced-open .jsc-idx-searchbar__field .select2-selection__rendered,
.jsc-idx-searchbar__main.jsc-advanced-open .jsc-idx-searchbar__field .select2-search--inline,
.jsc-idx-searchbar__main.jsc-advanced-open .jsc-idx-searchbar__field .select2-search__field{
  cursor: not-allowed;
}

.jsc-idx-searchbar__main.jsc-advanced-open .jsc-idx-searchbar__field .select2-selection--multiple,
.jsc-idx-searchbar__main.jsc-advanced-open .jsc-idx-searchbar__field .select2-container--focus .select2-selection--multiple,
.jsc-idx-searchbar__main.jsc-advanced-open .jsc-idx-searchbar__field .select2-selection--multiple:focus-within{
  background: rgb(var(--jsc-rgb-white) / var(--jsc-o-92));
  border-color: rgb(var(--jsc-rgb-black) / var(--jsc-o-10));
  box-shadow: none;
}

.jsc-idx-searchbar__main.jsc-advanced-open .jsc-idx-searchbar__field .select2-container,
.jsc-idx-searchbar__main.jsc-advanced-open .jsc-idx-searchbar__field .select2-search__field{
  pointer-events: none;
}

.jsc-idx-searchbar__main.jsc-advanced-open .jsc-idx-searchbar__field .select2-container{
  user-select: none;
  opacity: 0.78;
}

/* #endregion ADVANCED TOGGLE LABEL + DISABLED COMPACT FIELD */


/* =========================================================
   12) RESPONSIVE
========================================================= */

/* #region RESPONSIVE */
@media (max-width: 767.98px){
  :root{
    --jsc-idx-searchbar-pad-top: 8px;

    --jsc-idx-searchbar-pad-bottom: 12px;
  }
  
  .jsc-idx-searchbar__main.elementor-element{
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--jsc-idx-searchbar-gap);
  }


  .jsc-idx-searchbar__actions.elementor-element.e-con{
    grid-template-columns: 1fr;
    gap: var(--jsc-idx-searchbar-actions-gap);
  }


  .jsc-idx-searchbar__advanced .elementor-button{
    width: 100%;
  }

  .jsc-idx-searchbar__field .flexmls_connect__search.flexmls_connect__search_new form{
    grid-template-columns: 1fr;
    row-gap: var(--jsc-idx-searchbar-actions-gap);
  }

  .jsc-idx-searchbar__field .flexmls_connect__search_new_links,
  .jsc-idx-searchbar__field input[type="submit"].flexmls_connect__search_new_submit{
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  .jsc-idx-searchbar__main.jsc-advanced-open .jsc-idx-searchbar__actions.elementor-element{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 479.98px){
  .jsc-idx-searchbar__field .select2-selection--multiple{
    padding-left: calc(var(--jsc-idx-searchbar-pad-x) + 18px);
  }

  .jsc-idx-searchbar__field .select2-selection--multiple::before{
    left: 16px;
  }
}

/* #endregion RESPONSIVE */

/* stylelint-enable selector-class-pattern */