@import '../../vendor/carbon-components/scss/globals/scss/vars';

$hoverBgColor: #2c2c2c;

.#{$prefix}--header {
  .#{$prefix}--skip-to-content:focus {
    min-width: 240px;
    justify-content: center;
    border: $spacing-01 solid $ui-01;
  }

  &__menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  & .#{$prefix}--header__name {
    padding-left: $spacing-03;
    min-width: 150px;
    display: inline-flex;

    > span.#{$prefix}--header__name--prefix {
      white-space: nowrap;
      overflow: visible;
      display: initial;
    }

    > span {
      display: none;
      @media (min-width: 672px) {
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
        display: initial;
      }
    }

    > span.#{$iot-prefix}--header__short-name {
      white-space: nowrap;
      display: initial;

      @media (min-width: 672px) {
        display: none;
      }
    }
  }

  &__menu-title[role='menuitem'][aria-expanded='true'] + &__menu {
    left: auto;
    right: 0;
  }

  &__menu {
    min-width: 12.5rem;
    width: auto;
  }

  &__menu-item[role='menuitem']:focus {
    border-color: $ui-01;
    outline: none;
  }

  .#{$iot-prefix}--header__overflow-menu-container {
    position: relative;
  }

  .#{$prefix}--overflow-menu {
    &:hover {
      background-color: $gray-90;
    }
    &--open {
      background-color: $gray-90;
    }

    &-options {
      background-color: $gray-90;

      &::after {
        background-color: $gray-90;
        width: $spacing-09;
      }

      &__btn {
        color: $shell-header-text-02;
        background-color: $gray-90;
        text-decoration: none;
      }
    }

    &__icon {
      fill: $ui-01;
    }

    .#{$prefix}--header__submenu.#{$prefix}--header-action-btn {
      padding: 0;

      .#{$prefix}--header__menu-item.#{$prefix}--header__menu-title {
        justify-content: flex-start;
        padding-left: $spacing-05;
        padding-right: $spacing-05;
        text-decoration: none;
        color: $shell-header-text-02;
      }
    }

    .#{$prefix}--header-action-btn {
      height: 100%;
      width: 100%;
      justify-content: flex-start;
      padding-left: $spacing-05;
      padding-right: $spacing-05;
      text-decoration: none;
      color: $shell-header-text-02;
    }
  }
}

.#{$iot-prefix}--header__subtitle {
  @include type-style('body-short-01');
  border-left: $icon-02 1px solid;
  padding: $spacing-01 $spacing-05;
  color: $disabled-02;
  margin-left: $spacing-05;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.#{$prefix}--overflow-menu {
  align-items: center;
  display: inline-flex;
  height: 3rem;
  justify-content: center;
  width: 3rem;
  padding: 0;
}

.#{$prefix}--header-action-btn {
  align-items: center;
  display: inline-flex;
  height: 3rem;
  justify-content: center;
  width: 3rem;
  padding: 0;

  .#{$prefix}--header__menu-item {
    &[role='menuitem'] {
      height: 100%;
      justify-content: center;
      padding: 0;
      width: 100%;
    }
    span {
      display: inline;
    }
  }

  span {
    display: flex;
  }
}

.#{$prefix}--header__menu .#{$prefix}--header__menu-item[role='menuitem'] {
  display: flex;
  align-items: center;
  color: $active-ui;
  height: 100%;
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.125rem;
  text-decoration: none;
  user-select: none;
  border: 2px solid #0000;
  transition: background-color $duration--fast-02, border-color $duration--fast-02,
    color $duration--fast-02;
  justify-content: center;
  padding: 0;
  width: 100%;

  &:focus {
    border-color: $inverse-focus-ui;
  }
}

.#{$prefix}--app-switcher {
  background-color: $ui-01;
  border: none;
}

.action-btn__headerpanel {
  outline: none;

  &--closed * {
    display: none;
  }
}

.#{$prefix}--header__menu-item:not(svg) {
  position: relative;
  display: flex;
  align-items: center;
  color: $shell-header-text-02;
  padding: 0 mini-units(2);
  // Used for links that are directly in the menubar to span the full height
  height: 100%;
  // Text styles
  @include carbon--type-style('body-short-01');
  // Reset link styles and make sure the text isn't selectable
  text-decoration: none;
  user-select: none;
  // Used for focus styles
  border: 2px solid transparent;
  transition: background-color $duration--fast-02, border-color $duration--fast-02,
    color $duration--fast-02;
}

button.#{$prefix}--header__menu-item {
  background: none;
  width: 100%;

  &:focus {
    border-color: $inverse-focus-ui;
    color: $ui-02;
    outline: none;
  }
}
