/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand-purple:      #120C40;
  --brand-lilac:       #E8E1F0;
  --brand-lilac-half:  #f3f0f6;
  --brand-green:       #4CAF82;
  --brand-font-headings: 'Figtree', sans-serif;
  --brand-font-body:     'Figtree', sans-serif;
  --bde-headings-color:  #120C40;
  --bde-button-padding-base: 0.75rem 1.5rem;
}

html { font-size: 16px; }

body {
  font-family: var(--brand-font-body);
  color: var(--brand-purple);
  background: #f7f5fb;
  min-height: 100vh;
}

a { color: var(--brand-purple); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--brand-font-headings);
  color: var(--bde-headings-color);
}

p { line-height: 1.6; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: white;
  border-bottom: 1px solid var(--brand-lilac);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 72px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-mark {
  width: 44px;
  height: 44px;
  background: var(--brand-purple);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-mark span {
  color: white;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .05em;
}

.logo-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-purple);
  line-height: 1.3;
}

.logo-text small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  opacity: .6;
}

/* ============================================================
   HERO / SEARCH SECTION
   ============================================================ */
.hero {
  background: var(--brand-purple);
  padding: 3rem 1.5rem 2.5rem;
}

.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.hero h1 {
  color: white;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  margin-bottom: .5rem;
}

.hero p {
  color: rgba(255,255,255,.75);
  font-size: 1rem;
  margin-bottom: 1.75rem;
  max-width: 600px;
}

/* ============================================================
   SEARCH FORM
   ============================================================ */
#fab-search-form { text-align: left; }
#fab-search-form > div { padding-top: .75rem; padding-bottom: .75rem; }

.location-search-wrapper { position: relative; }

.location-search-wrapper > i.fa-search,
.location-search-wrapper > #fab-geolocation {
  z-index: 1;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
}

.location-search-wrapper > i.fa-search {
  left: .875rem;
  color: var(--brand-purple);
  pointer-events: none;
}

.location-search-wrapper > #fab-geolocation {
  right: .75rem;
  cursor: pointer;
  color: #767676;
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  font-size: 1rem;
}

.location-search-wrapper > #fab-geolocation:hover { color: var(--brand-purple); }

#fab-geolocation-blurb { font-size: .875rem; display: none; }

@media (min-width: 768px) { #fab-geolocation-blurb { display: inline; } }

input.location-search {
  width: 100%;
  padding: .875rem 10rem .875rem 2.75rem;
  border: none;
  font-size: 1.125rem;
  color: var(--brand-purple);
  background: white;
  font-family: var(--brand-font-body);
  outline: none;
}

input.location-search::placeholder { color: #9587b5; }

#fab-autocomplete-results {
  position: absolute;
  top: calc(100% + 2px);
  background: white;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  width: 100%;
  z-index: 100;
  max-height: 15rem;
  overflow-y: auto;
  display: none;
  border-top: 1px solid var(--brand-lilac);
}

#fab-autocomplete-results button {
  border: none;
  width: 100%;
  padding: .625rem 1rem;
  cursor: pointer;
  font-size: 1rem;
  text-align: left;
  background: white;
  color: var(--brand-purple);
  font-family: var(--brand-font-body);
  display: flex;
  align-items: center;
  gap: .5rem;
}

#fab-autocomplete-results button i {
  background: var(--brand-lilac);
  padding: .375rem .5rem;
  font-size: .875rem;
  flex-shrink: 0;
}

#fab-autocomplete-results button:hover,
#fab-autocomplete-results button:focus {
  background: #EAE3F0;
  outline: none;
}

.buttons-wrapper { display: flex; gap: .75rem; }

#fab-search-form button {
  border: none;
  width: 100%;
  font-size: 1.125rem;
  padding: var(--bde-button-padding-base);
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--brand-font-body);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

#fab-search-form button.button-primary { color: white; background: var(--brand-purple); }
#fab-search-form button.button-primary:hover { opacity: .9; }
#fab-search-form button.button-primary:disabled { opacity: .45; cursor: not-allowed; }

#fab-search-form button.button-secondary {
  color: var(--brand-purple);
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.4);
}

#fab-search-form button.button-secondary:hover { background: white; }

#filter-count {
  display: none;
  background: var(--brand-green);
  color: var(--brand-purple);
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50px;
  font-size: .75rem;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   FILTERS MODAL
   ============================================================ */
#filters-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
}

#filters-modal.open { display: flex; align-items: flex-end; justify-content: center; }

@media (min-width: 640px) { #filters-modal.open { align-items: center; } }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18,12,64,.25);
}

.modal-panel {
  position: relative;
  background: white;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 92svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}

@media (min-width: 640px) { .modal-panel { border-radius: 16px; max-height: 88vh; } }

