// Copyright (C) 2024 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-tag-input {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: inherit;
  outline: none; // Disable the default outline
  border: none; // Disable the default border
  border-bottom: solid 1px var(--pf-color-border); // Thin underline
  background: none;
  transition:
    border $anim-timing,
    box-shadow $anim-timing,
    background $anim-timing;

  // Round only the top corners to avoid rounding the edges of the underline
  border-radius: $border-radius $border-radius 0 0;

  input {
    outline: none;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    flex-grow: 1;
  }

  i {
    cursor: pointer;
    margin-left: 2px;
  }

  // The gentle hover effect indicates this component is interactive
  &:hover {
    background: color_hover(transparent);
  }

  &:focus-within {
    background: color_hover(transparent);
    border-bottom: solid 1px var(--pf-color-primary);

    // The box-shadow thickens the bottom border, without adding to the height.
    // This is the same technique used by materializecss:
    // See https://materializecss.com/text-inputs.html
    box-shadow: 0 1px 0 var(--pf-color-primary);
  }
}
