/*
 * Copyright 2015-2016 Imply Data, Inc.
 * Copyright 2017-2019 Allegro.pl
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@import './utils/sizes';
@import '../../imports';

.top-labels {
  @include border-css-variable(border-bottom, 1px, solid, border-super-light);
  background-color: #fff;
  padding-left: 2px;
  height: 100%;
  white-space: nowrap;
  display: flex;
  align-items: flex-end;

  .heatmap-label-wrapper {
    display: inline-block;
    width: $heatmap-rectangle-size;
    height: $heatmap-rectangle-size;
    overflow: visible;
    white-space: nowrap;
    box-sizing: border-box;
    transform: rotate(-90deg);
    flex-shrink: 0;
  }

  .heatmap-label {
    display: inline-block;
    padding-left: 5px;
    padding-top: 5px;
    height: $heatmap-rectangle-size - $heatmap-rectangle-gap;
  }

  .heatmap-label-overflow-container {
    width: 100%;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .heatmap-label-hovered .heatmap-label {
    background: linear-gradient(to right, $hover, #fff);
  }

  .heatmap-label-highlight .heatmap-label {
    background: $hover;

    &::after {
      @include unpin-full(-1px, 0, -1px, 0);
      @include border-css-variable(border, 1px, dashed, highlight-border);
      content: '';
      border-left: 0;
    }
  }

  &::after {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    content: '';
    pointer-events: none;
    box-shadow: inset -65px 0 50px -40px #fff;
    border-radius: 2px;
  }
}

.left-labels {
  @include border-css-variable(border-right, 1px, solid, border-super-light);
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  height: 100%;

  .heatmap-label-wrapper {
    height: $heatmap-rectangle-size - $heatmap-rectangle-gap;
    margin-bottom: 2px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
  }

  .heatmap-label {
    line-height: 1.5em;
    height: $heatmap-rectangle-size - $heatmap-rectangle-gap;
    padding-left: 5px;
    padding-right: 5px;
    white-space: nowrap;
  }

  .heatmap-label-overflow-container {
    width: 100%;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .heatmap-label-hovered .heatmap-label {
    background: linear-gradient(to left, $hover, #fff);
  }

  .heatmap-label-highlight .heatmap-label {
    background: $hover;

    &::after {
      @include unpin-full(-1px, 0, -1px, 0);
      @include border-css-variable(border, 1px, dashed, highlight-border);
      content: '';
      border-right: 0;
    }
  }

  &::after {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    content: '';
    pointer-events: none;
    box-shadow: inset 0 -65px 50px -40px #fff;
    border-radius: 2px;
  }
}

