/**
 * Custom Styles
 */

#scroll-top-link.avia_pop_class {
  /* Overlaps map */
  display: none;
}

[id="apsa-map"] {
  position: relative;
  /* Prevent map elements from overlapping other page elements */
  z-index: 0;
  width: auto;
  height: calc(100dvh - 8em);
  margin-inline: calc(var(--page-padding) * -1);
  @media (min-width: 1024px) {
    /* 130px is the height of the fixed header */
    max-height: calc(100dvh - 12em - 130px);
  }

  /* Override leaflet styles */
  .leaflet-control {
    margin: 0;
    z-index: 0;
  }
}

[id="apsa-map"][id] {
  background: #eee;
  border: 1px solid #999;
}

.apsa-map__marker-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1em;
  line-height: 1.4;
}

.apsa-map__marker-content-wrapper a {
  color: #871b3f;
}

.apsa-map__fac-member-field--linkedname a {
  display: inline-block;
  /* Make the bottom border wider than the text, but make sure text still lines up */
  margin: 0 -0.25em;
  padding: 0.0625em 0.25em;
  margin-bottom: 0.25em;
  /* Give an underline, text-decoration has !important and this looks nicer */
  border-bottom: 1px solid #871b3f55;
}

.apsa-map__fac-member-field--linkedname a:hover,
.apsa-map__fac-member-field--linkedname a:focus {
  border-bottom: 1px solid #871b3faa;
}

a.apsa-map__fac-member-field {
  display: inline-block;
  padding: 0.25em 0;
}

.apsa-map__no-results {
  font-size: 1.25em;
  font-weight: bold;
}

.leaflet-top.leaflet-left {
  position: relative;
  z-index: 800;
  display: flex;
  gap: 1em 1.5em;
  flex-wrap: wrap;
  width: 100%;
  padding: 1em;
  border-bottom: 2px solid #0002;
  font-size: 0.875rem;
  background: #fffc;
  @media (min-width: 820px) {
    font-size: 1rem;
    width: auto;
    padding: 1em;
  }

  input,
  select,
  option,
  button {
    &:not(#foo) {
      height: auto;
      color: #000;
      font-family: 'muli',Helvetica,Arial,sans-serif;
    }
  }

  input,
  select {
    &:not(#foo) {
      background-color: #fff;
      border: 2px solid #bbb;
      margin: 0;
    }
  }
}

.leaflet-bottom.leaflet-right {
  display: none;
  @media (min-width: 820px) {
    display: block;
    padding: 1em;
  }
}

.apsa-map__control {
  display: flex;
  gap: 1em;
  align-items: center;
  justify-content: start;
  width: 100%;
  @media (min-width: 820px) {
    align-items: stretch;
    gap: 0;
    width: auto;
    flex-direction: column;
  }

  select {
    &:not(#foo) {
      /* Make room for arrow */
      box-sizing: content-box;
      padding-right: 2em;
      width: min-content;
    }
  }
}

.apsa-map__control--clear-button {
  display: flex;
  align-items: center;
  justify-content: end;
  flex-direction: row;
  &[class] {
    margin-left: auto;
  }

  button {
    padding: 0.5em 1.25em;
    line-height: 1;
    border: 2px solid #871b3f;
    border-radius: 2em;
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: bold;
    background: #fff;
    appearance: none;
    cursor: pointer;

    &:not(#foo#bar) {
      color: #871b3f;
    }

    &:hover,
    &:focus {
      background: #871b3f;
      &:not(#foo#bar) {
        color: #fff;
      }
    }
  }
}

/**
 * Address search CSS
 * Originally from: https://github.com/geoapify/leaflet-address-search-plugin/blob/main/src/L.Control.GeoapifyAddressSearch.css
 */
.geoapify-leaflet-control {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 40px;
  grid-auto-rows: min-content;
  align-items: stretch;
  max-width: 360px;
  width: 100%;

  &[class] {
    z-index: 10;
    border: 0;
  }

  label {
    grid-row: 1;
    grid-column: 1;
    position: relative;
    z-index: 1;
    margin: 0;
    padding-left: 8px;
    display: flex;
    align-items: center;
    font-weight: normal;
    font-style: italic;
    pointer-events: none;
    @media (min-width: 820px) {
      padding-left: 0;
      font-style: normal;
      font-weight: bold;
    }

    &:not(#foo) {
      color: #999;
      @media (min-width: 820px) {
        color: #000;
      }
    }

  }

  &:focus-within label,
  &:has(input.has-value) label {
    opacity: 0;
    @media (min-width: 820px) {
      opacity: 1;
    }
  }


  .geoapify-form {
    grid-column: 1;
    grid-row: 1;
    @media (min-width: 820px) {
      grid-row: 2;
    }
  }

  input {
    &[type]:not(#foot) {
      border-right: 0;
    }
  }
}

.geoapify-form {
  /* Fighting bad styles */
  &[class]:not(#foo) {
    margin: 0;
  }
}

.geoapify-address-input {
  padding: 0 33px 0 7px;
  width: calc(100% - 40px);
  line-height: 30px;
  height: 30px;
  font-size: 14px;
  outline: none;
  border: none;

  /* Fighting bad styles */
  &:not(#foo#bar) {
    color: #000;
  }
}

.geoapify-clear-button {
  position: relative;
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  margin: 0;
  padding: 0;
  border: 2px solid #ccc;
  border-left: 0;
  background: #fff;
  appearance: none;

  @media (min-width: 820px) {
    grid-row: 2;
  }

  color: rgba(0, 0, 0, 0.4);
}

.geoapify-clear-button.visible:hover {
  color: rgba(0, 0, 0, 0.6);
}

.geoapify-clear-button.visible {
  cursor: pointer;
}

.geoapify-autocomplete-items {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  border-top: 1px solid rgba(0,0,0,0.1);
  background-color: #fff;
}

.geoapify-autocomplete-items div {
  padding: 8px 10px;
  cursor: pointer;
}

.geoapify-autocomplete-items div.empty {
  cursor: default;
}

.geoapify-autocomplete-items .result:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.geoapify-autocomplete-items .result.active {
  background-color: rgba(0, 0, 0, 0.1);
}

.geoapify-autocomplete-item {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.geoapify-autocomplete-items .secondary-part {
  margin-left: 10px;
  font-size: small;
  color: rgba(0, 0, 0, 0.6);
}

.geoapify-autocomplete-item .no-results {
  color: rgba(0, 0, 0, 0.6);
}


.geoapify-icon-rotate svg {
  -webkit-animation: rotation 1s infinite linear;
  animation: rotating 1s infinite linear;
}

@keyframes rotating {
  from {
    -ms-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -webkit-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  to {
    -ms-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -webkit-transform: rotate(360deg);
    -o-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}