:root {
  --brand-green: #4f632b;
  --bg-gray: #f8f9fa;
  --border-color: #eee;
  --text-muted: #888;
  --tajawal: "Tajawal", sans-serif;
}

/* Search Page Main Layout */
.search-page {
  padding-top: 0;
  min-height: 80vh;
}

/* Filter Toggle Bar */
.filter-toggle-bar {
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  padding: 12px 0;
}

.filter-btn {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--tajawal);
  font-weight: 500;
  color: #333;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.2s;
}

.filter-btn:hover {
  background: #f5f5f5;
}

.filter-icon {
  width: 20px;
  height: 20px;
}

/* Search Options Pills */
.search-options-scroll {
  overflow-x: auto;
  white-space: nowrap;
  padding: 15px 0;
  scrollbar-width: none;
}

.search-options-scroll::-webkit-scrollbar {
  display: none;
}

.search-pill {
  display: inline-block;
  background: #f1f3f0;
  color: #333;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-family: var(--tajawal);
  margin-left: 10px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1.5px solid transparent;
}

.search-pill:hover,
.search-pill.active {
  background: #fff;
  border-color: var(--brand-green);
  color: var(--brand-green);
}

/* Map Section */
#search-map {
  width: 100%;
  height: 600px;
  border-radius: 0;
  margin-top: 10px;
  z-index: 1;
}

.map-placeholder {
  width: 100%;
  height: 600px;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
}

.map-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Advanced Filters Section */
.advanced-filters-section {
  background: #fff;
  padding: 40px 0;
  display: block; /* Show for editing, will toggle via JS */
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 768px) {
  .filter-grid {
    grid-template-columns: 1fr;
  }
}

.filter-card {
  background: #fff;
  border: 1px solid #f8f8f8;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.filter-card-title {
  font-family: var(--tajawal);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 20px;
  color: #333;
  text-align: right;
}

.custom-select-wrap {
  position: relative;
  width: 100%;
}

.custom-select-wrap select.nice-select {
  min-height: 56px;
  border: 0 !important;
  border-radius: 18px !important;
  background: #efefef !important;
  padding-block: 12px !important;
  padding-inline-start: 12px !important;
  padding-inline-end: 46px !important;
  cursor: pointer;
  position: relative;
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
  font-size: 14px;
  color: #4c4c4c;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  text-align: start;
  font-family: var(--tajawal);
}

.custom-select-wrap select.nice-select:focus {
  outline: none;
  background: #f7f7f7 !important;
  box-shadow: inset 0 0 0 1px rgba(85, 107, 47, 0.28), 0 0 0 3px rgba(85, 107, 47, 0.08);
}

.custom-select-wrap::before,
.custom-select-wrap::after {
  content: "";
  position: absolute;
  top: 27px;
  inset-inline-start: auto;
  inset-inline-end: 18px;
  width: 9px;
  height: 2px;
  border-radius: 999px;
  background: #a0a0a0;
  transform-origin: center;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.custom-select-wrap::before {
  transform: rotate(-45deg);
}

[dir="rtl"] .custom-select-wrap::after {
  transform: translateX(-6px) rotate(45deg);
}

[dir="ltr"] .custom-select-wrap::after {
  transform: translateX(6px) rotate(45deg);
}

/* Range Slider Styling */
.range-value-label {
  text-align: center;
  font-size: 12px;
  color: #888;
  margin-bottom: 10px;
}

.dual-range-control {
  position: relative;
  height: 42px;
  margin-top: 4px;
  direction: ltr;
  touch-action: none;
  --range-start: 0%;
  --range-end: 100%;
}

.dual-range-track {
  position: absolute;
  inset: 50% 11px auto 11px;
  height: 6px;
  transform: translateY(-50%);
  border-radius: 999px;
  pointer-events: none;
  background: linear-gradient(
    to right,
    #f0f0f0 0%,
    #f0f0f0 var(--range-start),
    #5b7136 var(--range-start),
    #5b7136 var(--range-end),
    #f0f0f0 var(--range-end),
    #f0f0f0 100%
  );
}

.dual-range-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 42px;
  margin: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}

.dual-range-input[data-range-role="min"] {
  z-index: 5;
}

.dual-range-input[data-range-role="max"] {
  z-index: 4;
}

.dual-range-input.is-active {
  z-index: 6 !important;
}

.dual-range-input:focus {
  outline: none;
}

.dual-range-input::-webkit-slider-runnable-track {
  width: 100%;
  height: 42px;
  background: transparent;
  border-radius: 3px;
  cursor: pointer;
}

.dual-range-input::-moz-range-track {
  width: 100%;
  height: 42px;
  background: transparent;
  border-radius: 3px;
  cursor: pointer;
}

.dual-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid #5b7136;
  cursor: grab;
  margin-top: -8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

.dual-range-input:active::-webkit-slider-thumb {
  cursor: grabbing;
}

.dual-range-input::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid #5b7136;
  cursor: grab;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  pointer-events: auto;
}

.dual-range-input:active::-moz-range-thumb {
  cursor: grabbing;
}

