/*
 * Adaptive (VS Code-style) document tab widths. Tabs size to their filename
 * instead of being pinned to --jp-private-horizontal-tab-width (216px), and
 * the horizontal tab strip becomes scrollable when tabs overflow.
 *
 * Mostly mirrors jupyterlab/jupyterlab#18796, with one deliberate divergence:
 * .lm-TabBar-content uses `flex: 0 1 auto` (not `1 1 auto`) so the +/add
 * button sits next to the last tab instead of being pushed to the right
 * edge of the bar. Overflow scrolling still works because `flex-shrink: 1`
 * plus `min-width: 0` lets content shrink when tabs exceed the bar width.
 */

.lm-DockPanel-tabBar .lm-TabBar-tab,
.lm-TabPanel-tabBar .lm-TabBar-tab {
  flex: 0 0 auto;
  padding: 0 8px;
  cursor: pointer;
}

.lm-DockPanel-tabBar .lm-TabBar-addButton,
.lm-TabPanel-tabBar .lm-TabBar-addButton {
  cursor: pointer;
}

.lm-DockPanel-tabBar .lm-TabBar-tab {
  width: auto;
}

/* Breathing room between the label and the close icon. Fit-content tabs put
   the icon flush against the label's last glyph (stock's fixed-width tabs
   hide this with slack space), and the icon-hover chip in chrome.css extends
   2px beyond the icon box into this gap. */
.lm-DockPanel-tabBar .lm-TabBar-tab .lm-TabBar-tabCloseIcon,
.lm-TabPanel-tabBar .lm-TabBar-tab .lm-TabBar-tabCloseIcon {
  margin-left: 4px;
}

.lm-DockPanel-tabBar .lm-TabBar-content {
  flex: 0 1 auto;
  min-width: 0;
}

.lm-DockPanel-tabBar[data-orientation='horizontal'] {
  overflow: hidden;
}

.lm-DockPanel-tabBar[data-orientation='horizontal'] > .lm-TabBar-content {
  overflow: auto hidden;
  position: relative;
  z-index: 3;
}

.lm-TabBar-content::-webkit-scrollbar {
  height: 2px;
  background: var(--jp-layout-color1);
}

.lm-TabBar-content::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.lm-TabBar-content::-webkit-scrollbar-track {
  background: var(--jp-layout-color1);
}

.lm-TabBar-content::-webkit-scrollbar-thumb {
  background: rgb(120 120 120 / 40%);
  border-radius: 999px;
}

.lm-TabBar-content:hover::-webkit-scrollbar-thumb {
  background: rgb(160 160 160 / 60%);
}
