// 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 "./common.scss";

.pf-exp-node-explorer {
  background-color: var(--pf-color-background);
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
  border-left: 1px solid var(--pf-color-border);
  border-top: 1px solid var(--pf-color-border);
  border-bottom: 1px solid var(--pf-color-border);

  &__header {
    display: flex;
    align-items: flex-start;
    border-bottom: 1px solid var(--pf-color-border);
    flex-shrink: 0;
  }

  &__title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem;
    flex-grow: 1;

    .pf-button {
      margin-left: 0.5rem;
    }

    .title {
      display: flex;
      align-items: center;
      gap: 0.5rem;

      h2 {
        font-weight: bold;
        font-size: var(--pf-exp-font-size-md);
        color: var(--pf-color-text);
      }
    }
  }

  &__collapse-button {
    padding: 0.375rem;
    flex-shrink: 0;
  }

  article {
    padding: 0.375rem;
    font-size: var(--pf-exp-font-size-sm);
    flex-grow: 1;
    flex-shrink: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  &.collapsed {
    display: none;
  }

  i.pf-exp-node-explorer__warning-icon--error {
    color: var(--pf-color-danger);
  }

  i.pf-exp-node-explorer__warning-icon--warning {
    color: var(--pf-color-warning);
  }

  .pf-exp-node-explorer__comment {
    border: 1px solid var(--pf-color-border);
    border-radius: 4px;
    background-color: var(--pf-color-background);
    resize: vertical;
    font-family: var(--pf-font);
    font-size: var(--pf-exp-font-size-sm);
    padding: 0.5rem;
    width: 100%;
    min-height: 200px;
  }
}

.pf-exp-node-explorer-sql-source {
  article {
    padding: 0;
    border: none;
  }
}

.pf-exp-query-operations {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pf-exp-operations-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pf-exp-aggregations-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pf-exp-aggregation-editor {
  @extend .pf-exp-editor;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pf-exp-aggregation-viewer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  border-radius: 4px;
  gap: 0.5rem;

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

  span {
    cursor: pointer;
    flex-grow: 1;
  }

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