/* ==========================================================================
   Direct Homes – Hero search bar + Advanced Search modal
   Colors/fonts come from css/directhomes-theme.css (--dh-* variables).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Search bar – one line on large screens, wraps with flex on smaller ones
   -------------------------------------------------------------------------- */
.parallax-searchs .rld-main-search.dh-search {
  height: auto;
  padding: 20px;
  margin: 0;
  text-align: left;
}

.dh-search-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 12px;
}

.dh-search-bar .dh-search-field {
  flex: 1 1 0;
  min-width: 0;
  margin: 0 !important;
}

.dh-search-bar .dh-search-field--keyword {
  flex-grow: 1.4;
}

.dh-search-bar .dh-search-field--auto {
  flex: 0 0 auto;
}

/* Inputs and selects fill their flex cell */
.dh-search-bar .rld-single-input input,
.dh-search-bar .rld-single-select .single-select,
.dh-search-bar .rld-single-select .nice-select {
  width: 100% !important;
  height: 52px;
  margin: 0 !important;
  line-height: 50px;
  border: 1px solid var(--dh-sand) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  font-family: var(--dh-font-body);
  font-size: 15px;
}

.dh-search-bar .rld-single-input input {
  padding: 0 18px;
  color: var(--dh-primary);
}

.dh-search-bar .rld-single-input input:focus,
.dh-search-bar .nice-select:focus,
.dh-search-bar .nice-select.open {
  border-color: var(--dh-primary) !important;
  outline: none;
}

/* Advanced Search button */
.dh-advanced-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 20px;
  border: 1px solid var(--dh-sand);
  border-radius: 10px;
  background: #fff;
  color: var(--dh-primary);
  font-family: var(--dh-font-body);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.dh-advanced-btn:hover,
.dh-advanced-btn:focus {
  border-color: var(--dh-primary);
  background: var(--dh-bg);
  outline: none;
}

.dh-advanced-btn svg circle {
  fill: #fff;
}

/* Small badge with the number of active filters */
.dh-advanced-count:empty {
  display: none;
}

.dh-advanced-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--dh-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 22px;
  text-align: center;
}

/* Search Now button */
.parallax-searchs .dh-search-bar .btn.dh-search-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: auto;
  height: 52px;
  margin: 0 !important;
  padding: 0 26px;
  border-radius: 40px;
  font-family: var(--dh-font-body);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 1199px) {
  .dh-search-bar {
    flex-wrap: wrap;
  }

  .dh-search-bar .dh-search-field {
    flex: 1 1 calc(33.333% - 8px);
  }

  .dh-search-bar .dh-search-field--auto {
    flex: 1 1 calc(50% - 6px);
  }
}

@media (max-width: 767px) {
  .parallax-searchs .rld-main-search.dh-search {
    padding: 14px;
  }

  .dh-search-bar .dh-search-field,
  .dh-search-bar .dh-search-field--auto {
    flex: 1 1 100%;
  }
}

/* --------------------------------------------------------------------------
   2. Advanced Search modal (Bootstrap 4 modal)
   -------------------------------------------------------------------------- */
.dh-filter-modal .modal-content {
  border: 0;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(var(--dh-primary-rgb), 0.25);
  font-family: var(--dh-font-body);
  overflow: hidden;
}

/* Bootstrap's ".modal-dialog-scrollable" expects header/body/footer to be
   direct flex children of .modal-content. Our <form> sits in between, so it
   has to pass the flex layout on – otherwise the modal grows instead of
   scrolling and the footer gets cut off. */
.dh-filter-modal .modal-dialog-scrollable .modal-content {
  max-height: calc(100vh - 3.5rem);
}

.dh-filter-modal .modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.dh-filter-modal .modal-header,
.dh-filter-modal .modal-footer {
  flex-shrink: 0;
}

.dh-filter-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Slim scrollbar inside the modal body */
.dh-filter-modal .modal-body::-webkit-scrollbar {
  width: 8px;
}

.dh-filter-modal .modal-body::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(var(--dh-primary-rgb), 0.25);
}

@media (max-width: 575px) {
  .dh-filter-modal .modal-dialog-scrollable .modal-content {
    max-height: calc(100vh - 1rem);
  }
}

.dh-filter-modal .modal-header {
  align-items: flex-start;
  padding: 28px 32px 18px;
  border-bottom: 1px solid var(--dh-sand);
}

.dh-filter-modal .modal-title {
  margin: 0;
  font-family: var(--dh-font-heading);
  font-size: 26px;
  font-weight: 600;
  color: var(--dh-primary);
  text-transform: none;
}

.dh-filter-modal__sub {
  margin: 4px 0 0;
  font-size: 14px;
  color: #666;
}

.dh-filter-modal .dh-filter-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--dh-sand);
  border-radius: 50%;
  color: var(--dh-primary);
  opacity: 1;
  text-shadow: none;
  transition: background-color 0.2s ease;
}

