@import "~@department-of-veterans-affairs/css-library/dist/tokens/scss/variables";
@import "~@department-of-veterans-affairs/css-library/dist/stylesheets/mixins";
@import "~leaflet/dist/leaflet.css";
@import "~react-tabs/style/react-tabs";
@import "~mapbox-gl/dist/mapbox-gl.css";

$facility-locator-shadow: rgba(0, 0, 0, 0.5);

$surface-secondary: rgba(223, 225, 226, 1);
$text-color: rgba(27, 27, 27, 1);

.facility-locator {
  @media (max-width: $large-screen) {
    margin: 0 12px;
  }

  @media (max-width: $small-screen) {
    margin: 0;
  }

  .usa-hint {
    display: block;
    color: var(--vads-color-gray-medium);
  }

  .p1 {
    padding: 0.5em 0;
  }

  label {
    margin-top: 0;
  }

  va-icon {
    color: var(--vads-color-link);
  }

  .tablet-or-larger-container {
    // allows space above pagination and  below map/controls and adds border
    margin-bottom: 3em;
    border-bottom: solid thin var(--vads-color-base-lightest);
  }

  #vertical-oriented-left-controls {
    display: flex;
    flex-direction: column;
    width: 333px;
  }

  #controls-and-map-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    column-gap: 24px;
    min-height: 78vh;
    max-height: 1178px;
  }

  .tablet-results-map-container {
    width: 100%;
    display: flex;
    flex-direction: row;
  }

  .tablet-map-container {
    width: calc(100% - 305px);
    min-height: 78vh;
    padding-left: 0;
    position: relative;
  }

  .desktop-map-container {
    padding-left: 0;
    position: relative;
    width: 100%;
    max-width: 655px;
    min-height: 78vh;
    max-height: 1178px;
    height: 100%;
  }

  .map-and-message-container {
    flex-grow: 1;
  }

  .search-result-title {
    :focus {
      @include focus-gold-light-outline(0);
      outline-offset: 2px;
      z-index: 3;
    }
  }

  .facility-result {
    padding: 22px 4px 34px;
    background: var(--vads-color-white);
    border-top: solid 2px var(--vads-color-base-lighter);
    border-bottom: none;

    @media screen and (max-width: $small-screen) {
      // we already have a border from the tab-list on mobile
      border-top: none;
    }

    @media screen and (min-width: $small-screen) {
      &.active {
        border: $focus-outline;
      }
    }

    a {
      color: var(--vads-color-link);

      &:focus {
        h5 {
          outline: inherit;
        }
      }

      &:visited {
        color: var(--vads-color-link);
      }
    }

    h5 {
      color: var(--vads-color-link);
    }

    td {
      vertical-align: top;
    }
  }

  @media screen and (max-width: $small-screen) {
    .facility-result + .facility-result {
      border-top: solid 1px var(--vads-color-base-light);
    }
  }

  .leaflet-popup-content {
    h5 {
      color: var(--vads-color-link);
    }

    a {
      display: block;
      text-decoration: none;

      &:focus {
        outline: 2px solid var(--vads-color-action-focus-on-light);
        outline-offset: 2px;
      }
    }

    p {
      margin: 0;
    }
  }

  .tab {
    border-color: var(--vads-color-black);
    text-align: center;
    background: var(--vads-color-gray-light-alt);
    border: solid 1px var(--vads-color-black);
    border-radius: 0 !important;

    display: inline-block;
    border-bottom: none;
    bottom: -1px;
    position: relative;
    list-style: none;
    padding: 6px 12px;
    cursor: pointer;

    &.react-tabs__tab--selected {
      border-top: solid 3px var(--vads-color-primary);
      background: var(--vads-color-white);
      border-bottom: none;
    }
  }

  .react-tabs [role="tab"][aria-selected="true"] {
    border-left-color: var(--vads-color-black);
    border-right-color: var(--vads-color-black);
  }

  ul.react-tabs__tab-list {
    padding: 0;
  }

  .react-tabs__tab + .react-tabs__tab {
    border-left: none;
  }

  #search-results-title {
    width: calc(100% - 8px);
    margin-left: 4px;
  }

  .search-results-container {
    max-width: 333px;
    max-height: 78vh;
    overflow-y: auto;
  }

  .facility-search-results {
    // remove black border
    border-top: 1px solid var(--vads-color-white);

    ol {
      padding: 0;
    }

    li {
      p {
        color: var(--vads-color-black);
      }
    }
  }

  .fa.blue {
    color: var(--vads-color-link);
  }

  .fl-stats-bar-container {
    display: flex;
    align-items: center;

    .fl-stats-bar {
      display: block;
      width: 230px;
      height: 39px;
      margin: 0.5em 0.5em 0.5em 0;
      background: url("/img/icons/fa-male-lt-grey.svg") repeat-x left center;
    }

    .fl-stats-bar-inner {
      display: block;
      content: "&nbsp;";
      height: 100%;
      margin: 0;
    }

    .fl-stats-bar-inner.grey {
      background: url("/img/icons/fa-male-dk-grey.svg") repeat-x left center;
    }

    .fl-stats-bar-inner.blue {
      background: url("/img/icons/fa-male-blue.svg") repeat-x left center;
    }
  }

  p {
    margin: 0.5em 0;
  }

  .clearfix {
    content: "";
    display: block;
    clear: both;
  }

  .search-controls-container {
    padding: 24px 16px 24px 12px;
    border: solid thin var(--vads-color-base-lightest);
    background: var(--vads-color-base-lightest);
  }

  .desktop-search-controls-container {
    padding: 32px 16px;
    width: 100%;
    max-width: 333px;
    height: auto;
    background: var(--vads-color-base-lightest);
  }

  #facility-search-controls {
    display: flex;
    flex-direction: column;
    width: 100%;
    row-gap: 24px;
    margin: 0;
    padding: 0;

    .input-container {
      width: 100%;
    }

    input {
      width: 100%;
      max-width: none;

      @media screen and (min-width: $small-desktop-screen) {
        max-width: 418px;
      }
    }

    textarea,
    select,
    va-select,
    .input-container {
      max-width: none;

      @media (min-width: $small-desktop-screen) {
        width: 100%;
        max-width: 418px;
      }
    }

    select:disabled {
      background: var(--vads-color-base-lightest);
    }

    .input-container {
      padding: 0;
      position: relative;
    }

    va-select {
      padding-right: 0;
      padding-left: 0;
    }

    input[type="submit"] {
      width: 100%;
      padding: 0 0.625rem;
      margin-top: 0;
      margin-bottom: 0;

      @media (min-width: $small-desktop-screen) {
        min-width: 4.4rem;
        width: auto;
      }
    }

    .service-type-dropdown-mobile,
    .service-type-dropdown-tablet {
      width: 100%;
      flex-basis: 100%;

      @media (min-width: $small-desktop-screen) {
        flex-basis: 100%;
      }
    }

    .service-type-dropdown-desktop {
      flex-basis: 100%;
      width: 100%;
    }

    .usa-input-error {
      right: 0;
    }

    #facility-type-dropdown::part(select) {
      width: 100%;
      max-width: 100%;
    }

    .facility-type-dropdown {
      width: 100%;
      flex-basis: 100%;
      margin-top: -24px;

      @media (min-width: $small-desktop-screen) {
        flex-basis: 100%;
      }

      &.facility-error {
        margin-top: 0px;

        @media screen and (min-width: $small-desktop-screen) {
          margin-left: 12px;
        }
      }
    }

    .facility-type-dropdown-mobile,
    .facility-type-dropdown-tablet {
      width: 100%;
      flex-basis: 100%;
      margin-top: -24px;

      &.facility-error {
        margin-top: -8px;
      }
    }

    .facility-type-dropdown-desktop {
      width: 100%;
      flex-basis: 100%;
      margin-top: -24px;

      &.facility-error {
        @media screen and (min-width: $tablet) {
          margin-top: 0px;
          margin-left: 12px;
        }
      }
    }

    #location-input-container {
      &.usa-input-error {
        margin-bottom: 24px;
        padding-bottom: 0;

        .input-container {
          margin-bottom: 0;
          max-width: calc(418px - 0.9375rem - 4px);
        }
      }
    }

    #location-input-field {
      width: 100%;
      display: flex;
      flex-direction: column;

      @media (min-width: $small-desktop-screen) {
        flex-direction: row;
      }
    }

    #location-input-field-desktop {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
    }

    .use-my-location-link {
      text-decoration: none;
      background-color: transparent;
      color: var(--vads-color-link);
      font-weight: normal;
      margin: 1em 0;
      text-align: left;
      padding: 0;

      @media (min-width: $small-desktop-screen) {
        margin: 0 0 0 20px;

        &.fl-sm-desktop {
          flex-direction: column;
          align-items: flex-start;
          margin: 0.5em 0;
        }
      }
    }

    .use-my-location-link-desktop {
      text-decoration: none;
      background-color: transparent;
      color: var(--vads-color-link);
      font-weight: normal;
      padding: 0;
      margin: 0.5em 0;
      text-align: left;
    }

    #search-controls-bottom-row {
      width: 100%;
      display: flex;
      flex-direction: column;

      select {
        margin: 0.5rem 0 0 0;
      }

      input[type="submit"] {
        margin: 0;
      }

      @media screen and (max-width: $small-desktop-screen) {
        margin-top: 0;
      }

      @media (min-width: $small-desktop-screen) {
        display: flex;
        flex-direction: row;
        column-gap: 12px;
        align-items: flex-end;
      }
    }

    p.service-hint-text {
      color: $vads-label-hint-text-color-on-light;
      margin: 0.5em 0;
    }
  }

  .facility-detail {
    padding: 0 0.9375rem;

    li.sublist {
      margin-left: 1.5em;
    }

    h5 {
      padding-bottom: 0;
    }

    p {
      margin: 0.5em 0;
    }

    a:visited,
    .edit-checkbox label:visited {
      color: var(--vads-color-link);
    }

    .call-out {
      border: solid thin var(--vads-color-black);
      background: var(--vads-color-white);
    }

    hr {
      border-color: var(--vads-color-base-lighter);
      margin: 0rem 0 1.25rem;
      color: var(--vads-color-primary-dark);
    }

    hr.title {
      color: var(--vads-color-primary-dark);
      margin: 0 0 1.25rem;
      border: 1px solid var(--vads-color-primary-dark);
    }
  }

  .typeahead-mobile,
  .typeahead-desktop {
    flex-basis: 100%;
  }

  .typeahead-tablet {
    flex-basis: 100%;

    &:has(.usa-input-error) {
      @media (min-width: $small-desktop-screen) {
        margin-bottom: 0px;
      }
    }
  }
}

