@use 'sass:math';

.player .seek-bar {
  padding: 12px 0 12px 0;
  cursor: pointer;
  position: relative;
  z-index: 1;

  &:hover,
  &.hover {
    .time-preview,
    .frame-preview:not(.hide-frame-preview) {
      display: block;
    }
    .progress-bar {
      .scrubber {
        transform: scale(1);
      }
      .virtual-progress {
        display: block;
      }
    }
  }

  &.ad-break {
    cursor: initial;
  }

  .progress-bar {
    width: 100%;
    height: $progress-bar-height;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: $progress-bar-border-radius;
    position: absolute;
    transition:
      height 200ms ease,
      transform 200ms ease;
    &.chapters {
      background-color: transparent;
      .virtual-progress-indicator {
        height: 8px;
        transform: translateY(-2px);
      }
    }
    .virtual-progress {
      display: none;
    }
    .virtual-progress {
      position: absolute;
      top: 0;
      left: 0;
      height: 100%;
      border-radius: inherit;
    }

    .virtual-progress-indicator {
      width: 1px;
      height: 100%;
      background-color: $tone-1-color;
      float: right;
    }

    .scrubber {
      position: absolute;
      cursor: pointer;
      display: block;
      top: -8px + math.div($progress-bar-height, 2);
      left: -6px;
      border-radius: 8px;
      height: 16px;
      width: 16px;
      background-color: $tone-1-color;
      box-shadow: 0 0 31px 0 rgba(0, 0, 0, 0.3);
      transform: scale(0);
      transition: 100ms transform;
      z-index: 1;
      pointer-events: none;

      &:active {
        opacity: 1;
        cursor: grabbing;
      }
    }
  }

  .frame-preview {
    position: absolute;
    bottom: $progress-bar-height + 16px;
    left: 0;
  }

  .time-preview {
    position: absolute;
    bottom: $progress-bar-height + 22px;
    left: 0;
    height: 22px;
    min-width: 48px;
    padding: 0 3px;
    text-align: center;
    border-radius: 3px;
    background-color: rgba(0, 0, 0, 0.7);
    font-size: 13px;
    font-weight: bold;
    line-height: 22px;
    color: #fff;
    z-index: 1;
    pointer-events: none;
  }

  .time-preview,
  .frame-preview {
    display: none;
  }

  .non-sticky:hover {
    display: none;
  }
}

.player:not(.touch):not(.size-ty) .seek-bar {
  &:hover,
  &.hover {
    .progress-bar:not(.chapters) {
      height: 2 * $progress-bar-height;
      border-radius: 2 * $progress-bar-border-radius;
      transform: translateY(-(math.div($progress-bar-height, 2)));

      .scrubber {
        top: -8px + $progress-bar-height;
      }
    }
  }
}

.player.touch .seek-bar .progress-bar {
  .virtual-progress,
  .time-preview,
  .frame-preview {
    display: none;
  }
}

.player.size-ty .seek-bar {
  padding: 12px 0;
  cursor: pointer;
  position: relative;
  float: left;
  width: calc(100% - 45px);
  margin: 1px 0;

  .frame-preview {
    display: none;
  }

  .time-preview {
    bottom: $progress-bar-height + 12px;
  }
}
