// 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 "../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: flex-end;
  }

  &__tab {
    display: flex;
    align-items: baseline;
    gap: 2px;

    font-family: var(--pf-font-compact);

    padding: 5px;
    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: var(--pf-color-border-secondary);
    border-width: 1px 1px 0 1px;

    &:not(:first-child) {
      margin-left: -1px;
    }

    &:hover {
      background: color_hover(transparent);
    }

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

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

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

  &__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);
    }
  }

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