@tab-radius: 3px;
@modified-icon-width: 8px;
@tab-skew: 30deg;
@tab-top-padding: 5px;
@tab-bottom-border-height: 5px;
@tab-border: 1px solid @tab-border-color;
@tab-bar-bottom-border-color: @tab-border-color;
@tab-max-width: 160px;

.tab-bar {
  height: @tab-height + @tab-top-padding + @tab-bottom-border-height;
  background-image: -webkit-linear-gradient(top, @tab-bar-background-color, lighten(@tab-bar-background-color, 9%));
  box-shadow: inset 0 -8px 8px -4px rgba(0,0,0, .15);
  padding: 0 10px 0 25px;
  overflow-x: auto;
  overflow-y: hidden;

  &::-webkit-scrollbar {
    display: none;
  }

  .tab {
    position: relative;
    top: @tab-top-padding;
    max-width: @tab-max-width;
    height: @tab-height;
    line-height: @tab-height;
    color: @text-color;
    padding: 0;
    margin: 0 20px 0 5px;

    box-shadow: inset -1px -1px 1px rgba(0,0,0, .05);
    transition: color .1s ease-in;

    &, &:before, &:after {
      background-image: -webkit-linear-gradient(top, @tab-background-color, darken(@tab-background-color, 6%));
      border-top: @tab-border;
    }

    &:before, &:after {
      content: '';
      position: absolute;
      top: -1px;
      width: 25px;
      height: @tab-height;
    }

    // left angled edge
    &:before {
      left: -14px;
      border-top-left-radius: @tab-radius;
      border-left: @tab-border;
      box-shadow: inset 1px -1px 1px rgba(0,0,0, .05);
      -webkit-transform: skewX(-@tab-skew);
    }

    // right angled edge
    &:after {
      right: -14px;
      border-top-right-radius: @tab-radius;
      border-right: @tab-border;
      box-shadow: inset -1px -1px 1px rgba(0,0,0, .05);
      -webkit-transform: skewX(@tab-skew);
    }

    .close-icon {
      right: 0;
      z-index: 3;
      text-align: right;
      line-height: @tab-height;
      color: @text-color;

      &:hover {
        color: inherit;
      }
    }

    &.modified:not(:hover) .close-icon {
      right: 0;
      top: @tab-height/2 - @modified-icon-width/2 + 1px;
      width: @modified-icon-width;
      height: @modified-icon-width;
    }

    &.modified:hover .close-icon:hover {
      color: @text-color-highlight;
    }

    .title {
      position: relative;
      z-index: 1;
      margin-top: -@tab-top-padding - 1px;
      padding-top: @tab-top-padding + 1px;
      padding-right: 10px;
    }
  }

  .tab.active {
    z-index: 1;
    color: @text-color-highlight;

    .close-icon {
      line-height: @tab-height - 1px;
      color: @text-color;
    }

    &, &:before, &:after {
      background: @tab-background-color-active;
      height: @tab-height + 1px;
      box-shadow: none;
    }
  }

  .tab:hover {
    color: @text-color-highlight;
  }

  .tab.active:hover .close-icon {
    color: @text-color;

    &:hover {
      color: inherit;
    }
  }

  .placeholder {
    height: @tab-height + @tab-top-padding + @tab-bottom-border-height;
    pointer-events: none;
    &:before {
      margin-left: -9px; // center between tabs
    }
    &:after {
      top: @tab-height + @tab-top-padding + @tab-bottom-border-height - 2px;
      margin-left: -10px; // center between tabs
    }
  }
}

// border
.tab-bar + .item-views::before {
  content: "";
  position: absolute;
  top: -5px;
  height: @tab-bottom-border-height;
  left: 0;
  right: 0;
  background-color: @tab-background-color-active;
  border-top: 1px solid @tab-border-color;
  border-bottom: 1px solid @tab-bar-bottom-border-color;
  pointer-events: none;
}
