/* =========================
   Tabs
   Figma: Tabs / Navigation.
========================= */

@use "../kit-deps" as *;

.tabs {
  width: 100%;
  max-width: 900px;

  .tabs-list {
    display: flex;
    align-items: stretch;
    gap: $space-1;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: $space-2;
    min-height: $control-height-md;
    padding: $space-3 $space-4;
    border: 0;
    border-radius: $radius-full;
    color: $neutral-700;
    background: transparent;
    font-family: $font-family-base;
    font-size: 14px;
    font-weight: $font-weight-semibold;
    line-height: 1;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    transition:
      color $motion-base $motion-ease,
      background-color $motion-base $motion-ease;

    &:hover:not(:disabled):not([aria-disabled="true"]) {
      color: $neutral-900;
      background-color: $neutral-100;
    }

    &:focus-visible {
      @include focus_ring;
      z-index: 1;
    }

    &:disabled,
    &[aria-disabled="true"] {
      color: $neutral-500;
      cursor: not-allowed;
      opacity: 0.62;

      &:hover {
        background: transparent;
      }
    }
  }

  .tab-active,
  .tab[aria-selected="true"] {
    color: $neutral-900;
    background-color: $neutral-100;
  }

  .tabs-panels {
    padding-top: $space-4;
  }

  .tab-panel {
    display: none;

    &.tab-panel-active {
      display: block;
    }
  }

  // Compact variant
  &.tabs-compact {
    max-width: 620px;

    .tab {
      min-height: $control-height-sm;
      padding: $space-2 $space-3;
      font-size: 13px;
    }
  }

  // Vertical layout
  &.tabs-vertical {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    align-items: start;
    gap: $space-5;

    .tabs-list {
      flex-direction: column;
      overflow-x: visible;
    }

    .tab {
      justify-content: flex-start;
      text-align: left;
    }

    @media (max-width: 768px) {
      grid-template-columns: 1fr;

      .tabs-list {
        flex-direction: row;
        overflow-x: auto;
      }

      .tab {
        justify-content: center;
        text-align: center;
      }
    }
  }
}
