/* Styles for page specific elements */

.homeHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.homeHeader h1 {
  font-size: 24px;
  font-family: Helvetica, Arial, sans-serif;
  text-align: center;
  padding-top: 16px;
}

h2 {
  font-size: 20px;
  font-family: Helvetica, Arial, sans-serif;
}

.homeHeader #homePage {
  width: 35px;
  height: 35px;
  padding: 11px 0 0 20px;
}

.homeHeader #dataDict {
  width: 45px;
  height: 45px;
  padding: 11px 20px 0 0;
}

#content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
/* Hidden on screen, visible in print */
#printLogoRow {
  display: none;
}

#mapAndSidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "map";
  gap: 0;
  align-items: start;
  transition:
    grid-template-columns 220ms ease,
    gap 220ms ease;
}

#mapPane {
  min-width: 0;
  grid-area: map;
}

#mapAndSidebar.sidebar-open {
  grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
  grid-template-areas: "sidebar map";
  gap: 16px;
}

#map {
  position: relative;
  height: 600px;
  width: 100%;
}

.field-label {
  font-weight: bold;
}

button {
  cursor: pointer;
}

#huc8LookupSection {
  margin-bottom: 10px;
}

#huc8LookupForm {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
}

.form-field {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 500px;
}

.radio-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.radio-element label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.radio-element {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tooltip-wrapper {
  position: relative;
  display: inline-flex;
  align-self: center;
  flex-shrink: 0;
}

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #000;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  line-height: 1;
  cursor: help;
}

.tooltip-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: 240px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #ddd;
  font-size: 13px;
  line-height: 1.4;
  z-index: 10;
}

.tooltip-text ul {
  margin: 0;
  padding-left: 1.2em;
}

.tooltip-text li {
  margin-bottom: 4px;
}

.tooltip-text li:last-child {
  margin-bottom: 0;
}

.tooltip-wrapper:hover .tooltip-text,
.tooltip-wrapper:focus .tooltip-text {
  display: block;
}

.tooltip-wrapper:focus {
  outline: none;
}

.tooltip-wrapper:focus .tooltip-icon {
  outline: 2px solid -webkit-focus-ring-color;
  outline-offset: 1px;
}

#addressInput,
#huc8CodeInput {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d9d9d9;
  margin: 2px 0px;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 1rem;
}

#addressField {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 75%;
  z-index: 1001;
  background: white;
  border: 1px solid #d9d9d9;
  border-top: none;
  border-radius: 0 0 4px 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 99%;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.autocomplete-dropdown li {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid #d9d9d9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.autocomplete-dropdown li:hover,
.autocomplete-dropdown li.active {
  background-color: #f0f6ff;
}

.input-example {
  margin-top: 2px;
  color: #5b6770;
  font-size: 13px;
}

.error-message {
  color: #d32f2f;
  font-size: 13px;
  margin-top: 2px;
}

#huc8ResultRow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

#huc8Result {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

#copyHuc8Button.copy-success {
  color: green;
}

#adjacentHuc8Table {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid #ddd;
  display: none;
}

#adjacentHuc8Table td {
  border: 1px solid #ddd;
  padding: 10px;
  width: 50%;
}

#adjacentHuc8Table td:hover {
  background-color: #f5f5f5;
}

#adjacentHuc8Table a {
  display: block;
}

#adjacentWatershedsSection {
  grid-area: sidebar;
  display: none;
  max-height: 600px;
  overflow: hidden;
  width: 0;
  opacity: 0;
  padding: 0;
  border: 0 solid transparent;
  border-radius: 8px;
  background-color: #f7f7f7;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transform: translateX(-18px);
  transition:
    width 220ms ease,
    opacity 180ms ease,
    transform 220ms ease,
    border-color 220ms ease;
}

#mapAndSidebar.sidebar-open #adjacentWatershedsSection {
  display: block;
  width: auto;
  max-height: 600px;
  overflow: auto;
  opacity: 1;
  border-width: 1px;
  border-color: #d9d9d9;
  transform: translateX(0);
}

#adjacentWatershedsSection h2 {
  margin: 0;
  position: sticky;
  top: 0;
  z-index: 1;
  background-color: #ffffff;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #dbdbdb;
  border-radius: 8px 8px 0 0;
}

#adjacentHuc8Error {
  display: block;
  padding: 10px 18px 0;
}

#adjacentHuc8List {
  display: flex;
  flex-direction: column;
}

#adjacentHuc8List p {
  margin: 0;
  padding: 16px 18px 20px;
  color: #5b6770;
}

.adjacent-huc8-card {
  display: block;
  padding: 16px 18px;
  border-bottom: 1px solid #e1e1e1;
  text-decoration: none;
  color: inherit;
  background-color: #f7f7f7;
  transition: background-color 120ms ease;
}

.adjacent-huc8-card:last-child {
  border-bottom: 0;
}

.adjacent-huc8-card:hover {
  background-color: #efefef;
}

.adjacent-huc8-card:focus-visible {
  outline: 2px solid #012a52;
  outline-offset: -2px;
  background-color: #eef4fa;
}

.adjacent-huc8-card-name {
  display: block;
  color: #1f2a33;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}

.adjacent-huc8-card-code {
  display: block;
  margin-top: 8px;
  color: #6f7b84;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

#adjacentHuc8SeeMoreLink {
  display: none;
  width: 100%;
  margin: 0;
  padding: 14px 18px 16px;
  border: 0;
  border-top: 1px solid #e1e1e1;
  background: transparent;
  color: #00376f;
  font: inherit;
  text-align: center;
  cursor: pointer;
}

.adjacent-see-more-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

#adjacentHuc8SeeMoreLink.adjacent-see-less .adjacent-see-more-icon {
  transform: translateY(4px) rotate(-135deg);
}

