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

.page-tabs {
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-tabs__item {
  position: relative;
  min-height: 40px;
  padding: 10px 18px;
  border: none;
  border-radius: 12px;
  background: $transparent;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: $gray50;
  font-size: $font-size-18;
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;

  cursor: pointer;
  transform-origin: left center;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;

  &:hover {
    background-color: $gray20;
  }

  &.is-active {
    background: $color-surface;
    color: $blue;
    box-shadow: $shadow-card-soft;
  }

  b {
    color: currentColor;
    font-weight: 700;
  }
}

.page-tabs__label {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.page-tabs__alert {
  position: absolute;
  top: -3px;
  right: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: $red;
  &::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: $red;
    opacity: 0.35;
    animation: alert-pulse 2.4s ease-out infinite;
  }
}

@include laptop-down {
  .page-tabs__item {
    min-height: 38px;
    padding: 9px 14px;
  }
}

@include tablet-down {
  .page-tabs {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 2px;
    scrollbar-width: none;

    &::-webkit-scrollbar {
      display: none;
    }
  }

  .page-tabs__item {
    flex: 0 0 auto;
  }
}

@keyframes alert-pulse {
  0% {
    transform: scale(1);
    opacity: 0.45;
  }

  70% {
    transform: scale(2.1);
    opacity: 0;
  }

  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-tabs__item {
    transform: none !important;
  }
}

[data-theme='dark'] {
  .page-tabs__item:hover {
    background-color: $color-surface-hover;
    color: $color-primary-hover;
  }

  .page-tabs__item.is-active {
    background: $color-primary;
    color: $color-text-inverse;
    box-shadow: var(--shadow-primary);

    &:hover {
      background: $color-primary-hover;
      color: $color-text-inverse;
    }
  }
}
