// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC
@import "refactor/common-refactor.scss";

.tab-container {
  display: grid;
  grid-template-rows: $s-32 1fr;
  height: 100%;
}

.tab-container-tabs {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: $s-2;
  border-radius: $br-8;
  background: var(--tabs-background-color);
  cursor: pointer;
  font-size: $fs-12;
  height: 100%;
}

.tab-container-tab-wrapper {
  display: grid;
  grid-auto-flow: column;
  height: 100%;
  width: 100%;
}

.tab-container-tab-title {
  @include flexCenter;
  height: 100%;
  width: 100%;
  padding: 0 $s-8;
  margin: 0;
  border-radius: $br-8;
  background-color: transparent;
  color: var(--tab-foreground-color);
  border: $s-2 solid var(--tab-border-color);
  min-width: 0;

  svg {
    @extend .button-icon;
    stroke: var(--tab-foreground-color);
  }

  .content {
    @include headlineSmallTypography;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  &.current,
  &.current:hover {
    background: var(--tab-background-color-selected);
    border-color: var(--tab-border-color-selected);
    color: var(--tab-foreground-color-selected);

    svg {
      stroke: var(--tab-foreground-color-selected);
    }
  }

  &:hover {
    color: var(--tab-foreground-color-hover);

    svg {
      stroke: var(--tab-foreground-color-hover);
    }
  }
}

.collapse-sidebar {
  @include flexCenter;
  @include buttonStyle;
  height: 100%;
  width: $s-24;
  min-width: $s-24;
  padding: 0 $s-6;
  border-radius: $br-5;

  svg {
    @include flexCenter;
    height: $s-16;
    width: $s-16;
    stroke: var(--icon-foreground);
    transform: rotate(180deg);
    fill: none;
    color: transparent;
  }

  &:hover {
    svg {
      stroke: var(--icon-foreground-hover);
    }
  }

  &.collapsed {
    svg {
      transform: rotate(0deg);
      padding: 0 0 0 $s-6;
    }
  }
}

.tab-container-content {
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

//Firefox doesn't respect scrollbar-gutter
@supports (-moz-appearance: none) {
  .tab-container-content {
    padding-right: $s-8;
  }
}
