/********************************************
 SERVICE AREA PAGE — STRICTLY SCOPED STYLES
********************************************/

.service-area-page { 
    position: relative;
    z-index: 0;
}

/* -----------------------------
   SEARCH BAR — CENTERED + EXPANDABLE
------------------------------*/

.service-area-page .sa-search-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 50px;
  width: 100%;
}

.service-area-page .sa-search-row {
  display: flex;
  gap: 25px;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  max-width: 900px;
}

/* Input group MUST be positioned for dropdown */
.service-area-page .sa-input-group {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  width: 100%;
  max-width: none;
  position: relative; /* REQUIRED */
}

.service-area-page .sa-search-heading {
  margin-bottom: 6px;
  font-weight: 600;
  color: #333;
  text-align: left;
}

.service-area-page #sa-location-search {
  width: 100%;
  background-color: #f0f4f8;
  border: 2px solid #3b6ea5;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 1rem;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.2s ease-in-out;
}

.service-area-page #sa-location-search:focus {
  outline: none;
  border-color: #2a4f7c;
  box-shadow: 0 0 0 3px rgba(58, 112, 180, 0.3);
  background-color: #e9f1fb;
}

/* -----------------------------
   AUTOCOMPLETE DROPDOWN (FIXED)
------------------------------*/

.service-area-page #sa-search-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e1e1e1;
  border-radius: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: none; /* JS toggles this */
  z-index: 999999; /* ABOVE MAP */
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.service-area-page #sa-search-suggestions li {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 15px;
}

.service-area-page #sa-search-suggestions li:hover {
  background: var(--theme-color2);
  color: #fff;
}

/* -----------------------------
   USE MY LOCATION BUTTON
------------------------------*/

.service-area-page #sa-find-my-location {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  min-width: 160px;
  font-size: 1rem;
  font-weight: 500;
  background-color: #3b6ea5;
  color: #fff;
  border: none;
  border-radius: 6px;
  flex-shrink: 0;
  flex: 0 0 auto;
  transition: background-color 0.2s ease-in-out;
}

.service-area-page #sa-find-my-location:hover {
  background-color: #2a4f7c;
}

.service-area-page #sa-find-my-location i {
  font-size: 1rem;
}

/* -----------------------------
   MAP CONTAINER
------------------------------*/

.service-area-page .sa-map-container {
  position: relative;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  transform-origin: center center;
  transition: transform 0.35s ease;
  z-index: 1;
}

.service-area-page .sa-map-container.sa-zoomed {
  transform: scale(1.04);
}

.service-area-page .sa-service-map {
  width: 100%;
  height: auto;
  display: block;
  position: relative;
  z-index: 1;
}

/* -----------------------------
   PINS
------------------------------*/

.service-area-page .sa-pins-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.service-area-page .sa-pin {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--theme-color2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  animation: saPinFade 0.35s ease forwards;
  z-index: 6;
}

@keyframes saPinFade {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.service-area-page .sa-pin.sa-pulse {
  animation: saPinPulse 1.6s ease-out infinite;
}

@keyframes saPinPulse {
  0%   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  70%  { transform: translate(-50%, -50%) scale(1.25); opacity: 0.45; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Tooltip */
.service-area-page .sa-pin:hover::after {
  content: attr(data-town);
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--theme-color2);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
}

/* -----------------------------
   DIM OVERLAY
------------------------------*/

#map-dim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 999998;
}

#map-dim.sa-active {
  opacity: 1;
  pointer-events: all;
}

/* -----------------------------
   MODAL
------------------------------*/

#sa-location-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999999;
}

.service-area-page .sa-modal-content {
  background: #fff;
  padding: 24px;
  border-radius: 8px;
  width: 90%;
  max-width: 420px;
  box-shadow: var(--box-shadow);
}

.service-area-page .sa-modal-close {
  cursor: pointer;
  font-size: 22px;
  float: right;
  background: none;
  border: none;
  color: var(--color-dark);
}

/* Modal text */
#sa-modal-town-name {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--theme-color2);
}

#sa-modal-service-status {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

#sa-modal-distance {
  font-size: 14px;
  margin-bottom: 10px;
  color: #555;
}

#sa-modal-notes {
  font-size: 14px;
  color: #333;
}

/* -----------------------------
   RESPONSIVE
------------------------------*/

@media (max-width: 767px) {

  .service-area-page .sa-search-row {
    flex-direction: column;
    align-items: center;
  }

  .service-area-page #sa-find-my-location {
    width: 100%;
    max-width: 500px;
  }

  .service-area-page .sa-input-group {
    width: 100%;
    max-width: 500px;
  }

  .service-area-page .sa-map-container {
    height: auto;
  }

  .service-area-page .sa-modal-content {
    padding: 18px;
  }

  #sa-modal-town-name {
    font-size: 20px;
  }

  .service-area-page .sa-pin {
    width: 12px;
    height: 12px;
  }
}

/* -----------------------------
   PIN BOUNCE ANIMATION (NEW)
------------------------------*/

@keyframes saBounce {
  0%   { transform: translate(-50%, -50%) scale(1); }
  30%  { transform: translate(-50%, -65%) scale(1.25); }
  60%  { transform: translate(-50%, -50%) scale(0.9); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.sa-bounce {
  animation: saBounce 0.9s ease-out;
}




