@import '../../../../scss/styles.scss';

@layer payload-default {
  .doc-tab {
    @extend %h5;
    position: relative;

    &__link {
      text-decoration: none;
      display: flex;
      justify-content: center;
      align-items: center;
      white-space: nowrap;

      // Use a pseudo element for the accessability so that it doesn't take up DOM space
      // Also because the parent element has `overflow: hidden` which would clip an outline
      &:focus-visible::after {
        content: '';
        border: var(--accessibility-outline);
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        pointer-events: none;
      }
    }

    &:focus:not(:focus-visible) {
      opacity: 1;
    }

    &::before {
      content: '';
      display: block;
      position: absolute;
      width: 100%;
      height: 100%;
      border-radius: var(--style-radius-s);
      background-color: var(--theme-elevation-50);
      opacity: 0;
    }

    &:hover {
      &::before {
        opacity: 1;
      }

      .doc-tab__count {
        background-color: var(--theme-elevation-150);
      }
    }

    &--active {
      font-weight: 600;
      &::before {
        opacity: 1;
        background-color: var(--theme-elevation-100);
      }

      .doc-tab {
        &__count {
          background-color: var(--theme-elevation-250);
        }
      }

      &:hover {
        .doc-tab {
          &__count {
            background-color: var(--theme-elevation-250);
          }
        }
      }
    }

    &__label {
      display: flex;
      position: relative;
      align-items: center;
      gap: 4px;
      width: 100%;
      height: 100%;
      line-height: base(1.2);
      padding: base(0.2) base(0.6);
    }

    &__count {
      line-height: base(0.8);
      min-width: base(0.8);
      text-align: center;
      background-color: var(--theme-elevation-100);
      border-radius: var(--style-radius-s);
    }
  }
}
