$annotation-color: $g20-white;
$annotation-color__drag: $c-hydrogen;

$window0: rgba($annotation-color,0);
$window15: rgba($annotation-color,0.15);
$window35: rgba($annotation-color,0.35);

$active-window0: rgba($annotation-color__drag,0);
$active-window15: rgba($annotation-color__drag,0.15);
$active-window35: rgba($annotation-color__drag,0.35);

$timestamp-font-size: 13px;
$timestamp-font-weight: 600;

.annotation {
  position: absolute;
  top: 8px;
  z-index: 3;
  background-color: $annotation-color;
  height: calc(100% - 36px);
  width: 2px;
  transform: translateX(-1px); // translate should always be half with width to horizontally center the annotation pos
  transition: background-color 0.25s ease;
  visibility: visible;

  &.dragging {
    background-color: $annotation-color__drag;
    z-index: 4;
  }

  &.expanded {
    z-index: 5;
  }
}

.annotation-point--flag {
  position: absolute;
  top: -3px;
  left: -2px;
  width: 6px;
  height: 6px;
  background-color: $annotation-color;
  border-radius: 50%;
  transition:
    transform 0.25s ease,
    background-color 0.25s ease;
}

.annotation-point--flag__dragging {
  @extend .annotation-point--flag;
  transform: scale(1.5,1.5);
  background-color: $annotation-color__drag;
}

.annotation-span--flag {
  position: absolute;
  z-index: 2;
  top: -6px;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-radius: 0;
  background: none;
  transition: transform 0.25s ease;

  &.mouseover {
    transform: scale(1.5,1.5);
  }
}

.annotation-span--left-flag {
  @extend .annotation-span--flag;
  transform-origin: 0% 50%;
  left: 0;
  border-left-color: $annotation-color;

  &.dragging {
    border-left-color: $annotation-color__drag;
  }
}

.annotation-span--right-flag {
  @extend .annotation-span--flag;
  transform-origin: 100% 50%;
  right: 0;
  border-right-color: $annotation-color;

  &.dragging {
    border-right-color: $annotation-color__drag;
  }
}


.annotation-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background-color: $g0-obsidian;
  padding: 6px 12px;
  border-radius: 4px;
  white-space: nowrap;
  user-select: none;
  display: flex;
  @extend %drop-shadow;

  &:before {
    content: '';
    display: block;
    position: absolute;
    width: calc(100% + 16px);
    height: calc(100% + 28px);
    top: -14px;
    left: -8px;
    z-index: -1;
  }

  &.hidden {
    display: none;
  }
}

.annotation-tooltip--lower {
  display: flex;
  align-items: center;
  position: relative;
}

.annotation-tooltip--timestamp {
  color: $c-laser;
  display: block;
  font-size: $timestamp-font-size;
  font-weight: $timestamp-font-weight;
}
.annotation-tooltip--items {
  display: flex;
  flex-direction: column;
  align-items: stretch;

  > div {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
  }
}
.annotation-tooltip--edit {
  cursor: pointer;
  padding-left: 10px;
  
  &:hover {
    color: $g20-white;
  }
}

.annotation-tooltip-text {
  font-size: $timestamp-font-size;
  color: $g18-cloud;
  font-weight: $timestamp-font-weight;
}

.annotation-tag-count {
  display: inline-flex;
  align-content: center;
  margin-left: 4px;
  font-size: 12px;
  font-weight: bold;
  height: 16px;
  line-height: 16px;
  padding: 0 8px;
  border-radius: 8px;
  color: $g20-white;
  background-color: $c-pool;
  transition: background-color 0.25s ease, color 0.25s ease;

  &:hover {
    cursor: pointer;
    background-color: $c-laser;
  }
}

.annotation-tooltip--tags {
  width: 100%;
  top: 100%;
  position: absolute;
  display: none;
  padding-top: 4px;
  left: 0;
}

.annotation-tag-count:hover .annotation-tooltip--tags {
  display: flex;
}

.annotation-tooltip--tags-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background-color: $c-pool;
  border-radius: 4px;
  overflow: hidden;
  @extend %drop-shadow;

  > span {
    line-height: 12px;
    font-size: 12px;
    white-space: nowrap;
    color: $c-yeti;
    padding: 4px 8px;

    strong {
      color: $c-neutrino;
    }

    &:hover {
      color: $g20-white;
      background-color: $c-laser;

      strong {
        color: $c-yeti;
      }
    }
  }

  &:after {
    content: '';
    top: -4px;
    width: 100%;
    height: 4px;
    position: absolute;
  }
}

.annotation--click-area {
  position: absolute;
  top: -8px;
  left: -7px;
  width: 16px;
  height: 16px;
  z-index: 3;
  cursor: default;
}

.annotation-window {
  position: absolute;
  top: 8px;
  background: linear-gradient(to bottom, $window15 0%, $window0 100%);
  border-top: 2px dotted $window35;
  z-index: 1;

  &.active {
    background: linear-gradient(to bottom, $active-window15 0%, $active-window0 100%);
    border-top: 2px dotted $active-window35;
  }
}


/*
  New Annotations
  ------------------------------------------------------------------------------
*/
.new-annotation {
  position: absolute;
  z-index: 9999;
  top: 8px;
  width: calc(100% - 32px);
  height: calc(100% - 16px);
  cursor: pointer;
}


.new-annotation.hover .new-annotation--crosshair {
  opacity: 1;
}

.new-annotation--crosshair {
  opacity: 0;
  position: absolute;
  top: 0;
  height: calc(100% - 20px);
  width: 2px;
  transform: translateX(-1px);
  background: linear-gradient(to bottom, $c-hydrogen 0%, $c-pool 100%);
  transition: opacity 0.4s ease;
  z-index: 5;
  cursor: pointer;
}

.new-annotation-tooltip {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(to bottom, $c-pool 0%,$c-ocean 100%);
  border-radius: 4px;
  padding: 6px 12px;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.new-annotation-helper {
  white-space: nowrap;
  font-size: 13px;
  line-height: 13px;
  font-weight: 600;
  color: $c-neutrino;
  margin-bottom: 4px;
}

.new-annotation-timestamp {
  white-space: nowrap;
  font-size: $timestamp-font-size;
  line-height: $timestamp-font-size;
  font-weight: $timestamp-font-weight;
  color: $g20-white;
}
