/* Tabs Component */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--gray-100);
  color: var(--gray-600);
  font-weight: var(--font-medium);
  font-size: var(--text-xs);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

@media (hover: hover) {
  .tab:hover:not(.tab--active) {
    background: var(--gray-200);
    color: var(--gray-800);
  }
}

.tab:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
}

/* Active Tab */
.tab--active {
  background: var(--blue-600);
  color: white;
  border-color: var(--blue-600);
}

.tab--active:hover {
  background: var(--blue-700);
  border-color: var(--blue-700);
}

/* Tab with Badge (count) */
.tab__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 var(--space-1);
  font-size: 10px;
  font-weight: var(--font-bold);
  border-radius: var(--radius-full);
  background: currentColor;
  color: white;
}

.tab--active .tab__badge {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.tab:not(.tab--active) .tab__badge {
  background: var(--gray-300);
  color: var(--gray-600);
}

/* Restricted tab special styling */
.tab--restricted:not(.tab--active) {
  color: var(--danger);
}

.tab--restricted:not(.tab--active) .tab__badge {
  background: var(--danger-light);
  color: var(--danger);
}

.tab--restricted.tab--active {
  background: var(--danger);
  border-color: var(--danger);
}

/* Redacted tab special styling */
.tab--redacted:not(.tab--active) {
  color: var(--gray-700);
}

.tab--redacted:not(.tab--active) .tab__badge {
  background: var(--gray-700);
  color: white;
}

.tab--redacted.tab--active {
  background: var(--gray-800);
  border-color: var(--gray-800);
}

/* Tags tab special styling */
.tab--tags:not(.tab--active) {
  color: var(--success-dark);
}

.tab--tags:not(.tab--active) .tab__badge {
  background: var(--success-light);
  color: var(--success-dark);
}

.tab--tags.tab--active {
  background: var(--success);
  border-color: var(--success);
}

/* ========================
   MOBILE TABS (< 640px)
   ======================== */
@media (max-width: 639px) {
  /* Scrollable tabs container */
  .tabs {
    position: relative;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: var(--space-2);
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  /* Fade indicator showing more content on the right */
  .tabs::after {
    content: '';
    position: sticky;
    right: 0;
    flex-shrink: 0;
    width: 40px;
    background: linear-gradient(to left, white 20%, transparent);
    pointer-events: none;
    margin-left: -40px;
  }

  /* Tabs fill available space with proper sizing */
  .tab {
    flex-shrink: 0;
    padding: var(--space-2) var(--space-4);
    min-height: 44px;
    font-size: var(--text-sm);
  }

  /* Badge slightly larger on mobile */
  .tab__badge {
    min-width: 20px;
    height: 20px;
    font-size: 11px;
  }
}
