
@import "../../../mixins/_border-radius.less";
@import "../../../mixins/_tab-focus.less";

.nav-tabs {
  display: flex;
  background-color: @nav-tabs-background-default;
  box-shadow: inset 0 -1px 0 0 @nav-tabs-border-color-default;
  color: @nav-tabs-color-default;

  > div,
  li {
    flex: 0 0 auto;
    > a,
    > button:not(.btn-clean) {
      padding: @nav-tabs-padding;
      height: @size-64;
      border: none;
      background-color: transparent;
      color: @nav-tabs-color-default;
      line-height: @line-height-base;
      display: flex;
      flex-direction: column;
      transition: all 0.15s ease;
      position: relative;
      text-decoration: none;
      .label {
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
      }
      @media (min-width: @grid-float-breakpoint) {
        flex-direction: row;
        height: @size-48;
      }

      > [class^='dlt-c8y-icon-'],
      > [class*=' dlt-c8y-icon-'],
      > .c8y-icon {
        display: block;
        margin: 0 auto;
        margin-top: -2px;
        width: 1em;
        height: 18px;
        color: @nav-tabs-icon-color-default;
        font-size: @nav-tabs-icon-size;
        @media (min-width: @grid-float-breakpoint) {
          display: inline-block;
          margin-top: 0;
          margin-left: 0;
          margin-right: @size-8;
          vertical-align: text-top;
        }
      }
      &:hover:not([disabled]) {
        outline: 2px solid @component-color-focus;
        outline-offset: -2px;
        background-color: @nav-tabs-background-hover;
        text-decoration: none;
        // border-radius: @component-border-radius-focus;
        > [class^='dlt-c8y-icon-'],
        > [class*=' dlt-c8y-icon-'],
        > .c8y-icon {
          color: @nav-tabs-icon-color-hover;
        }
      }
      &:focus {
        .c8y-focus-inset();
      }
      &[disabled] {
        opacity: @component-disabled-opacity !important;
        cursor: @cursor-disabled !important;
      }
    }
    // Active state, and its :hover to override normal :hover

    &.active{
      background-color: @nav-tabs-background-active;
    }
    &.active > a,
    &.active > button:not([disabled]) {
      &,
      &:hover,
      &:focus {
        background-color: @nav-tabs-background-active;
        box-shadow:
          inset 0 @nav-tabs-border-width-active 0 0 @nav-tabs-border-color-active,
          inset 1px 0 0 0 @component-border-color,
          inset -1px 0 0 0 @component-border-color;
        font-weight: 500;
        cursor: default;
        outline: none;
        border-radius: 0 !important;
        pointer-events: none;
      }
      > [class^='dlt-c8y-icon-'],
      > [class*=' dlt-c8y-icon-'],
      > .c8y-icon {
        color: @nav-tabs-icon-color-active;
        opacity: 1;
      }
    }
  } 
  &.nav-justified {
    // Note: Intentionally empty - justified layout handled by .nav-justified base class (see _navs.scss)
    // Tab-specific justified styles are in .nav-tabs-justified class below
  }
  .dashboard-template-marker {
    position: absolute;
    right: 6px;
    top: 9px;
  }
}

// Move borders to anchors instead of bottom of list
// Mixin for adding on top the shared `.nav-justified` styles for our tabs
.nav-tabs-justified {
  > li > a {
    margin-right: 0;
    border-radius: @component-border-radius-base;
  }
  @media (min-width: @screen-sm-min) {
    > li > a {
      border-radius: @component-border-radius-base @component-border-radius-base 0 0;
    }
  }
}

// Tabbable tabs
// Hide tabbable panes to start, show them when `.active`
.tab-content {
  > .tab-pane {
    display: none;
  }
  > .active {
    display: block;
  }
}

// Dropdowns
// Specific dropdowns
.nav-tabs .dropdown-menu {
  // make dropdown border overlap tab border
  margin-top: -1px; // Remove the top rounded corners here since there is a hard edge above the menu

  .border-top-radius(0);
}

.mobile-tabs {
  margin: 0;
  padding: @size-4 @size-base;
  min-height: calc(@size-base * 6);
  background-color: var(--brand-primary, var(--c8y-brand-primary));
  color: @palette-high;
  .c8y-select-wrapper {
    border-color: transparent;
    background-color: transparent;
    color: inherit;
    font-size: 18px;
    &:after {
      color: inherit;
    }
    select {
      height: calc(@size-base * 5);
      background-color: transparent;
      box-shadow: none;
      color: inherit;
      option {
        color: var(--gray-text, @text-color);
      }
    }
  }
  .btn-dot {
    color: @palette-high;
  }
}

.nav-tabs-vertical {
  display: block;
  &:not(.component-tabs) {
    padding-top: @size-48;
  }
  width: @nav-tabs-vertical-width;
  border: 0;
  box-shadow: none;
  &.nav-tabs-vertical--wide {
    width:unset;
  }
  > div,
  li {
    > a, > button {
      display: flex;
      align-items: center;
      flex-direction: row;
      margin: 0;
      padding: @nav-tabs-vertical-padding;
      height: auto;
      border: 0;
      box-shadow: inset 0 -1px 0 @nav-tabs-border-color-default;
      text-transform: none;
      font-size: inherit;
      transition: all 0.25s ease;

      [class^='dlt-c8y-icon-'],
      [class*=' dlt-c8y-icon-'],
      .c8y-icon {
        margin: 0 @size-8 0 0;
        width: 1.25em;
        ~ span {
          display: inline-block;
          overflow: hidden;
          max-width: 100%;
          vertical-align: middle;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }
    }
    &.active {
      > a, > button{
        &, &:hover{
          border-left: @size-4 solid @nav-tabs-color-active;
          background-color: @nav-tabs-background-active;
          box-shadow: inset 0 -1px 0 @nav-tabs-border-color-default !important;
          border-radius: 0 !important;
          pointer-events: none;
          &::before {
            width: 100%;
          }
          &::after {
            left: 100%;
            height: 100%;
            border-width: calc(@size-16 + @size-4) 0 calc(@size-16 + @size-4) @size-base;
          }
        }
      }
    }
  }
}

.tabs_ctrl + .container-fluid .tab-content-spacer {
  margin: 0 -30px 0;
  padding-bottom: @size-20;
  border: 0;
}

c8y-roles-overview > .page-tabs {
  margin-top: -30px;
}

.page-tabs .tab-content {
  padding-top: calc(@headerHeight + 3);
}
