/* Base segmented tabs — pill-style single-select switcher (Top / Newest / …).
   Web counterpart of assets/mobile/css/segmented_tabs.css, using the site's
   generic theme tokens so every project gets it in its own brand colour.

   Markup:
     <div class="base-seg-tabs">
       <button class="base-seg-tab base-seg-tab--active">All</button>
       <button class="base-seg-tab">Unread</button>
     </div> */

.base-seg-tabs {
  position: relative;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  background: var(--container-bg, var(--card-bg));
  border: 1px solid var(--border-color);
}

/* Sliding active pill — JS positions it under the active tab; the active tab
   itself stays transparent and only changes text colour. */
.base-seg-indicator {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 12px;
  background: var(--primary-blue);
  box-shadow: 0 4px 12px
    color-mix(in srgb, var(--primary-blue) 32%, transparent);
  z-index: 0;
  pointer-events: none;
}

.base-seg-tabs .base-seg-tab {
  position: relative;
  z-index: 1;
  min-width: 0;
  height: 34px;
  padding: 0 16px;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: transparent !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  color: var(--muted-text) !important;
  cursor: pointer;
  box-shadow: none !important;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.base-seg-tabs .base-seg-tab-icon {
  font-size: 14px;
  flex: 0 0 auto;
}

/* Stay flat across interaction states — the framework's global `button`
   rules repaint background/border with !important and would otherwise draw
   a box over the pill. */
.base-seg-tabs .base-seg-tab:hover,
.base-seg-tabs .base-seg-tab:focus,
.base-seg-tabs .base-seg-tab:focus-visible,
.base-seg-tabs .base-seg-tab:active {
  background: transparent !important;
  border-color: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}

.base-seg-tabs .base-seg-tab:hover:not(.base-seg-tab--active) {
  color: var(--text-color) !important;
}

.base-seg-tabs .base-seg-tab--active,
.base-seg-tabs .base-seg-tab--active:hover,
.base-seg-tabs .base-seg-tab--active:focus {
  color: #ffffff !important;
}

/* Fallback pill until JS has measured and placed the indicator. Keyed on
   --ready (not on the indicator existing), because the element is created
   before it is positioned - in that gap the pill was missing while the label
   was already white, so the active option looked blank. */
.base-seg-tabs:not(.base-seg-tabs--ready) .base-seg-tab--active {
  background: var(--primary-blue) !important;
  box-shadow: 0 4px 12px
    color-mix(in srgb, var(--primary-blue) 32%, transparent) !important;
}
