/*-----------------------------------------------------------------------------
| Copyright (c) Jupyter Development Team.
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
| Variables
|----------------------------------------------------------------------------*/

:root {
  --jp-private-sidebar-tab-width: 32px;
}

/*-----------------------------------------------------------------------------
| SideBar
|----------------------------------------------------------------------------*/

.jp-SideBar {
  /* This is needed so that all font sizing of children done in ems is
   * relative to this base size */
  font-size: var(--jp-ui-font-size1);
}

.jp-SideBar.lm-TabBar,
#jp-down-stack .lm-TabBar {
  color: var(--jp-ui-font-color1);
  background: var(--jp-layout-color2);
  font-size: var(--jp-ui-font-size1);
  overflow: visible;
}

.jp-SideBar.lm-TabBar {
  min-width: calc(var(--jp-private-sidebar-tab-width) + var(--jp-border-width));
  max-width: calc(var(--jp-private-sidebar-tab-width) + var(--jp-border-width));
  display: block;
}

.jp-SideBar .lm-TabBar-content {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  list-style-type: none;
  height: var(--jp-private-sidebar-tab-width);
  transform-origin: 0 0 0;
}

.jp-SideBar .lm-TabBar-tab {
  padding: 0 16px;
  border: none;
  overflow: visible;
}

.jp-SideBar .lm-TabBar-tab.lm-mod-current {
  min-height: calc(
    var(--jp-private-sidebar-tab-width) + var(--jp-border-width)
  );
  max-height: calc(
    var(--jp-private-sidebar-tab-width) + var(--jp-border-width)
  );
  /* transform: translateY(var(--jp-border-width)); */
}

.jp-SideBar .lm-TabBar-tab:not(.lm-mod-current),
#jp-down-stack .lm-TabBar-tab:not(.lm-mod-current) {
  background: var(--jp-layout-color2);
}

.jp-SideBar .lm-TabBar-tabIcon.jp-SideBar-tabIcon {
  min-width: 20px;
  min-height: 20px;
  background-size: 20px;
  display: inline-block;
  vertical-align: middle;
  background-repeat: no-repeat;
  background-position: center;
}

.jp-SideBar .lm-TabBar-tabLabel {
  line-height: var(--jp-private-sidebar-tab-width);
}

.jp-SideBar .lm-TabBar-tab:hover:not(.lm-mod-current),
#jp-down-stack .lm-TabBar-tab:hover:not(.lm-mod-current) {
  background: var(--jp-layout-color1);
}

/* Left */

/* Borders */

.jp-SideBar.lm-TabBar.jp-mod-left {
  border-right: var(--jp-border-width) solid var(--jp-border-color0);
}

.jp-SideBar.lm-TabBar.jp-mod-left .lm-TabBar-tab + .lm-TabBar-tab {
  border-right: var(--jp-border-width) solid var(--jp-layout-color2);
}

.jp-SideBar.lm-TabBar.jp-mod-left
  .lm-TabBar-tab.lm-mod-current
  + .lm-TabBar-tab {
  border-right: var(--jp-border-width) solid var(--jp-border-color0);
}

.jp-SideBar.lm-TabBar.jp-mod-left
  .lm-TabBar-tab
  + .lm-TabBar-tab.lm-mod-current {
  border-right: var(--jp-border-width) solid var(--jp-border-color0);
}

.jp-SideBar.lm-TabBar.jp-mod-left .lm-TabBar-tab.lm-mod-current:last-child {
  border-left: var(--jp-border-width) solid var(--jp-border-color0);
}

/* Transforms */

.jp-SideBar.lm-TabBar.jp-mod-left .lm-TabBar-content {
  flex-direction: row-reverse;
  transform: rotate(-90deg) translateX(-100%);
}

.jp-SideBar.lm-TabBar.jp-mod-left
  .lm-TabBar-tab:not(.lm-mod-current)
  .lm-TabBar-tabIcon {
  transform: rotate(90deg);
}

.jp-SideBar.lm-TabBar.jp-mod-left
  .lm-TabBar-tab.lm-mod-current
  .lm-TabBar-tabIcon {
  transform: rotate(90deg)
    translate(
      calc(-0.5 * var(--jp-border-width)),
      calc(-0.5 * var(--jp-border-width))
    );
}

/* Right */

/* Borders */

.jp-SideBar.lm-TabBar.jp-mod-right {
  border-left: var(--jp-border-width) solid var(--jp-border-color0);
}

.jp-SideBar.lm-TabBar.jp-mod-right .lm-TabBar-tab + .lm-TabBar-tab {
  border-left: var(--jp-border-width) solid var(--jp-layout-color2);
}

.jp-SideBar.lm-TabBar.jp-mod-right
  .lm-TabBar-tab.lm-mod-current
  + .lm-TabBar-tab {
  border-left: var(--jp-border-width) solid var(--jp-border-color0);
}

.jp-SideBar.lm-TabBar.jp-mod-right
  .lm-TabBar-tab
  + .lm-TabBar-tab.lm-mod-current {
  border-left: var(--jp-border-width) solid var(--jp-border-color0);
}

.jp-SideBar.lm-TabBar.jp-mod-right .lm-TabBar-tab.lm-mod-current:last-child {
  border-right: var(--jp-border-width) solid var(--jp-border-color0);
}

/* Transforms */

.jp-SideBar.lm-TabBar.jp-mod-right .lm-TabBar-content {
  flex-direction: row;
  transform: rotate(90deg) translateY(-100%);
}

.jp-SideBar.lm-TabBar.jp-mod-right
  .lm-TabBar-tab:not(.lm-mod-current)
  .lm-TabBar-tabIcon {
  transform: rotate(-90deg);
}

.jp-SideBar.lm-TabBar.jp-mod-right
  .lm-TabBar-tab.lm-mod-current
  .lm-TabBar-tabIcon {
  transform: rotate(-90deg)
    translate(
      calc(0.5 * var(--jp-border-width)),
      calc(-0.5 * var(--jp-border-width))
    );
}

/* Down */

/* Borders */

#jp-down-stack > .lm-TabBar {
  border-top: var(--jp-border-width) solid var(--jp-border-color0);
  border-bottom: var(--jp-border-width) solid var(--jp-border-color0);
}

#jp-down-stack > .lm-TabBar .lm-TabBar-tab {
  border-left: none;
  border-right: none;
}

#jp-down-stack > .lm-TabBar .lm-TabBar-tab.lm-mod-current {
  border: var(--jp-border-width) solid var(--jp-border-color1);
  border-bottom: none;
  transform: translateY(var(--jp-border-width));
}

#jp-down-stack > .lm-TabBar .lm-TabBar-tab.lm-mod-current:first-child {
  border: none;
  border-right: var(--jp-border-width) solid var(--jp-border-color1);
}

/* Stack panels */

#jp-left-stack > .lm-Widget,
#jp-right-stack > .lm-Widget {
  min-width: var(--jp-sidebar-min-width);
}

#jp-right-stack {
  border-left: var(--jp-border-width) solid var(--jp-border-color1);
}

#jp-left-stack {
  border-right: var(--jp-border-width) solid var(--jp-border-color1);
}

#jp-down-stack > .lm-TabPanel-stackedPanel {
  border: none;
}