// Prevent error message div from colliding with facility-type
#service-error {
  &.usa-input-error {
    padding-top: 0.25rem !important;
    padding-bottom: 0rem !important;
  }
}

#service-typeahead {
  border-radius: 0;
  box-sizing: border-box;
  cursor: pointer;
  color: var(--vads-color-base);
  display: block;
  font-size: 1rem;
  height: 2.625rem;
  line-height: 1.3;
  margin: 0;
  position: relative;
  width: 100%;

  &.disabled {
    cursor: default;
    background-color: var(--vads-color-base-lightest);
  }

  .dropdown {
    background: var(--vads-color-white);
    border: solid 1px var(--vads-color-black);
    box-sizing: content-box;
    font-size: 1rem;
    left: -1px;
    list-style: none;
    max-height: 25vh;
    overflow-y: auto;
    padding: 0;
    position: absolute;
    top: 44px;
    width: 100%;
    z-index: 1010;

    &.drowpdown-fl-sm-desktop {
      @media screen and (min-width: $small-desktop-screen) {
        max-width: 301px;
      }
    }

    @media (min-width: $small-desktop-screen) {
      width: 418px;
    }

    .dropdown-option {
      border-bottom: solid 1px var(--vads-color-black);
      z-index: 1011;

      &.selected,
      &:hover {
        color: var(--vads-color-white);
        background-color: var(--vads-color-primary-dark);
      }

      &:last-child {
        border-bottom: none;
      }
    }
  }

  .dropdown-option {
    box-shadow: none;
    font-weight: 400;
    line-height: 1.3;
    margin: 0;
    max-width: 100%;
    overflow: hidden;
    padding: 0.625rem 0.7em;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.about-cc-link {
  text-decoration: none;
}

.current-pos-pin {
  border-radius: 50%;
  width: 23px;
  height: 23px;
  box-shadow: 0 0 4px 0 $facility-locator-shadow;
  border: solid 4px var(--vads-color-white);
  background-color: var(--vads-color-secondary-dark);
}

.bor-rad {
  border-radius: 5px;
}

.va-nav-breadcrumbs:focus {
  outline: 0;
}

.i-pin-card-map {
  flex-wrap: wrap;
  border-radius: 50%;
  background: var(--vads-color-base-darker);
  color: var(--vads-color-white);
  justify-content: center;
  align-content: center;
  display: inline-flex;
  font-size: 0.9375rem;
  width: 1.5rem;
  height: 1.5rem;

  &#active-pin {
    height: 38.5px;
    width: 38.5px;
    border-radius: 50%;
    border: 16px;
    background-color: var(--vads-color-link);
  }

  &#active-pin::after {
    position: absolute;
    content: "";
    width: 0;
    height: 0;
    bottom: -4px;
    left: 9.5px;
    border: 10.45px solid var(--vads-color-link);
    transform: rotate(45deg);
    z-index: -1;
  }
}

