@use "../../../variables/index" as *;

@use "../../mixins/vendor-prefixes";


/**
 * c8y pulse - Component styles
 *
 * Note: Uses $size-* tokens for spacing where applicable.
 *
 * Intentionally hardcoded values:
 * - Component-specific dimensions: Fixed sizes for component layout
 * - Off-grid spacing: Component-specific positioning
 * - Border widths (1px, 2px, 3px): Standard borders
 * - Font-sizes: Typography
 * - Percentages: Layout
 */
.c8y-pulse {
  position: relative;
  display: inline-block !important;
  margin: 0 5px 0 0 !important;
  width: $size-8;
  height: 8px;
  border-radius: 50%;
  background: $component-pulse-color;
  &.inactive{
    &::before{
      background: $component-color-disabled;
    }
  }
  &:before {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 0;
    border-radius: 50%;
    background-color: $component-pulse-color;
    content: '';
    transform: rotateZ(360deg);
  }
  &.active{
    border: 1px solid $component-background-default;
    background-color: $component-pulse-color;
    &:before {
      animation: c8ypulse 2s infinite;
    }
  }
  &--md{
    width: $size-16;
    height: $size-16;
    &.active {
      border: 1px solid $component-background-default;
      background-color: $component-pulse-color;
      &:before {
        animation: c8ypulse 2s infinite;
      }
    }
  }
  &--lg{
    width: $size-24;
    height: $size-24;
    &.active {
      border: 1px solid $component-background-default;
      background-color: $component-pulse-color;
      &:before {
        animation: c8ypulse 2s infinite;
      }
    }
  }
}

.c8y-realtime {
  &:hover,
  &:focus {
    text-decoration: none;
  }
  .c8y-pulse.inactive {
    border: 1px solid $component-color-disabled;
    background-color: $component-color-disabled;
    animation: none;

    @include vendor-prefixes.transition(border 0.25s ease);
    &:before {
      display: none;
    }
  }
  .c8y-pulse.active {
    border: 1px solid $component-background-default;
    background-color: $component-pulse-color;
    &:before {
      animation: c8ypulse 2s infinite;
    }
  }
}





@keyframes c8ypulse {
  0% {
    opacity: 1;
    transform: rotateZ(360deg);
    transform: scale(1);
  }
  70% {
    opacity: 0;
    transform: rotateZ(0);
    transform: scale(3);
  }
  100% {
    opacity: 0;
    transform: rotateZ(0);
    transform: scale(1);
  }
}