.modal-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--brand-lilac);
  position: relative;
}

.modal-header .subheading {
  font-family: var(--brand-font-headings);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--brand-purple);
}

.modal-header p { margin: .25rem 0 0; font-size: .875rem; color: #666; }

.close-modal {
  position: absolute !important;
  top: .75rem !important;
  right: .75rem !important;
  background: transparent !important;
  border: none !important;
  width: auto !important;
  padding: .25rem !important;
  cursor: pointer !important;
  font-size: 0 !important;
  color: var(--brand-purple) !important;
}

.close-modal i { font-size: 1.5rem !important; }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 1.25rem;
  border-top: 1px solid var(--brand-lilac);
}

.modal-footer {
  height: 4rem;
  padding: 0 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--brand-lilac);
}

#filters-modal fieldset {
  border: none;
  border-bottom: 1px solid var(--brand-lilac);
  position: relative;
  padding-bottom: 1rem;
}

#filters-modal fieldset:last-child { border-bottom: none; }

#filters-modal fieldset legend {
  font-size: 1.125rem;
  font-weight: 600;
  padding: 1rem 0 .5rem;
  color: var(--brand-purple);
  display: block;
  width: 100%;
}

#filters-modal fieldset p { margin: 0 0 .5rem; font-size: .875rem; color: #666; }

#filters-modal fieldset.has-checkboxes {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

#filters-modal fieldset.has-checkboxes legend { width: 100%; flex: 0 0 100%; }

#filters-modal fieldset.has-radios {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

#filters-modal fieldset.has-radios legend { width: 100%; flex: 0 0 100%; }

#filters-modal label.check-label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .7rem;
  border: 1px solid rgba(18,12,64,.25);
  color: var(--brand-purple);
  font-size: .875rem;
  user-select: none;
  -webkit-user-select: none;
}

#filters-modal label.check-label:hover { border-color: var(--brand-purple); }
#filters-modal label.check-label.checked { color: white; background: var(--brand-purple); border-color: var(--brand-purple); }
#filters-modal label.check-label.checked i { color: white; }
#filters-modal label.check-label i { color: var(--brand-purple); font-size: 1rem; }

#filters-modal label.radio-label {
  cursor: pointer;
  display: block;
  flex: 1;
  min-width: 80px;
  padding: .75rem 1rem;
  border: 1px solid var(--brand-purple);
  text-align: center;
  font-size: .9rem;
  user-select: none;
  -webkit-user-select: none;
  margin-left: -1px;
}

#filters-modal label.radio-label:first-of-type { margin-left: 0; border-radius: 0; }
#filters-modal label.radio-label:hover { background: var(--brand-lilac-half); }
#filters-modal label.radio-label.checked { background: var(--brand-lilac); }

label.single-checkbox {
  width: 100%;
  cursor: pointer;
  display: block;
  position: relative;
  padding: .8rem .8rem .8rem 2.8rem;
  border: 1px solid var(--brand-purple);
  color: var(--brand-purple);
  font-size: .9rem;
  user-select: none;
  -webkit-user-select: none;
  margin-top: .5rem;
}

label.single-checkbox::before {
  display: block;
  font-family: "Font Awesome 6 Free";
  font-weight: 400;
  content: "\f111";
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
}

label.single-checkbox.checked::before { font-weight: 900; content: "\f058"; }

/* Range slider */
.range-wrap { position: relative; padding-top: 2rem; margin-bottom: .5rem; }

input[type=range] {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border-radius: 100px;
  height: 24px;
  overflow: hidden;
}

input[type=range]::-webkit-slider-runnable-track {
  background: #EFEFEF;
  height: 8px;
  border-radius: 100px;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  background: var(--brand-purple);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  position: relative;
  top: 50%;
  translate: 0 -50%;
  cursor: grab;
  box-shadow: calc(-100vmax - 24px) 0 0 100vmax var(--brand-lilac);
  clip-path: polygon(100% -1px, 0.125rem -1px, 0 7.5px, -100vmax 7.5px, -100vmax 16.5px, 0 16.5px, 0.125rem 100%, calc(100% + 1px) calc(100% + 1px));
}

