@use "sass:map";
@use '@angular/material' as mat;
@import '../_variables.scss';

.navbar {
  display: flex;
}

.navbar-expand .navbar-nav {
  flex-direction: row;
}

li button svg * {
  fill: $breadcrumbItemColor !important; /* Redefines any custom home icon style */
}

li.secondary button svg path {
  fill: var(--plt-text-primary) !important; /* Redefines any custom home icon style */
}

mat-toolbar .mat-mdc-button:not(.icon-margin) .mat-icon {
  width: 24px;
  height: 24px;
  margin-right: 0;
  font-size: 24px;
}

mat-toolbar .mat-mdc-button .arrow-down-icon {
  width: 7px;
  height: 7px;
  margin-top: 30px;
}

app-nav-menu-navigation {
  .adaptive-more-button {
    vertical-align: top;

    mat-icon {
      margin: 0;
    }
  }
}

header {

  .tabs-toolbar {
    width: 100%;
    height: var(--nav-bar-height);
    overflow: hidden;
    min-height: unset;

    mat-toolbar-row {
      padding-left: 0;
      padding-right: 0;
    }

    .navbar-item {
      height: var(--nav-bar-height);
      display: inline-block;
      padding: 0 15px;
      cursor: pointer;
      border-bottom: 2px solid transparent;
      box-sizing: border-box;
      text-align: center;
      filter: brightness(85%);

      &:hover {
        border-color: rgba(white, 0.5);
      }

      &.navbar-item-selected {
        background: none;
        border-color: white;
        filter: brightness(100%);
      }
    }

    .navbar-item-text {
      display: inline-block;
      margin-top: -4px;
      font-size: var(--text-body-1);
      font-weight: normal;
    }

    .navbar-item {
      .mat-icon {
        display: block;
        margin: 3px auto -1px auto;

        .st-primary {
          fill: white;
        }

        .st-secondary {
          fill: white;
        }
      }
    }
  }
}

@mixin tab-styles($hovered, $pressed, $selected) {
  &:hover {
    background-color: $hovered;
  }

  &.mdc-tab--active {
    background-color: $selected;
  }

  .mdc-tab__ripple::before {
    opacity: 0 !important;
  }

  .mat-ripple .mat-ripple-element {
    background-color: $pressed !important;
    opacity: 1;
  }
}

@mixin tab-pagination-styles() {
  .mat-ripple-element {
    background-color: black !important;
    opacity: 0.15;
  }
}

@mixin nav-bar($theme) {
  $hovered: #{map.get($theme, 600)};
  $pressed: #{map.get($theme, 800)};
  $selected: #{map.get($theme, 700)};

  .navbar-tab {
    @include tab-styles($hovered, $pressed, $selected);
  }

  .navbar-tab-header-container {
    & > mat-tab-header {
      & > .mat-mdc-tab-header-pagination {
        @include tab-styles(null, $pressed, $selected);
        @include tab-pagination-styles();
      }

      path {
        fill: $navbarTextColor;
      }
    }
  }

  .navbar-content {
    .mdc-tab {
      @include tab-styles($hovered, $pressed, $selected);
    }

    .mat-mdc-tab-header-pagination {
      @include tab-pagination-styles();
    }

    .toolbar-button[aria-expanded='true'] {
      background-color: $selected;
    }

    .mat-mdc-button {
      &:hover {
        background-color: $hovered;
      }

      &[aria-expanded='true'] {
        background-color: $selected;
      }

      .mat-ripple .mat-ripple-element {
        background-color: rgb(0 0 0 / 0.15);
      }

      .mdc-button__ripple::before {
        opacity: 0 !important;
      }
    }
  }
}

@mixin nav-bar-underline($theme) {
  .mat-tabs-with-background.mat-primary {
    > .mat-mdc-tab-header, > .mat-mdc-tab-link-container {
      .mdc-tab-indicator__content--underline {
        border-color: rgb(255 255 255 / 65%) !important;
      }
    }
  }
}
