// 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";

.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: $s-32;
  width: 100%;
  min-height: $s-32;
  background-color: var(--title-background-color);
  color: var(--title-foreground-color);
}

.title,
.title-only,
.inspect-title {
  @include headlineSmallTypography;
  display: grid;
  align-items: center;
  justify-content: flex-start;
  grid-auto-flow: column;
  height: 100%;
  min-height: $s-32;

  overflow: hidden;
}

.title-only {
  --title-bar-title-margin: #{$s-8};
  margin-inline-start: var(--title-bar-title-margin);
}

.inspect-title {
  color: var(--title-foreground-color-hover);
}

.title-wrapper {
  display: flex;
  align-items: center;
  flex-grow: 1;
  padding: 0;
  color: var(--title-foreground-color);
  stroke: var(--title-foreground-color);
  overflow: hidden;

  &:hover {
    color: var(--title-foreground-color-hover);
    .title {
      stroke: var(--title-foreground-color-hover);
    }
  }
}

.title-button {
  @extend .button-tertiary;
  height: $s-32;
  width: calc($s-24 + $s-4);
  padding: 0;
  border-radius: $br-8;
  svg {
    @extend .button-icon;
    stroke: var(--icon-foreground);
  }
}

.title-only-icon-gap {
  --title-bar-title-margin: #{$s-12};
}

.toggle-btn {
  @include buttonStyle;
  display: flex;
  align-items: center;
  flex-grow: 1;
  padding: 0;
  color: var(--title-foreground-color);
  stroke: var(--title-foreground-color);
  overflow: hidden;

  --chevron-icon-color: var(--icon-foreground);

  &:hover {
    --chevron-icon-color: var(--title-foreground-color-hover);

    color: var(--title-foreground-color-hover);
    .title {
      color: var(--title-foreground-color-hover);
      stroke: var(--title-foreground-color-hover);
    }
  }
}

.collapsabled-icon {
  @include buttonStyle;
  @include flexCenter;
  height: $s-24;
  border-radius: $br-8;

  --chevron-icon-rotation: 90deg;

  &.collapsed {
    --chevron-icon-rotation: 0deg;
  }

  &:hover {
    --chevron-icon-color: var(--title-foreground-color-hover);
  }
}

.chevron-icon {
  @extend .button-icon-small;
  transform: rotate(var(--chevron-icon-rotation));
  stroke: var(--chevron-icon-color);
}