input[type=range]::-moz-range-track { background: #EFEFEF; height: 8px; border-radius: 100px; }
input[type=range]::-moz-range-thumb {
  background: var(--brand-purple);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: grab;
}
input[type=range]::-moz-range-progress { background: var(--brand-lilac); height: 8px; border-radius: 100px; }

output.dist-label {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: .875rem;
  font-weight: 600;
  color: var(--brand-purple);
  opacity: .6;
  white-space: nowrap;
}

/* Select */
select.modal-select {
  width: 100%;
  border: 1px solid rgba(18,12,64,.5);
  line-height: 140%;
  padding: .5rem 2.4rem .5rem .8rem;
  font-family: var(--brand-font-body);
  font-size: 1rem;
  color: var(--brand-purple);
  background: transparent url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NDAgNjQwIj48cGF0aCBmaWxsPSIjMTIwQzQwIiBkPSJNMzM3LjUgNDMzQzMyOC4xIDQ0Mi40IDMxMi45IDQ0Mi40IDMwMy42IDQzM0wxNDMuNSAyNzNDMTM0LjEgMjYzLjYgMTM0LjEgMjQ4LjQgMTQzLjUgMjM5LjFDMTUyLjkgMjI5LjggMTY4LjEgMjI5LjcgMTc3LjQgMjM5LjFMMzIwLjQgMzgyLjFMNDYzLjQgMjM5LjFDNDcyLjggMjI5LjcgNDg4IDIyOS43IDQ5Ny4zIDIzOS4xQzUwNi42IDI0OC41IDUwNi43IDI2My43IDQ5Ny4zIDI3M0wzMzcuMyA0MzN6Ii8+PC9zdmc+") no-repeat right .8rem center / 14px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  border-radius: 0;
  margin-top: .25rem;
}

select.modal-select:focus { outline: 2px solid var(--brand-purple); }
select.modal-select.empty { color: rgba(18,12,64,.35); }

input.modal-text {
  width: 100%;
  border: 1px solid rgba(18,12,64,.5);
  padding: .5rem .8rem;
  font-family: var(--brand-font-body);
  font-size: 1rem;
  color: var(--brand-purple);
  border-radius: 0;
  margin-top: .25rem;
}

input.modal-text::placeholder { color: rgba(18,12,64,.35); }
input.modal-text:focus { outline: 2px solid var(--brand-purple); }

.modal-footer button {
  border: none;
  cursor: pointer;
  font-family: var(--brand-font-body);
  font-size: .9rem;
  padding: .6rem 1.25rem;
}

button#fab-clear-filters { background: transparent; color: rgba(18,12,64,.5); }
button#fab-clear-filters:hover { color: var(--brand-purple); }

button.modal-apply { background: var(--brand-purple); color: white; font-weight: 500; }
button.modal-apply:hover { opacity: .9; }

/* ============================================================
   RESULTS AREA
   ============================================================ */
.results-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.results-header h2 { font-size: 1.5rem; }
.results-summary { font-size: .9rem; color: #666; margin-top: .25rem; }

#fab-active-filters-display {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.active-filter {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(18,12,64,.07);
  color: var(--brand-purple);
  border-radius: 50px;
  padding: 4px 12px;
  font-size: .875rem;
  cursor: pointer;
  border: none;
  font-family: var(--brand-font-body);
}

.active-filter:hover { background: rgba(18,12,64,.13); }
.active-filter i { color: rgba(18,12,64,.5); font-size: .75rem; }
.active-filter i:hover { color: var(--brand-purple); }

.view-toggles { display: flex; gap: 0; }

.view-toggles button {
  border: 1px solid var(--brand-purple);
  font-size: 1rem;
  padding: .5rem 1rem;
  cursor: pointer;
  color: var(--brand-purple);
  background: white;
  font-family: var(--brand-font-body);
  display: flex;
  align-items: center;
  gap: .4rem;
}

.view-toggles button:first-child { border-right: none; }
.view-toggles button.button-active { color: white; background: var(--brand-purple); cursor: default; }

/* Broker cards grid */
#fab-results-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 640px) { #fab-results-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { #fab-results-cards { grid-template-columns: repeat(3, 1fr); } }

.broker-tile {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  background: white;
  border: 1px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  text-decoration: none;
  transition: border-color .2s;
  cursor: pointer;
}

.broker-tile:hover { border-color: var(--brand-purple); text-decoration: none; }

.broker-image {
  border: 1px solid #CCC;
  border-radius: 50%;
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  overflow: hidden;
  background: var(--brand-lilac);
  display: flex;
  align-items: center;
  justify-content: center;
}

.broker-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.broker-image i { color: var(--brand-purple); font-size: 1.5rem; }

.broker-details { flex: 1; min-width: 0; }

.broker-name {
  color: var(--bde-headings-color);
  font-family: var(--brand-font-headings);
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 .25rem;
}

.broker-company {
  font-size: .875rem;
  color: #666;
  margin: 0 0 .5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.broker-location {
  font-size: .8rem;
  color: #888;
  margin: 0 0 .35rem;
}

.broker-services-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin-top: .5rem;
}

.service-tag {
  display: inline-block;
  background: var(--brand-lilac-half);
  color: var(--brand-purple);
  font-size: .75rem;
  padding: 2px 8px;
  border-radius: 3px;
}

.broker-distance {
  display: inline-block;
  background: rgba(18,12,64,.07);
  border-radius: 50px;
  padding: 3px 10px;
  font-size: .8rem;
  margin-top: .5rem;
}

.broker-accredited {
  display: inline-block;
  background: var(--brand-green);
  color: white;
  border-radius: 3px;
  padding: 2px 8px;
  font-size: .75rem;
  font-weight: 600;
  margin-top: .35rem;
}

.broker-quals { flex: 0 0 48px; }

#fab-load-more {
  display: block;
  width: 100%;
  margin-top: 2rem;
  padding: .875rem;
  border: none;
  background: var(--brand-lilac-half);
  color: var(--brand-purple);
  font-family: var(--brand-font-body);
  font-size: 1.125rem;
  cursor: pointer;
  text-align: center;
}

