/**
 * @license
 * Copyright 2024 The Model Explorer Authors. All Rights Reserved.
 *
 * 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.
 * ==============================================================================
 */

:host {
  overflow: hidden;
}

.container {
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  position: relative;

  &.has-overflow,
  &.has-multiple-lines {
    cursor: pointer;

    .icon-container {
      display: flex;
    }

    &:hover .icon-container {
      opacity: 1;
    }
  }

  &.has-bg-color {
    border-radius: 4px;
    padding-left: 4px;
  }

  &.expanded {
    .one-line-text {
      position: absolute;
      inset: 0;
      visibility: hidden;
    }

    .expanded-text {
      display: block;
      flex-grow: 1;
      cursor: text;

      .info-msg {
        margin-bottom: 2px;
        color: #999;
        font-size: 12px;

        .underline {
          text-decoration: underline dashed;
        }
      }

      .monospace-content {
        font-size: 11px;
        white-space: pre-wrap;
        font-family: monospace;
        max-height: 500px;
        overflow: auto;
      }

      .text-content {
        white-space: pre-wrap;
        max-height: 500px;
        overflow: auto;
      }

      .namespace-content {
        display: flex;
        flex-direction: column;
        gap: 2px;
      }

      .namespace-row {
        font-size: 12px;
        line-height: 14px;
        display: flex;
        align-items: flex-start;

        .index {
          width: 16px;
          color: #999;
          flex-shrink: 0;
          line-height: 14px;
        }

        .namespace {
          line-height: 14px;

          &.hidden {
            color: #999;
          }
        }
      }
    }

    .icon-container {
      background-color: #eee;
      border: 1px solid #999;

      mat-icon {
        color: #999;
      }
    }
  }

  .one-line-text {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .expanded-text {
    display: none;
  }

  .icon-container {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    display: none;
    background-color: #d7f1ff;
    border-radius: 2px;
    margin-left: 2px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    border: 1px solid #4e90b5;
    opacity: .75;

    mat-icon {
      color: #00639b;
      font-size: 11px;
      width: 11px;
      height: 11px;
      font-weight: 700;
    }
  }
}