// Copyright (C) 2025 The Android Open Source Project
//
// 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 "../assets/theme";

.pf-tabs {
  display: flex;
  flex-direction: column;
  height: 100%;

  &__tabs {
    display: flex;
    background-color: var(--pf-color-background-secondary);
    border-bottom: 1px solid var(--pf-color-border);
    padding-inline: 3px;
    align-items: baseline;
  }

  &__tab {
    display: flex;
    align-items: baseline;
    gap: 2px;
    font-family: var(--pf-font-compact);
    padding: 5px 7px;
    margin-top: 2px;
    margin-bottom: -1px; // Overlap the border
    cursor: pointer;

    border-radius: 3px 3px 0 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    border-style: solid;
    border-color: transparent;
    border-width: 1px 1px 0 1px;
    color: var(--pf-color-text-muted);

    &:hover {
      background: color_hover(transparent);
      color: var(--pf-color-text);
    }

    &-icon {
      align-self: center;
    }

    &--active {
      cursor: default;
      background-color: var(--pf-color-background);
      border-color: var(--pf-color-border);
      color: var(--pf-color-text);
      z-index: 1;

      // Don't change background on hover for active tab
      &:hover {
        background-color: var(--pf-color-background);
      }
    }
  }

  &__tab-menu-btn {
    visibility: hidden;

    &.pf-active {
      visibility: visible;
    }
  }

  &__tab:hover &__tab-menu-btn {
    visibility: visible;
  }

  &__tab-title {
    margin: 0px 4px;
    overflow: hidden;
    user-select: none;
  }

  &__tab-rename-input {
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    color: inherit;
    padding: 0;
    margin: 0 4px;
    width: 100%;
  }

  &__tab-wrapper {
    display: contents;

    &--dragging > .pf-tabs__tab {
      opacity: 0.5;
    }

    &--drop-before > .pf-tabs__tab {
      box-shadow: -2px 0 0 0 var(--pf-color-primary);
    }

    &--drop-after > .pf-tabs__tab {
      box-shadow: 2px 0 0 0 var(--pf-color-primary);
    }
  }

  &__new-tab-btn {
    margin-left: 2px;
  }

  &__right-content {
    margin-left: auto;
    display: flex;
    align-items: baseline;
  }

  &__content {
    flex: 1;
    overflow: auto;
  }
}
