.listing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.listing-header .controls-bar,
.controls-bar .filters-panel {
  display: flex;
  align-items: center;
  gap: 8px;
}

.listing-header .controls-bar {
  flex-grow: 1;
  justify-content: end;
}

/* Toggle button: hidden on desktop - shown on mobile */
.filters-panel-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 14px;
  background: #ffffffb2;
  color: #fff;
  box-shadow: 0 2px 5px #6666660d;
  cursor: pointer;
}

.filters-panel-toggle,
.filters-panel-toggle img {
  transition: 100ms ease;
}

.select-container {
  position: relative;
  display: inline-block;
}

.select-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 13px 24px;
  border-radius: 500px;
  background: #ffffffb2;
  cursor: pointer;
  box-shadow: 0 2px 5px #6666660d;
  color: #3e3e3e;
  font-weight: 400;
  font-size: 13px;

  min-width: 160px;
  white-space: nowrap;
}

.select-toggle:hover {
  color: #5b21a6;
}

.select-toggle .chev {
  transition: transform 200ms ease;
  min-width: 20px;
  min-height: 20px;
}

.select-toggle[aria-expanded="true"] .chev {
  transform: rotate(180deg);
}

.select-menu {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;

  margin-top: 13px;
  background: #fbfbfb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0px 14px 44px 0px #00000026;
  padding: 16px;

  display: flex;
  flex-direction: column;
  gap: 12px;

  width: max-content;
/*  width: 100%;*/
/*  min-width: 180px;*/
}

/* html[dir="rtl"] .select-menu {
  transform: translateX(50%);
} */

.select-menu::before {
  content: "";
  position: absolute;
  top: -8px;
  inset-inline-end: 50%;
  transform: translateX(50%);

/*  inset-inline-end: 35px;*/
/*  inset-inline-end: 20%;*/

  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #fbfbfb;
}

/* .select-menu.location-menu::before {
  inset-inline-end: 49px;
} */

.sort-menu > li:not(:last-of-type) {
    padding-bottom: 10px;
    border-bottom: 0.5px dashed transparent;
    border-image: repeating-linear-gradient( to right, rgba(0, 0, 0, 0.3) 0 8px, transparent 8px 16px ) 1;
}

.location-menu > div:not(:last-of-type),
.categories-menu > div:not(:last-of-type) {
    padding-bottom: 12px;
    border-bottom: 0.5px dashed transparent;
    border-image: repeating-linear-gradient( to right, rgba(0, 0, 0, 0.3) 0 8px, transparent 8px 16px ) 1;
}

/* -------------------------------------------------------------------- */
/* Sort Select */
/*.select-menu.sort-menu {*/
/*  width: 100%;*/
/*  gap: 10px;*/
/*  width: max-content;*/
/*}*/

.select-menu button[role="option"] {
  width: 100%;
  margin-inline-end: 40px;
  text-align: start;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 100ms ease;

  position: relative;
  display: block;
}

.select-menu button[role="option"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-end: 0;
  width: 12px;
  height: 6px;
  border-left: 2px solid #16a34a;
  border-bottom: 2px solid #16a34a;
  transform: translateY(-50%) rotate(-45deg);
  opacity: 1;
  transition: opacity 0.15s ease-in-out;
}

.select-menu button[role="option"][aria-selected="true"]::after,
.select-menu button[role="option"]:hover,
.select-menu .check:hover {
  color: #5b21a6;
}

/* -------------------------------------------------------------------- */
/* Filter Select */
/* Location Select */
/* Categories Select */

/*.select-menu.filter-menu {
  width: 100%;
  width: fit-content;*/
/*  min-width: 333px;*/

  /*inset-inline: 50% 0;
  transform: translateX(-50%);
}*/

/*html[dir="rtl"] .select-menu.filter-menu {
  transform: translateX(50%);
}*/

