/**
 * Copyright (c) HashiCorp, Inc.
 * SPDX-License-Identifier: BUSL-1.1
 */

.tabs-container + .toolbar {
  border-top: 0;
}

.toolbar {
  background-color: $ui-gray-010;
  border: 1px solid $ui-gray-100;
  border-bottom-color: $ui-gray-300;
  border-top-color: $ui-gray-300;
  position: relative;

  &::after {
    background: linear-gradient(to right, $ui-gray-010, rgba($ui-gray-010, 0));
    bottom: 0;
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: $spacing-4;
    z-index: 2;
  }

  .input,
  .select {
    min-width: max-content;
  }
}

.toolbar-label {
  padding: $spacing-8;
  color: $grey;
}

.toolbar-scroller {
  align-items: center;
  display: flex;
  height: 3rem;
  justify-content: space-between;
  width: 100%;

  @include from($mobile) {
    padding: 0 $spacing-4;
  }

  &::-webkit-scrollbar {
    border-bottom: $base-border;
    height: $spacing-4;
  }

  &::-webkit-scrollbar-thumb {
    background: $ui-gray-300;
    border-radius: $spacing-4;
  }
}

.toolbar-filters,
.toolbar-actions {
  align-items: center;
  display: flex;
  flex: 1;
  white-space: nowrap;
  &:has(.hds-modal) {
    // toolbar buttons that open/close a modal pass attrs to the modal content
    white-space: wrap;
  }
}

.toolbar-filters + .toolbar-actions {
  @include until($mobile) {
    border-left: $base-border;
    margin-left: $spacing-8;
    padding-left: $spacing-8;
  }
}

.toolbar-actions {
  @include from($mobile) {
    justify-content: flex-end;
  }
}

.toolbar-link {
  @extend .button;
  @extend .is-ghost;
  @extend .has-icon-right;
  border: 0;
  color: $black;
  transition: background-color $speed;

  &:hover:not(.disabled) {
    background-color: $ui-gray-100;
    border: 0;
    color: $blue;
  }

  &:active {
    box-shadow: none;
  }

  &.popup-menu-trigger {
    height: 2.5rem;
    padding: $spacing-8 $spacing-12;
  }

  &.disabled {
    opacity: 0.5;
    cursor: default;

    &:focus {
      box-shadow: none;
    }
    &:hover {
      background: transparent;
    }
  }
}
a.disabled.toolbar-link {
  color: $black;
  background-color: $white;
  cursor: not-allowed;
  &:hover {
    background-color: $ui-gray-100;
    color: $blue;
  }
}

.toolbar-separator {
  border-right: $light-border;
  height: 32px;
  margin: 0 $spacing-8;
  width: 0;
}

.segment-filter {
  width: min-content;
}
