@use '../../sass/variables' as *;

.tabs {
  padding-left: 0;
  list-style-type: none;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  background-color: var(--md-sys-color-surface);
  margin: 0 auto;
  white-space: nowrap;
  scrollbar-width: none;

  &.tabs-transparent {
    background-color: transparent;

    .tab a {
      color: var(--font-on-primary-color-medium);
    }

    .tab.disabled a,
    .tab.disabled a:hover,
    .tab.disabled a:focus {
      color: rgba(255, 255, 255, 0.38);
    }

    .tab a:hover {
      background-color: rgba(0, 0, 0, 0.04);
    }

    .tab a.active,
    .tab a:focus {
      background-color: transparent;
    }

    .tab a:hover,
    .tab a.active,
    .tab a:focus {
      color: var(--md-sys-color-on-primary);
    }

    .indicator {
      background-color: var(--md-sys-color-on-primary);
    }
  }

  &.tabs-fixed-width {
    display: flex;

    .tab {
      flex-grow: 1;
    }
  }

  .tab {
    padding-left: 0;
    list-style-type: none;
    display: inline-block;
    text-align: center;
    line-height: 48px;
    padding: 0;
    margin: 0;

    i.material-icons {
      position: relative;
      top: 8px;
      vertical-align: middle;
    }

    span {
      height: 24px;
      line-height: 20px;
    }

    a {
      color: var(--md-sys-color-on-surface-variant);
      display: flex;
      flex-direction: column;
      width: 100%;
      height: 100%;
      min-height: 48px; //needed for only-icons tabs
      padding: 0 24px;
      font-size: 14px;
      text-overflow: ellipsis;
      user-select: none;
      overflow: hidden;
      transition:
        color 0.28s ease,
        background-color 0.28s ease;

      &.active {
        background-color: transparent;
      }

      &.active,
      &:focus,
      &:hover {
        color: var(--md-sys-color-primary);
      }

      &:hover {
        background-color: color-mix(in srgb, transparent, var(--md-sys-color-primary) 6%);
      }

      &:focus {
        background-color: var(--md-sys-color-primary-container);
      }

      &.active {
        background-color: color-mix(in srgb, transparent, var(--md-sys-color-primary) 18%);
      }

      &:focus,
      &.active {
        outline: none;
      }
    }

    &.disabled a,
    &.disabled a:hover {
      color: var(--md-sys-color-on-surface);
      cursor: default;
      background-color: transparent;

      &:not(:focus) {
        background-color: transparent;
      }
    }
  }

  .indicator {
    position: absolute;
    bottom: 0;
    height: 3px;
    background-color: var(--md-sys-color-primary);
    will-change: left, right;
    border-radius: 3px 3px 0 0;
  }

  &.tabs-horizontal .tab {
    height: 48px;

    a {
      display: block;
    }

    i.material-icons {
      padding: 0 4px;
      position: relative;
      top: -2px;
      vertical-align: middle;
    }
  }
}

/* Fixed Sidenav hide on smaller */

@media #{$medium-and-down} {
  .tabs {
    display: flex;

    .tab {
      flex-grow: 1;

      a {
        padding: 0 12px;
      }
    }
  }
}