.notice-marg-pad {
  padding: 0.3125rem !important;
  margin-top: 0;
  font-size: 16px;
  font-weight: bold;
  width: 280px;
  height: 40px;
}

.icon-base {
  color: var(--vads-color-base) !important;
}

.facility-phone-group {
  display: flex;
  flex-direction: column;
}

#other-tools {
  text-align: center;
  margin: 22px auto;
  clear: both;

  @media (max-width: $small-screen) {
    width: 260px;
    white-space: pre-line;
  }
}

#mapbox-gl-container {
  @media screen and (max-width: $medium-screen) {
    height: 55vh;
  }
}

#search-area-control-container {
  z-index: 1;
}

#search-area-control {
  cursor: pointer;
  pointer-events: auto;
  max-width: fit-content;
  margin: 0;
  padding: 0;

  @media (max-width: $small-screen) {
    height: 43px;
  }
}

.mapboxgl-ctrl-top-center {
  position: absolute;
  pointer-events: none;
  top: 16px;
  left: 40px; // keep away from the controls on the left
  right: 40px; // mirror on right so contents can be centered
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mapboxgl-ctrl-bottom-center {
  bottom: 40px;
  width: 100%;
  position: absolute;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

button.mapboxgl-ctrl-attrib-button {
  padding: 1px 6px 1px 6px;
  margin: 0;
  bottom: 0;
}

button.mapboxgl-ctrl-zoom-in {
  margin-top: 0;
  margin-bottom: 0;
  margin-right: 0;
}

button.mapboxgl-ctrl-zoom-out {
  margin-top: 0;
  margin-bottom: 0;
  margin-right: 0;
}

canvas.mapboxgl-canvas {
  height: 100%;
  min-height: 58vh;
  max-height: 1178px;
}

canvas.mapboxgl-canvas:focus {
  outline: 2px solid var(--vads-color-action-focus-on-light);
  outline-offset: 2px;
}

.clear-button {
  top: 5px;
  right: 5px;
  position: absolute;
  width: 32px;
  height: 32px;
  background-color: transparent;
  color: var(--vads-color-black);
  padding: 0;
  margin: 0;

  &:hover {
    background-color: unset;
    color: unset;
  }
}

.clear-button va-icon {
  color: var(--vads-color-black);
}

#street-city-state-zip {
  padding-right: 36px !important;
}

// Make focus styles on the Medallia 'Feedback' button consistent with focus styles in the survey
.nebula_image_button.wcagOutline:focus {
  outline: 2px solid rgb(249, 198, 66) !important;
  outline-offset: 2px !important;
  transition: none !important;
}

.success-icon {
  color: var(--vads-color-success) !important;
}

//Segemented control CSS

.segmented-control-container {
  width: 100%;
  background-color: $surface-secondary;
  border-radius: 8px;
  padding: 2px;
  display: flex;
  width: 100%;
  list-style: none;
}

.segment {
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0px;
  padding: 4px 8px;
}

.segment:active {
  opacity: 0.8;
}

.segment-text {
  font-size: 20.25px;
  font-weight: 400;
  line-height: 30.38px;
  color: $text-color;
  text-align: center;
  margin-bottom: 0;
}

.segment-text--selected {
  color: $text-color;
  font-weight: 700;
}

.segment-wrapper {
  padding-bottom: 20px;
}

.segment-wrapper-list {
  border-bottom: 1px solid rgba(170, 170, 170, 1);
}