@supports (-moz-appearance: none) {
  .dual-range-input {
    pointer-events: auto;
  }
}

input[type="range"].green-range {
  --fill: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  outline: none;
  background: linear-gradient(
    to left,
    #5b7136 0%,
    #5b7136 var(--fill),
    #f0f0f0 var(--fill),
    #f0f0f0 100%
  );
}

[dir="ltr"] input[type="range"].green-range {
  background: linear-gradient(
    to right,
    #5b7136 0%,
    #5b7136 var(--fill),
    #f0f0f0 var(--fill),
    #f0f0f0 100%
  );
}

input[type="range"].green-range:focus {
  outline: none;
}

input[type="range"].green-range::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: transparent;
  border-radius: 3px;
}

input[type="range"].green-range::-webkit-slider-thumb {
  height: 22px;
  width: 22px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid #5b7136; /* Using the brand green from the image */
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* For Firefox */
input[type="range"].green-range::-moz-range-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: #f0f0f0;
  border-radius: 3px;
}
input[type="range"].green-range::-moz-range-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid #5b7136;
  cursor: pointer;
}

.btn-search-apply {
  background-color: #5b7136;
  color: #fff;
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: none;
  font-weight: 700;
  font-family: var(--tajawal);
  font-size: 16px;
  margin-top: 30px;
  transition: opacity 0.2s;
}

.btn-search-apply:hover {
  opacity: 0.9;
}

/* Search Filter Multiselect */
.custom-select-wrap .select2 {
  width: 100% !important;
}

.custom-select-wrap .select2-container--default .select2-selection--single {
  min-height: 56px;
  height: auto;
  border: 0;
  border-radius: 18px;
  background: #efefef;
  padding-block: 12px;
  padding-inline-start: 12px;
  padding-inline-end: 46px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.custom-select-wrap .select2-container--default .select2-selection--single .select2-selection__rendered {
  padding: 0;
  margin: 0;
  width: 100%;
  color: #4c4c4c;
  font-family: var(--tajawal);
  font-size: 14px;
  line-height: 1.2;
  text-align: start;
}

.custom-select-wrap .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #888;
}

.custom-select-wrap .select2-container--default .select2-selection--single .select2-selection__arrow {
  display: none;
}