.dh-filter-modal .dh-filter-modal__close:hover {
  background: var(--dh-bg);
  opacity: 1;
}

.dh-filter-modal .modal-body {
  padding: 24px 32px 8px;
}

.dh-filter-group {
  min-width: 0;
  margin: 0 0 26px;
  padding-top: 0;
  border: 0;
}

.dh-filter-label {
  display: block;
  width: auto;
  margin-bottom: 12px;
  font-family: var(--dh-font-heading);
  font-size: 18px;
  font-weight: 600;
  color: var(--dh-primary);
}

/* Checkboxes (Bootstrap custom-checkbox, recolored) */
.dh-check.custom-control {
  min-height: 22px;
  margin-bottom: 12px;
  padding-left: 32px;
}

/* hide the native box */
.dh-check .custom-control-input {
  position: absolute;
  left: 0;
  z-index: -1;
  width: 20px;
  height: 20px;
  margin: 0;
  opacity: 0;
}

.dh-check .custom-control-label {
  display: inline-block;
  margin: 0;
  font-size: 15px;
  line-height: 22px;
  color: #333;
  cursor: pointer;
}

.dh-check .custom-control-label::before {
  position: absolute;
  top: 1px;
  left: -32px;
  width: 20px;
  height: 20px;
}

.dh-check .custom-control-label::before {
  border: 1.5px solid #bfb8a8;
  border-radius: 5px;
  background: #fff;
}

.dh-check .custom-control-input:checked ~ .custom-control-label::before {
  border-color: var(--dh-primary);
  background-color: var(--dh-primary);
}

/* Own white tick (drawn with borders, no icon font / image needed) */
.dh-check .custom-control-label {
  position: relative;
}

.dh-check .custom-control-label::after {
  content: "";
  position: absolute !important;
  display: block;
  top: 4px !important;
  left: -25px !important;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  background: none !important;
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.dh-check .custom-control-input:checked ~ .custom-control-label::after {
  opacity: 1;
}

.dh-check .custom-control-input:focus ~ .custom-control-label::before {
  box-shadow: 0 0 0 3px rgba(var(--dh-primary-rgb), 0.18);
}

.dh-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
}

/* Min – Max fields */
.dh-range {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.dh-range__field {
  flex: 1 1 0;
}

.dh-range__field label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: #666;
}

.dh-range__field .form-control {
  height: 48px;
  border: 1px solid var(--dh-sand);
  border-radius: 10px;
  font-size: 15px;
  color: var(--dh-primary);
}

.dh-range__field .form-control:focus {
  border-color: var(--dh-primary);
  box-shadow: 0 0 0 3px rgba(var(--dh-primary-rgb), 0.12);
}

.dh-range__sep {
  padding-bottom: 12px;
  color: #999;
}

.dh-filter-modal .modal-footer {
  justify-content: space-between;
  padding: 16px 32px 24px;
  border-top: 1px solid var(--dh-sand);
}

.dh-btn-text {
  padding: 0;
  border: 0;
  background: none;
  color: var(--dh-primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.dh-btn-primary {
  height: 48px;
  padding: 0 26px;
  border: 0;
  border-radius: 10px;
  background: var(--dh-primary);
  color: #fff;
  font-weight: 600;
}

.dh-btn-primary:hover,
.dh-btn-primary:focus {
  background: var(--dh-primary);
  color: #fff;
  opacity: 0.9;
}

.dh-filter-modal.modal {
  z-index: 100050;
}

.modal-backdrop {
  z-index: 100040;
}

/* Modal backdrop in a light brand green */
.modal-backdrop.show {
  background-color: var(--dh-primary);
  opacity: 0.28;
}

@media (max-width: 575px) {
  .dh-filter-modal .modal-header,
  .dh-filter-modal .modal-body,
  .dh-filter-modal .modal-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .dh-check-grid {
    grid-template-columns: 1fr;
  }
}

/* Text under the hero heading */
#hero-area .welcome-text p.dh-hero-lead {
  max-width: 720px;
  margin-right: auto;
  margin-left: auto;
  font-family: var(--dh-font-body);
  font-size: clamp(15px, calc(14px + 0.35vw), 19px);
  line-height: 1.6;
  color: #fff;
  text-transform: none;
  opacity: 0.92;
}

/* --------------------------------------------------------------------------
   Hero overlay – all screen sizes
   Extra black layer on the photo for better text readability.
   Change --dh-hero-overlay to make it lighter or darker.
   -------------------------------------------------------------------------- */
#hero-area.parallax-searchs {
  --dh-hero-overlay: rgba(0, 0, 0, 0.28);
  position: relative;
}

#hero-area.parallax-searchs::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--dh-hero-overlay);
  pointer-events: none;
}

#hero-area .hero-main {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Hero size + position – only on screens up to 1600px wide
   - full screen height (100vh), grows only if the content needs more room
   - content centred vertically, inner container keeps its normal width
   - the top padding keeps the content clear of the transparent header

   -------------------------------------------------------------------------- */