#mapLegend {
  position: absolute;
  top: 20px;
  right: 20px;
  background: white;
  padding: 10px 15px;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  pointer-events: auto;
}

.huc8-code-map-label,
.adjacent-huc8-code-map-label {
  background: transparent;
  border: none;
}

.adjacent-huc8-pattern {
  fill: url(#adjacentHuc8Pattern);
}

.huc8-code-map-label span {
  display: inline-block;
  padding: 4px 9px;
  background: #ffffff;
  border: 1px solid var(--stroke-focused);
  border-radius: 4px;
  color: #011d39;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(1, 42, 82, 0.18);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: mapLabelEnter 180ms ease-out;
}

.adjacent-huc8-code-map-label span {
  display: inline-block;
  padding: 4px 9px;
  background: #fbf3df;
  border: 1px solid var(--stroke-adjacent);
  border-radius: 4px;
  color: #6e560e;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: mapLabelEnter 180ms ease-out;
}

@keyframes mapLabelEnter {
  from {
    opacity: 0;
    transform: translate(-50%, -42%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}
.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
}

.legend-item:last-child {
  margin-bottom: 0px;
}

.legend-color {
  width: 20px;
  height: 15px;
  display: inline-block;
  margin-right: 8px;
  border: 1px solid #333;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-label {
  font-size: 11px;
  line-height: 15px;
}

.hidden {
  display: none;
}

/* Define colors for the map legend and visualizations here, values are referenced in styles below and in MapStyles*/
:root {
  --color-default: #d4e1ea;
  --color-focused: #6486a4;
  --color-adjacent: #c99b2f;
  --color-hover: #29b22e;
  --stroke-default: #8ea1af;
  --stroke-focused: #012a52;
  --stroke-adjacent: #7b5e11;
  --stroke-hover: #114913;
}

#focused-legend {
  background-color: var(--color-focused);
  border-color: var(--stroke-focused);
}

#adjacent-legend {
  background-color: var(--color-adjacent);
  border-color: var(--stroke-adjacent);
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(123, 94, 17, 0.34) 0 3px,
    rgba(123, 94, 17, 0) 3px 8px
  );
}

#default-legend {
  background-color: var(--color-default);
  border-color: var(--stroke-default);
}

@media (max-width: 920px) {
  #mapAndSidebar {
    grid-template-columns: 1fr;
    grid-template-areas: "map";
  }

  #mapAndSidebar.sidebar-open {
    grid-template-columns: 1fr;
    grid-template-areas:
      "map"
      "sidebar";
    gap: 16px;
  }

  #mapAndSidebar.sidebar-open #adjacentWatershedsSection {
    width: auto;
    max-height: none;
    opacity: 1;
    overflow: hidden;
    transform: none;
    border-width: 1px;
    border-color: #d9d9d9;
  }
}

@media (max-width: 700px) {
  .radio-group {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .tooltip-wrapper:focus .tooltip-text {
    display: none;
  }

  .tooltip-wrapper.mobile-tooltip-open .tooltip-text {
    display: block;
  }

  .tooltip-text {
    left: auto !important;
    right: 0 !important;
    margin-right: 0;
    transform: none !important;
  }

  #mapLegend {
    top: 10px;
    right: 10px;
  }

  .mobile-adjacent-hidden {
    display: none;
  }

  #adjacentHuc8SeeMoreLink:not(.hidden) {
    display: block;
  }

  #lookupButton,
  #copyHuc8Button,
  #printMapButton {
    min-height: auto;
    padding: 6px 16px;
    font-size: 14px;
    font-weight: inherit;
    line-height: 1.2;
  }
}

@media (max-width: 460px) {

  #huc8ResultRow {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  #huc8Result {
    font-size: 0.75em;
    width: 100%;
  }

  #huc8Result h2 {
    margin: 24px 0 4px 0;
  }
}

@media print {
  #content,
  #mapAndSidebar {
    display: block;
  }

  #adjacentWatershedsSection {
    width: auto;
    max-height: none;
    opacity: 1;
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    transform: none;
  }

  #adjacentWatershedsSection h2 {
    position: static;
    background: transparent !important;
    padding: 0 0 8px;
    border-bottom: 0;
  }

  #adjacentHuc8List {
    display: none !important;
  }

  #adjacentHuc8Table {
    display: table;
  }

  #mapLegend {
    background: #ffffff !important;
    border: 1px solid #000 !important;
    padding: 10px 15px !important;
  }

  .legend-color {
    border: 1px solid #333 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #focused-legend {
    background: var(--color-focused) !important;
    border-color: var(--stroke-focused) !important;
  }

  #adjacent-legend {
    background: #ead59a !important;
    border-color: var(--stroke-adjacent) !important;
    background-image: repeating-linear-gradient(
      -45deg,
      rgba(123, 94, 17, 0.18) 0 3px,
      rgba(123, 94, 17, 0) 3px 8px
    ) !important;
  }

  #default-legend {
    background: var(--color-default) !important;
    border-color: var(--stroke-default) !important;
  }

  .huc8-code-map-label span,
  .adjacent-huc8-code-map-label span,
  .legend-color {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .huc8-code-map-label span {
    background: #ffffff !important;
    border: 1px solid var(--stroke-focused) !important;
    color: #011d39 !important;
  }

  .adjacent-huc8-code-map-label span {
    background: #fef9ef !important;
    border: 1px solid var(--stroke-adjacent) !important;
    color: #6e560e !important;
  }

  .adjacent-huc8-pattern {
    fill: url(#adjacentHuc8Pattern) !important;
    fill-opacity: 0.72 !important;
  }
}