.custom-select-wrap .select2-container--default .select2-selection--single::before,
.custom-select-wrap .select2-container--default .select2-selection--single::after {
  content: "";
  position: absolute;
  top: 27px;
  inset-inline-start: auto;
  inset-inline-end: 18px;
  width: 9px;
  height: 2px;
  border-radius: 999px;
  background: #a0a0a0;
  transform-origin: center;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.custom-select-wrap .select2-container--default .select2-selection--single::before {
  transform: rotate(45deg);
}

[dir="rtl"] .custom-select-wrap .select2-container--default .select2-selection--single::after {
  transform: translateX(-6px) rotate(-45deg);
}

[dir="ltr"] .custom-select-wrap .select2-container--default .select2-selection--single::after {
  transform: translateX(6px) rotate(-45deg);
}

.custom-select-wrap .select2-container--default.select2-container--focus .select2-selection--single,
.custom-select-wrap .select2-container--default.select2-container--open .select2-selection--single {
  background: #f7f7f7;
  box-shadow: inset 0 0 0 1px rgba(85, 107, 47, 0.28), 0 0 0 3px rgba(85, 107, 47, 0.08);
}

.custom-select-wrap .select2-container--open .select2-selection--single::before {
  transform: rotate(-45deg);
}

[dir="rtl"] .custom-select-wrap .select2-container--open .select2-selection--single::after {
  transform: translateX(-6px) rotate(45deg);
}

[dir="ltr"] .custom-select-wrap .select2-container--open .select2-selection--single::after {
  transform: translateX(6px) rotate(45deg);
}

.custom-select-wrap .select2-container--default .select2-selection--multiple {
  min-height: 56px;
  border: 0;
  border-radius: 18px;
  background: #efefef;
  padding-block: 12px;
  padding-inline-start: 12px;
  padding-inline-end: 46px;
  cursor: pointer;
  position: relative;
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.custom-select-wrap .select2-container--default.select2-container--focus .select2-selection--multiple,
.custom-select-wrap .select2-container--default.select2-container--open .select2-selection--multiple {
  background: #f7f7f7;
  box-shadow: inset 0 0 0 1px rgba(85, 107, 47, 0.28), 0 0 0 3px rgba(85, 107, 47, 0.08);
}

.custom-select-wrap .select2-container--default .select2-selection--multiple::before,
.custom-select-wrap .select2-container--default .select2-selection--multiple::after {
  content: "";
  position: absolute;
  top: 27px;
  inset-inline-start: auto;
  inset-inline-end: 18px;
  width: 9px;
  height: 2px;
  border-radius: 999px;
  background: #a0a0a0;
  transform-origin: center;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.custom-select-wrap .select2-container--default .select2-selection--multiple::before {
  transform: rotate(45deg);
}

[dir="rtl"] .custom-select-wrap .select2-container--default .select2-selection--multiple::after {
  transform: translateX(-6px) rotate(-45deg);
}

[dir="ltr"] .custom-select-wrap .select2-container--default .select2-selection--multiple::after {
  transform: translateX(6px) rotate(-45deg);
}

.custom-select-wrap .select2-container--open .select2-selection--multiple::before {
  transform: rotate(-45deg);
}

[dir="rtl"] .custom-select-wrap .select2-container--open .select2-selection--multiple::after {
  transform: translateX(-6px) rotate(45deg);
}

[dir="ltr"] .custom-select-wrap .select2-container--open .select2-selection--multiple::after {
  transform: translateX(6px) rotate(45deg);
}

.custom-select-wrap .select2-container--default .select2-selection--multiple .select2-selection__rendered {
  display: flex !important;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-start !important;
  gap: 0 !important;
  width: 100%;
  min-height: 32px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.custom-select-wrap .select2-container--default .select2-selection--multiple .select2-selection__choice {
  margin: 0;
  border: 0;
  border-radius: 10px;
  background: #ffffff;
  color: #4c4c4c;
  font-family: var(--tajawal);
  font-size: 14px;
  font-weight: 500;
  padding-block: 7px;
  padding-inline-start: 30px;
  padding-inline-end: 12px;
  position: relative;
  display: inline-flex !important;
  align-items: center;
  max-width: 100%;
  flex: 0 0 auto;
  float: none !important;
  clear: none !important;
  line-height: 1.2;
}

.custom-select-wrap .select2-container--default .select2-selection--multiple .select2-selection__choice + .select2-selection__choice {
  margin-inline-start: 6px !important;
}

.custom-select-wrap .select2-container--default .select2-selection--multiple .select2-search--inline {
  display: none;
  margin: 0 !important;
  float: none !important;
}

[dir="ltr"] .custom-select-wrap .select2-container--default .select2-selection--multiple .select2-selection__choice {
  padding-inline-start: 12px;
  padding-inline-end: 30px;
}

.custom-select-wrap .select2-container--default .select2-selection--multiple .select2-selection__choice__display {
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-select-wrap .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  position: absolute;
  inset-inline-start: 10px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  border: 0;
  color: #9c9c9c;
  font-size: 18px;
  line-height: 1;
  background: transparent;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

[dir="ltr"] .custom-select-wrap .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  inset-inline-start: auto;
  inset-inline-end: 10px;
}

.custom-select-wrap .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  color: #666;
  background: transparent;
}

.custom-select-wrap .select2-container .select2-search--inline .select2-search__field {
  display: none;
}

.custom-select-wrap .search-select2-container.is-empty .select2-selection--multiple::after {
  content: attr(data-placeholder);
  position: absolute;
  inset-inline-start: 12px;
  inset-inline-end: 46px;
  top: 50%;
  transform: translateY(-50%);
  color: #8b8b8b;
  font-family: var(--tajawal);
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
  text-align: start;
}

.select2-dropdown.search-select2-dropdown {
  border: 1px solid #ececec;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.08);
  z-index: 9999;
}

.select2-container--default .select2-search--dropdown {
  padding: 10px 12px 0;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  min-height: 40px;
  padding: 8px 12px;
  font-family: var(--tajawal);
}

.select2-results > .select2-results__options {
  max-height: 240px;
  padding: 8px 0;
}

.search-select2-dropdown .select2-results__option {
  padding: 0;
}

.search-select2-dropdown .select2-results__option--highlighted.select2-results__option--selectable,
.search-select2-dropdown .select2-results__option--selected {
  background: transparent;
  color: inherit;
}

.search-select2-dropdown .select2-results__option--highlighted[aria-selected],
.search-select2-dropdown .select2-results__option--highlighted[aria-selected="true"] {
  background: rgba(85, 107, 47, 0.08);
  color: inherit;
}

.search-select2-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  font-family: var(--tajawal);
  font-size: 14px;
  color: #383838;
}

.search-select2-option__checkbox {
  width: 18px;
  height: 18px;
  border: 1.5px solid #9a9a9a;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  flex-shrink: 0;
}

.search-select2-option__checkbox::after {
  content: "";
  width: 10px;
  height: 10px;
  background: #202020;
  border-radius: 2px;
  transform: scale(0);
  transition: transform 0.15s ease;
}

.search-select2-option.is-selected .search-select2-option__checkbox {
  border-color: var(--brand-green);
  background: var(--brand-green);
}

.search-select2-option.is-selected .search-select2-option__checkbox::after {
  transform: scale(1);
  background: #fff;
}

.search-select2-dropdown .select2-results__option--selected .search-select2-option__checkbox {
  border-color: var(--brand-green);
  background: var(--brand-green);
}

.search-select2-dropdown .select2-results__option--selected .search-select2-option__checkbox::after {
  transform: scale(1);
  background: #fff;
}

.search-select2-option__label {
  flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
  #search-map {
    height: 400px;
  }

  .filter-card {
    padding: 18px;
  }
}