@media (max-width: 1600px) {
  #hero-area.parallax-searchs {
    display: flex;
    height: auto;
    min-height: 100vh;
    min-height: 100svh;   /* mobile: ignores the browser toolbar */
  }

  #hero-area .hero-main {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 100%;
    padding: clamp(110px, 13vh, 150px) 0 clamp(40px, 7vh, 80px);
  }

  #hero-area .hero-main > .container {
    width: 100%;
  }

  #hero-area .hero-inner {
    margin: 0 !important;
    padding: 0 !important;
  }
}

.parallax-searchs .rld-main-search.dh-search {
  -webkit-box-shadow: none;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   Search modal: keyword, type and location on top (components/search-modal.php)
   -------------------------------------------------------------------------- */
.dh-filter-main {
  display: grid;
  grid-template-columns: 1fr 1fr;   /* keyword full width, type + location 50 / 50 below */
  gap: 16px 12px;
  margin-bottom: 26px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--dh-sand);
}

.dh-filter-main__field--keyword {
  grid-column: 1 / -1;
}

.dh-filter-main__field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dh-filter-main__field label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a8a8a;
}

.dh-filter-main .form-control {
  height: 50px;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 48px;
  border: 1px solid var(--dh-sand);
  border-radius: 12px;
  background-color: #fff;
  font-size: 15px;
  color: #333;
  box-shadow: none;
}

.dh-filter-main .form-control:focus {
  border-color: var(--dh-primary);
  box-shadow: 0 0 0 3px rgba(var(--dh-primary-rgb), 0.1);
}

.dh-filter-main__field--keyword .form-control {
  padding-left: 44px;
}

.dh-filter-main__icon svg {
  display: block;
  fill: none;
}

.dh-filter-main__control {
  position: relative;
}

.dh-filter-main__icon {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  display: inline-flex;
  color: var(--dh-accent);
  pointer-events: none;
}

.dh-filter-modal .modal-footer .dh-btn svg {
  margin-right: 6px;
}

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

/* --------------------------------------------------------------------------
   Filter modal: gold (secondary) for checked, hover and focus states
   -------------------------------------------------------------------------- */
.dh-filter-modal {
  accent-color: var(--dh-accent);
}

.dh-check .custom-control-label:hover::before {
  border-color: var(--dh-accent);
}

.dh-check .custom-control-input:checked ~ .custom-control-label::before {
  border-color: var(--dh-accent);
  background-color: var(--dh-accent);
}

.dh-check .custom-control-input:focus ~ .custom-control-label::before {
  border-color: var(--dh-accent);
  box-shadow: 0 0 0 3px rgba(var(--dh-accent-rgb), 0.2);
}

.dh-filter-modal .form-control:hover {
  border-color: rgba(var(--dh-accent-rgb), 0.6);
}

.dh-filter-modal .form-control:focus,
.dh-filter-main .form-control:focus,
.dh-range__field .form-control:focus {
  border-color: var(--dh-accent);
  box-shadow: 0 0 0 3px rgba(var(--dh-accent-rgb), 0.15);
  outline: 0;
}

/* dropdown list: selected / hovered option in gold */
.dh-filter-modal select option:checked,
.dh-filter-modal select option:hover,
.dh-filter-modal select option:focus {
  background: var(--dh-accent) linear-gradient(var(--dh-accent), var(--dh-accent));
  color: #fff;
}

/* --------------------------------------------------------------------------
   Filter modal – small screen fixes
   -------------------------------------------------------------------------- */
/* close button keeps its size */
.dh-filter-modal .dh-filter-modal__close {
  flex: 0 0 38px;
  min-width: 38px;
  min-height: 38px;
}

/* nice-select dropdown as wide as its field */
.dh-filter-modal .nice-select {
  width: 100%;
  float: none;
}

.dh-filter-modal .nice-select .list {
  right: 0;
  left: 0;
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  border-radius: 12px;
}

/* "Clear all" and "Show properties" on one line, compact button */
.dh-filter-modal .modal-footer {
  flex-wrap: nowrap;
  gap: 16px;
}

.dh-filter-modal .modal-footer > * {
  margin: 0;
}

.dh-filter-modal .modal-footer .dh-btn {
  flex: 0 0 auto;
  height: 46px;
  padding: 0 20px;
  white-space: nowrap;
}

/* small screens: rooms / bathrooms side by side instead of one per line */
@media (max-width: 767px) {
  .dh-filter-modal fieldset.dh-filter-group > .dh-check.custom-control {
    display: inline-flex;
    margin-right: 22px;
  }

  .dh-check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
  }
}

@media (max-width: 399px) {
  .dh-check-grid {
    grid-template-columns: 1fr;
  }

  .dh-filter-modal .modal-footer .dh-btn {
    padding: 0 16px;
    font-size: 15px;
  }
}