/*.select-menu.filter-menu::before {
  position: absolute;
  top: -8px;
  inset-inline-end: 50%;
  transform: translateX(50%);
}*/

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.filter-col {
  min-width: max-content;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-title {
  font-size: 12px;
  font-weight: 600;
}

/* Checkbox row */
.check {
  margin-inline-end: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #020024;
  cursor: pointer;
}

.check-text {
  font-size: 12px;
  white-space: nowrap;
}

/* -------------------------------------------------------------------- */
/* Search Filed */
.search-field {
  position: relative;
}

@media (min-width: 992px) {
  .search-field:focus-within .search-input {
    width: 400px;
  }

  /* base state (visible) */
  .filters-panel {
    margin-inline-start: 0;
    opacity: 1;
    transition: 350ms ease-out;
    z-index: 20;
  }

  /* focused state: hide/move all selects smoothly */
  .controls-bar:has(.search-field:focus-within) .filters-panel {
    opacity: 0;
    margin-inline-start: -500px;
    pointer-events: none;
    z-index: -1;
  }
}

.search-input {
  width: 184px;
  transition: width 400ms ease;

  padding-block: 13px;
  padding-inline: 52px 24px;
  border-radius: 500px;
  font-size: 14px;
  color: #3e3e3e;
  outline: none;
  background-color: #ffffffb2;
  box-shadow: 0 2px 5px #6666660d;
  text-transform: capitalize;
}

.our-service .search-input {
  width: 250px;
}

.search-input::placeholder {
  color: #00000080;
}

.search-input:placeholder-shown {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-icon {
  position: absolute;
  inset-inline-start: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: #00000080;
  cursor: pointer;
  z-index: 1;
}

.search-icon:hover {
  color: #5b21a6;
}

html[dir="rtl"] .search-icon svg {
  transform: rotate(90deg);
}

/* -------------------------------------------------------------------- */
/* Responsive */

@media (max-width: 992px) {
  .listing-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* search + icon in one row */
  .listing-header .controls-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    width: 100%;
  }

  .select-menu.filter-menu {
    min-width: 0px !important;
  }

  /* show the toggle, stretch the search */
  .controls-bar .filters-panel-toggle {
    display: inline-flex;
  }

  .controls-bar .search-field {
    width: 100%;
  }

  .controls-bar .search-input {
    min-width: 0;
    width: 100%;
    font-size: 15px;
  }

  /* filters panel becomes a hidden card under search row */
  .controls-bar .filters-panel {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: #ffffff99;
    border-radius: 16px;
    padding: 12px 8px;
    box-shadow: 0 2px 5px #6666660d;
    grid-column: 1 / -1; /* full width below search/toggle */
    grid-row: 2;
    margin-top: 2px;
  }

  .controls-bar .filters-panel.is-open {
    display: grid;
  }

  .filters-panel-toggle.is-active {
    background: #542198;
    color: #fff;
  }

  .filters-panel-toggle.is-active img {
    filter: brightness(0) invert(1);
  }

  /* tighter pills on mobile */
  .controls-bar .select-toggle {
    min-width: 0;
    padding: 12px 22px;
    width: 100%;
    border: 0.2px solid #00000033;
  }
}

@media (max-width: 768px) {
  .listing-header {
    gap: 24px;
  }
}

@media (max-width: 576px) {
  .controls-bar .filters-panel {
    grid-template-columns: 1fr;
  }

  /* search + icon in one row */
  .listing-header .controls-bar {
    gap: 10px;
  }
}

@media (min-width: 1600px) {
  .select-toggle {
    font-size: 15px;
  }

  .search-input {
    width: 220px;
    font-size: 15px;
  }

/*  .select-menu {
    min-width: 200px;
  }*/

/*  .select-menu.filter-menu {
    min-width: 350px;
  }*/

  .select-menu button[role="option"] {
    font-size: 13px;
  }

  .check-text {
    font-size: 13px;
  }

  .filter-title {
    font-size: 13px;
  }
}
