//-- Mixin ---------------------------------------------------------------------
@mixin _asTitlebar_preSpacer() {
  @include NotOption("userChrome.centered.tab") {
    @content;
  }
  @include Option("userChrome.centered.tab") {
    @include Option("userChrome.centered.tab.label") {
      @content;
    }
  }
}

//------------------------------------------------------------------------------

:root:not([tabsintitlebar="true"]):not([customtitlebar="true"]) #tabbrowser-tabs, /* Show only */
#scrollbutton-up, /* Defaults */
#scrollbutton-down,
.titlebar-spacer[type="pre-tabs"],
spacer:is([part="overflow-start-indicator"], [part="overflow-end-indicator"]),
.tabbrowser-tab:not([selected="true"]),
.tabbrowser-tab[selected="true"] .tab-background,
.tabbrowser-tab[selected="true"] .tab-stack:is(::before, ::after),
.tabbrowser-tab[selected="true"] .tab-close-button,
#tabs-newtab-button {
  display: none !important;
}

.tabbrowser-tab[selected="true"] {
  -moz-window-dragging: drag;
  --tab-max-width: 100vw;
  min-width: calc(var(--uc-tabbar-width, 100vw) - var(--uc-window-control-space)) !important;
  max-width: var(--tab-max-width) !important;

  margin-inline-start: calc(var(--tab-shadow-max-size) * -1) !important;
  // padding-inline-start: calc(var(--tab-shadow-max-size) + 1px) !important;

  &[pinned="true"] {
    @include BoxFlex(100);
    max-width: var(--tab-max-width) !important;
  }
  .tab-label-container {
    margin-inline: 0 !important;
  }
}
.tab-content {
  margin-inline: auto;
  width: 100%;
}

/* Pinned */
#tabbrowser-tabs[positionpinnedtabs] > #pinned-tabs-container > .tabbrowser-tab[pinned][selected="true"],
#tabbrowser-tabs[positionpinnedtabs] > #tabbrowser-arrowscrollbox > .tabbrowser-tab[pinned][selected="true"] {
  position: relative !important;
}
#tabbrowser-tabs {
  --tab-overflow-pinned-tabs-width: 0 !important;
  padding-inline: 0 !important; /* Original: var(--tab-overflow-pinned-tabs-width) 0; */
}
.tab-throbber,
.tab-icon-pending,
.tab-icon-image,
.tab-sharing-icon-overlay,
.tab-icon-overlay {
  &[pinned] {
    margin-inline-end: 5.5px;
  }
}
.tab-label-container[pinned] {
  width: unset !important;
}

/* Padding */
@include _asTitlebar_preSpacer {
  #pinned-tabs-container,
  #tabbrowser-arrowscrollbox {
    margin-inline: 2px !important;
    :root[sizemode="normal"] & {
      margin-inline: 6px !important;
    }
  }
}


@include Option("browser.tabs.tabmanager.enabled") {
  :root:not([tabsintitlebar="true"]):not([customtitlebar="true"]) #tabbrowser-tabs:not([overflow="true"], [hashiddentabs]) ~ #alltabs-button,
  :root:not([tabsintitlebar="true"]):not([customtitlebar="true"]) #tabbrowser-tabs[hasadjacentnewtabbutton]:not([overflow="true"]) ~ #new-tab-button {
    @include Box(true);
  }
}
