@import '../../variables';

.wrapper {
  display: flex;
  flex-direction: column;
  gap: $space-xs;
}

.strip {
  display: flex;
  height: $space-xl;
  overflow: visible;
  border-radius: var(--border-radius-small);
  border: 1px solid var(--color-neutral-20);
}

.shade {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  transition: flex 0.3s ease;
  cursor: pointer;

  &[data-hovered] {
    flex: 2.5 1 0;
  }

  &[data-selected]::before {
    content: '';
    position: absolute;
    top: calc(100% + 4px);
    left: calc(50% - 2px);
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    pointer-events: none;
    animation: fade-in 0.3s ease;
  }

  &[data-selected]::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid white;
    pointer-events: none;
  }

  &:first-child,
  &:first-child[data-selected]::after {
    border-top-left-radius: var(--border-radius-small);
    border-bottom-left-radius: var(--border-radius-small);
  }

  &:last-child,
  &:last-child[data-selected]::after {
    border-top-right-radius: var(--border-radius-small);
    border-bottom-right-radius: var(--border-radius-small);
  }
}

.tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  padding: $space-xs $space-s;
  border-radius: var(--border-radius-tiny);
  background: var(--color-neutral-10);
  border: 1px solid rgba(var(--color-neutral-60-rgb), var(--opacity-level-light));
  filter: var(--shadow-level-4);
  color: var(--color-neutral-100);
  font-size: $font-small;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
  animation: fade-in 0.3s ease;

  &::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--color-neutral-10);
  }

  &::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(var(--color-neutral-60-rgb), var(--opacity-level-light));
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
