// 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";
@import "./graph/graph.scss";
@import "./empty_graph.scss";
@import "./help.scss";
@import "./graph/node_box.scss";
@import "./node_explorer.scss";
@import "./operations/operation_component.scss";
@import "./nodes/sources/slices_source.scss";
@import "./nodes/sources/table_source.scss";
@import "./nodes/aggregation_node.scss";
@import "./nodes/modify_columns_node.scss";

.pf-query-builder-layout {
  height: 100%;

  // SplitPanel's main section needs to have the grid layout
  .pf-split-panel__main {
    display: grid;
    grid-template-columns: 1fr auto auto;
    overflow: hidden;
  }

  .pf-qb-node-graph {
    grid-column: 1;
    overflow: auto;
    position: relative;
  }

  .pf-qb-explorer {
    grid-column: 2;
    overflow: hidden;
    width: 500px;
    height: 100%;
    transition:
      width 0.3s ease,
      border-left 0.3s ease;
  }

  .pf-qb-side-panel {
    grid-column: 3;
    width: 60px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
    background-color: var(--pf-color-surface);
    border-left: 1px solid var(--pf-color-border);
    padding: 0;
    align-items: stretch;
    justify-content: flex-start;

    .pf-button {
      width: 100%;
      height: 60px;
      font-size: 20px;
      box-shadow: none;
      border: none;
      border-radius: 0;
      border-bottom: 1px solid var(--pf-color-border);
      background-color: var(--pf-color-surface);

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

      &.pf-active {
        background-color: var(--pf-color-primary);
        color: white;
      }
    }
  }

  .pf-qb-floating-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;

    .pf-button {
      width: 60px;
      height: 60px;
      font-size: 28px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);

      &:hover {
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
        transform: scale(1.05);
      }
    }
  }

  .pf-qb-floating-controls-bottom {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;

    .pf-button {
      width: 40px;
      height: 40px;
      font-size: 20px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);

      &:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        transform: scale(1.05);
      }
    }
  }

  .pf-qb-floating-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--pf-color-danger);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;

    &:hover {
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
      transform: scale(1.05);
    }

    .pf-qb-warning-icon {
      color: white;
      font-size: 28px;
    }
  }

  &.explorer-collapsed {
    .pf-qb-explorer {
      width: 0;
      border-left: none;
      overflow: hidden;
    }
  }
}
