// Copyright (C) 2023 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.

.pf-flamegraph {
  height: 100%;
  overflow-y: hidden;

  .loading-container {
    font-size: larger;
    display: flex;
    align-items: baseline;
    justify-content: center;
    height: 100%;
  }

  .filter-bar {
    margin: 6px 8px;
    display: flex;
    column-gap: 6px;
    align-items: baseline;

    .pf-tag-input {
      flex-grow: 1;
    }

    .pf-select {
      flex-shrink: 0;
    }
  }

  .pf-tag-input {
    flex: 1 1 0;
    min-width: 0;
    max-height: 60px;
    overflow-y: auto;
    flex-wrap: wrap;
    gap: 6px;

    // Override the inner Stack to allow wrapping and add gaps
    .pf-stack {
      flex-wrap: wrap;
      gap: 6px;
    }

    .pf-chip {
      max-width: 200px;
      min-width: auto;
    }

    input {
      min-width: 80px;
    }
  }

  .pf-flamegraph-filter-bar-separator {
    width: 1px;
    height: 24px;
    background: var(--pf-color-border);
    flex-shrink: 0;
    margin: 0 4px;
    align-self: center;
  }

  .pf-flamegraph-filter-label {
    font-weight: 500;
    flex-shrink: 0;
  }

  .popup-anchor {
    width: 0px;
    height: 0px;
    position: absolute;
  }

  canvas {
    user-select: none;
  }

  .canvas-container {
    height: 100%;
    position: relative;
    overflow-y: auto;
  }

  .pf-virtual-canvas {
    height: 100%;
  }
}

.pf-flamegraph-tooltip-popup {
  width: max-content;
  font-size: 15px;
  display: flex;
  flex-direction: column;
  padding: 4px;

  .tooltip-text-line {
    display: flex;
    cursor: text;
    padding-top: 4px;
    gap: 4px;
  }

  .tooltip-text {
    cursor: text;
  }

  .tooltip-bold-text {
    font-weight: 600;
    cursor: text;
  }

  .pf-button-bar {
    padding-top: 16px;
  }

  .tooltip-marker-text {
    font-size: var(--pf-font-size-s);
    font-style: italic;
    color: var(--pf-color-text-muted);
    padding-bottom: 4px; // Extra gap between marker and function name
  }
}

.pf-filter-builder {
  &.pf-popup {
    min-width: 300px;
    > .pf-popup-content {
      padding: 12px;
    }
  }
  &__separator {
    height: 1px;
    background: var(--pf-color-border);
    margin: 12px 0 8px 0;
  }
  &__tip {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: smaller;
    color: var(--pf-color-text-muted);
    padding-bottom: 8px;
  }
  &__help {
    font-size: 13px;
  }
  &__help-title {
    font-weight: 500;
    margin-bottom: 4px;
  }
  &__help-row {
    margin: 4px 0;
  }
  &__desc,
  &__warn {
    font-size: smaller;
    margin-bottom: 8px;
  }
  &__desc {
    color: var(--pf-color-text-muted);
  }
  &__warn {
    color: var(--pf-color-warning);
  }
}
