@use '../../../../shared/styles/variables' as *;


.device-map__container {
    display: flex;
    flex: 1;
    position: relative;
    border-radius: 14px;
    overflow: visible;
    background: $color-media-bg;
}

.device-map__leaflet {
    width: 100%;
    height: 100%;
    z-index: 1;
    border-radius: 14px;
}

.device-map__coords {
    position: absolute;
    left: 10px;
    bottom: 10px;
    z-index: 2;

    min-height: 28px;
    padding: 0 10px;

    border-radius: 999px;
    background: rgba($color-surface-rgb, 0.92);

    display: inline-flex;
    align-items: center;
    gap: 6px;

    color: $color-text-heading;
    font-size: 12px;
    font-weight: 600;

    box-shadow: 0 8px 22px rgba($color-shadow-rgb, 0.12);

    svg {
        color: $blue;
    }
}

.device-map-marker {
    background: transparent;
    border: none;
}

.device-map-marker__pin {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba($color-primary-rgb, 0.18);

    display: flex;
    align-items: center;
    justify-content: center;
}

.device-map-marker__inner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: $blue;
    border: 3px solid $color-surface;
    box-shadow: 0 8px 18px rgba($color-primary-rgb, 0.35);
}

.device-map-marker.is-online {
    .device-map-marker__pin {
        background: rgba($color-success-rgb, 0.18);
    }

    .device-map-marker__inner {
        background: $green;
        box-shadow: 0 8px 18px rgba($color-success-rgb, 0.35);
    }
}

.device-map-marker.is-offline {
    .device-map-marker__pin {
        background: rgba($gray50-rgb, 0.18);
    }

    .device-map-marker__inner {
        background: $gray50;
        box-shadow: 0 8px 18px rgba($gray50-rgb, 0.28);
    }
}

.device-map-marker.is-lost {
    .device-map-marker__pin {
        background: rgba($color-danger-rgb, 0.16);
    }

    .device-map-marker__inner {
        background: $red;
        box-shadow: 0 8px 18px rgba($color-danger-rgb, 0.28);
    }
}

.device-map-popup {
    display: flex;
    flex-direction: column;
    gap: 3px;

    b {
        color: $color-text-heading;
        font-size: 13px;
        font-weight: 700;
    }

    span {
        color: $color-text-muted;
        font-size: 12px;
        font-weight: 500;
    }
}

.device-map__period-control {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 400;
  border-radius: 24px;
}

.device-map-info-card {
  position: absolute;
  left: 12px;
  top: 70px;
  z-index: 430;
  //transform: translateY(-50%);

  width: min(180px, calc(100% - 24px));
  padding: 14px;
  border: 1px solid rgba($color-border-rgb, 0.72);
  border-radius: 16px;
  background: rgba($color-surface-rgb, 0.94);
  backdrop-filter: blur(14px);
  box-shadow: $shadow-popover;
}

.device-map-info-card__close {
  position: absolute;
  top: 8px;
  right: 8px;

  width: 26px;
  height: 26px;
  border: none;
  border-radius: 8px;
  background: $color-surface-muted;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: $color-text-muted;
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease;

  &:hover {
    background: $color-surface-hover;
    color: $color-primary;
  }
}

.device-map-info-card__header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 28px;
  margin-bottom: 12px;
  line-height: 1;
  text-align: left;

  b,
  span {
    display: block;
  }

  b {
    overflow: hidden;
    color: $color-text-heading;
    font-size: $font-size-15;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  span {
    margin-top: 3px;
    overflow: hidden;
    color: $color-text-muted;
    font-size: $font-size-12;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.device-map-info-card__icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: $color-primary-tint;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: $color-primary;
}

.device-map-info-card__rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.device-map-info-card__row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  justify-content: flex-start;
  gap: 8px;

  color: $color-text;
  font-size: $font-size-12;
  font-weight: 500;

  svg {
    color: $color-primary;
  }

  span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left    ;
  }
}

.device-map-info-card__status {
  grid-column: 1 / -1;
  min-height: 22px;
  width: fit-content;
  padding: 0 8px;
  border-radius: 999px;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  color: $color-text-heading;
  font-size: $font-size-11;
  font-weight: 700;
  text-transform: uppercase;

  &::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
  }

  &.is-online {
    background: rgba($color-success-rgb, 0.14);
    color: $green;
  }

  &.is-offline {
    background: $color-bg;
    color: $gray50;
  }

  &.is-lost {
    background: rgba($color-danger-rgb, 0.14);
    color: $red;
  }
}

.device-map-info-card__footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba($color-border-rgb, 0.72);

  color: $color-text-muted;
  font-size: $font-size-11;
  font-weight: 600;
}

.device-map--modal {
  padding: 0 !important;
  box-shadow: none;
  border-radius: 0;
  background: transparent;

  .device-card__header {
    display: none;
  }

  .device-map__container {
    height: 100%;
    border-radius: 20px;
    overflow: hidden;
  }
}
