/* Add variable for bottom elements position*/

:root {
  --bottom-elements-position: 1rem;
}

#map {
  height: 100vh;
  width: 100%;
  margin: 0;
}

#map .leaflet-top {
  top: 5rem;
}

@media (min-width: 1025px) {
  #map .leaflet-top {
    top: 10rem;
  }
}

#map-info-container {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 100%;
  max-width: 28rem;
  min-height: 10rem;
  background-color: white;
  border-top-left-radius: 1rem;
  border-top-right-radius: 1rem;
  display: none;
  z-index: 1000;
  overflow: hidden;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2);
  background-clip: padding-box;
}

@media (min-width: 768px) {
  #map-info-container {
    bottom: 1rem;
    right: 1rem;
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
  }
}

#map-info-container.active {
  display: block;
}

.map-info-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  box-sizing: border-box;
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent);
}

#map-info-container:has(.map-info-video) .map-info-header {
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7) 60%, transparent);
}

.map-info-meta {
  /* position: absolute;
  top: 1rem;
  left: 1rem; */
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-width: calc(100% - 30px);
}

.map-info-close {
  /* position: absolute; */
  display: flex;
  align-items: center;
  justify-content: center;
  /* top: 0.75rem;
  right: 0.75rem; */
  cursor: pointer;
  line-height: 0;
  background-color: white;
  border-radius: 50%;
  padding: 0.4rem;
}

.map-info-close:hover {
  background-color: whitesmoke;
}

.map-info-image img,
.map-info-video {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.map-info-meta .map-info-meta-label {
  background-color: antiquewhite;
  padding: 0 0.5rem;
  border-radius: 0.4rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  font-size: 0.8em;
}

.map-info-content {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.75rem 0.5rem;
}

.map-info-content h2 {
  margin: 0;
  margin-bottom: 0.3rem;
  font-size: 1.15em;
  line-height: 1;
}

.map-info-content p {
  margin-top: 0;
  margin-bottom: 0.3rem;
  line-height: 1.3;
  opacity: 0.9;
  font-size: 0.9rem;
  display: flex;
  gap: 0.3rem;
}

.map-info-location-icon {
  width: 14px;
  aspect-ratio: auto;
  margin-right: 0.1rem;
  vertical-align: middle;
}

.map-info-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  font-weight: bold;
  font-size: 0.9rem;
}



/* Locate */

.locate {
  position: absolute;
  z-index: 999 !important;
  display: flex;
  bottom: var(--bottom-elements-position);
  right: 1rem;
  padding: 0.6rem;
  background-color: white;
  border-radius: 1rem;
  text-decoration: none;
  cursor: pointer;
  line-height: 0;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2) !important;
}

.locate.is-locating {
  pointer-events: none;
}

span[class^="icon-"] {
  line-height: 0;
}

.icon-my-location {
  display: flex;
  align-items: center;
}

.is-locating .icon-my-location,
.is-located .icon-my-location {
  display: none;
}

.icon-load-location,
.icon-stop-locate {
  display: none;
}


.is-locating .icon-load-location {
  display: flex;
  align-items: center;
  animation: rotate 1.5s linear infinite;
}

.is-located .icon-stop-locate {
  display: flex;
  align-items: center;
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

/* Leaflet styles */

.leaflet-popup {
  width: max-content;
  max-width: 200px;
}

.leaflet-popup-content-wrapper {
  border-radius: 50px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2);
}

.leaflet-popup-close-button {
  display: none;
}

.leaflet-bar {
  border-radius: 1rem;
  overflow: hidden;
  border: none !important;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2) !important;
}

.leaflet-left .leaflet-control {
  margin-left: 1rem !important;
}

.leaflet-bottom .leaflet-control {
  margin-bottom: var(--bottom-elements-position) !important;
}

.leaflet-control-layers {
  /* background: #fff; */
  border: none !important;
  border-radius: 1rem;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2) !important;
}

.leaflet-control-layers-toggle {
  /* background-image: url(../icons/map-icon-tune.svg) !important; */
  /* width: 36px;
    height: 36px; */
}

.leaflet-control-attribution.leaflet-control {
  transform: rotate(270deg);
  top: -70vh;
  right: -76px;
}

/* img.leaflet-marker-icon.hoidetut-pikkujarvet {
  filter: hue-rotate(291deg) brightness(1.2);
}

img.leaflet-marker-icon.koskikohteet {
  filter: contrast(100%) saturate(1.3) brightness(1.4);
} */

/* Control Layer selection */

.leaflet-control-layers-expanded label {
  padding: 0.1rem;
  cursor: pointer;
}

.leaflet-control-layers-overlays input[type="checkbox"] {
  display: none;
}

.leaflet-control-layers-overlays label:not(:has(input:checked)) {
  opacity: 0.5;
  filter: grayscale(1);
}