#fab-load-more:hover { background: var(--brand-lilac); }

#fab-results-empty {
  display: none;
  padding: 3rem 2rem 6rem;
  text-align: center;
}

#fab-results-empty h3 { font-size: 1.5rem; margin-bottom: .75rem; }
#fab-results-empty p { color: #666; }

#fab-results-map {
  width: 100%;
  height: 60vh;
  min-height: 400px;
  background: var(--brand-lilac-half);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  color: var(--brand-purple);
  font-size: 1.125rem;
  border: 1px solid var(--brand-lilac);
}

#fab-results-map.visible { display: flex; }
#fab-results-map i { font-size: 3rem; opacity: .3; }

/* ============================================================
   CONTENT SECTIONS
   ============================================================ */
.content-section { background: white; padding: 3rem 1.5rem; }
.content-inner { max-width: 1200px; margin: 0 auto; }

.section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

@media (min-width: 768px) { .section-grid { grid-template-columns: repeat(3, 1fr); } }

.info-card { border: 1px solid var(--brand-lilac); padding: 1.5rem; }
.info-card h3 { font-size: 1.125rem; margin-bottom: .75rem; }
.info-card p { font-size: .9rem; color: #555; margin-bottom: 1rem; }

.btn-outline {
  display: inline-block;
  border: 1px solid var(--brand-purple);
  color: var(--brand-purple);
  padding: .5rem 1rem;
  font-size: .875rem;
  font-weight: 500;
  font-family: var(--brand-font-body);
  cursor: pointer;
  text-decoration: none;
  background: transparent;
}

.btn-outline:hover { background: var(--brand-purple); color: white; text-decoration: none; }

/* FAQ */
.faq-section { padding: 3rem 1.5rem; background: var(--brand-lilac-half); }
.faq-inner { max-width: 800px; margin: 0 auto; }
.faq-inner h2 { font-size: 1.75rem; margin-bottom: 1.5rem; }

.faq-item { border-bottom: 1px solid var(--brand-lilac); }

.faq-question {
  width: 100%;
  background: none;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.125rem 0;
  cursor: pointer;
  font-family: var(--brand-font-headings);
  font-size: 1rem;
  font-weight: 600;
  color: var(--brand-purple);
  text-align: left;
}

.faq-question i { flex-shrink: 0; transition: transform .25s; font-size: .875rem; }
.faq-question[aria-expanded="true"] i { transform: rotate(45deg); }

.faq-answer { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.faq-answer-inner { padding: 0 0 1.25rem; font-size: .9375rem; color: #444; line-height: 1.7; }

/* Footer */
.site-footer {
  background: var(--brand-purple);
  color: rgba(255,255,255,.7);
  padding: 2rem 1.5rem;
  font-size: .875rem;
  text-align: center;
}

.site-footer a { color: rgba(255,255,255,.7); }
.site-footer a:hover { color: white; }

/* Utility */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border-width: 0; }

#results-section { display: none; }
#results-section.visible { display: block; }

.loading-msg {
  padding: 3rem 2rem;
  text-align: center;
  font-size: 1.125rem;
  color: #666;
}

.loading-msg i { display: block; font-size: 2.5rem; margin-bottom: 1rem; color: var(--brand-purple); opacity: .4; }

/* Error message */
.error-msg {
  padding: 2rem;
  text-align: center;
  background: #fff5f5;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* Broker tile — arrow + anchor reset */
a.broker-tile { color: inherit; }
a.broker-tile:hover { text-decoration: none; }

.broker-tile-arrow {
  display: flex;
  align-items: center;
  align-self: center;
  color: var(--brand-purple);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  flex-shrink: 0;
}
.broker-tile:hover .broker-tile-arrow { opacity: 1; transform: translateX(3px); }

/* Input error highlight */
.input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,.2) !important;
  animation: shake .3s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* btn-primary shared */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--brand-purple);
  color: #fff;
  padding: .7rem 1.4rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: .9rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.btn-primary:hover { background: #0d0828; color: #fff; text-decoration: none; }
