// Copyright (C) 2018 The Trustees of Indiana University
// SPDX-License-Identifier: BSD-3-Clause

@use '../core' as *;
@use 'sass:map';

.#{$prefix}-input-group {
  display: flex;
  flex-wrap: nowrap;
  position: relative;

  &__input:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    z-index: map.get($z-index, '100');
  }

  &__input:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    z-index: map.get($z-index, '100');
  }

  &__input:focus:not(:last-child),
  &__input:focus:not(:first-child) {
    z-index: map.get($z-index, '300');
  }

  &__append {
    flex-grow: 1;
    margin-left: -1px;

    .#{$prefix}-button {
      flex-grow: 1;
      z-index: map.get($z-index, '200');
      border-top-left-radius: 0;
      border-bottom-left-radius: 0;
      display: flex;
      white-space: nowrap;
    }
  }

  &__append &__text,
  &__prepend &__text {
    background-color: $color-black-100;
    border: 1px solid $color-black-700;
    display: flex;
    align-items: center;
    height: 100%;
    padding-right: $spacing-sm * .75;
    padding-left: $spacing-sm * .75;
  }

  &__append &__text {
    border-top-right-radius: $spacing-xxs;
    border-bottom-right-radius: $spacing-xxs;
  }

  &__prepend &__text {
    border-top-left-radius: $spacing-xxs;
    border-bottom-left-radius: $spacing-xxs;
  }

  &__prepend {
    margin-right: -1px;

    .#{$prefix}-button {
      z-index: map.get($z-index, '200');
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
      display: flex;
      white-space: nowrap;
    }
  }
}
