/*
 * Container style
 */
.ps {
  overflow: hidden !important;
  overflow-anchor: none;
  -ms-overflow-style: none;
  touch-action: auto;
  -ms-touch-action: auto;
}

// ._scrollbar {
//   overflow-x: hidden !important;
//   overflow-y: auto;
// }

/*
 * Scrollbar rail styles
 */
.ps__rail-x {
  display: none;
  opacity: 0;
  transition:
    background-color 0.2s linear,
    opacity 0.2s linear;
  -webkit-transition:
    background-color 0.2s linear,
    opacity 0.2s linear;
  height: 15px;
  /* there must be 'bottom' or 'top' for ps__rail-x */
  bottom: 0px;
  /* please don't change 'position' */
  position: absolute;
}

.ps__rail-y {
  display: none;
  opacity: 0;
  transition:
    background-color 0.2s linear,
    opacity 0.2s linear;
  -webkit-transition:
    background-color 0.2s linear,
    opacity 0.2s linear;
  width: 15px;
  /* there must be 'right' or 'left' for ps__rail-y */
  right: 0;
  /* please don't change 'position' */
  position: absolute;
}

.ps--active-x > .ps__rail-x,
.ps--active-y > .ps__rail-y {
  display: block;
  background-color: transparent;
}

.ps--focus > .ps__rail-x,
.ps--focus > .ps__rail-y,
.ps--scrolling-x > .ps__rail-x,
.ps--scrolling-y > .ps__rail-y {
  opacity: 0.6;
}

.ps__rail-x:hover,
.ps__rail-y:hover,
.ps__rail-x:focus,
.ps__rail-y:focus {
  background-color: transparent;
  opacity: 0.9;
}

/*
 * Scrollbar thumb styles
 */
.ps__thumb-x {
  background-color: #aaa;
  border-radius: 6px;
  height: 6px;
  /* there must be 'bottom' for ps__thumb-x */
  bottom: 2px;
  /* please don't change 'position' */
  position: absolute;
}

.ps__thumb-y {
  @include gradient-vertical($scrollbarBackground, $scrollbarBackground2);
  border-radius: 6px;
  width: 6px;
  /* there must be 'right' for ps__thumb-y */
  right: 0px;
  /* please don't change 'position' */
  position: absolute;
}

/* MS supports */
@supports (-ms-overflow-style: none) {
  .ps {
    overflow: auto !important;
  }
}

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  .ps {
    overflow: auto !important;
  }
}

.ps__rail-x:hover,
.ps__rail-y:hover,
.ps__rail-x:focus,
.ps__rail-y:focus {
  background-color: transparent;
  opacity: 0.9;
}

// Scrollbars
// Note, this is not applied by default if the `betterPageScrolling` feature flag is applied
.no-overlay-scrollbar {
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  ::-webkit-scrollbar:hover {
    height: 8px;
  }

  ::-webkit-scrollbar-button:start:decrement,
  ::-webkit-scrollbar-button:end:increment {
    display: none;
  }
  ::-webkit-scrollbar-button:horizontal:decrement {
    display: none;
  }
  ::-webkit-scrollbar-button:horizontal:increment {
    display: none;
  }
  ::-webkit-scrollbar-button:vertical:decrement {
    display: none;
  }
  ::-webkit-scrollbar-button:vertical:increment {
    display: none;
  }
  ::-webkit-scrollbar-button:horizontal:decrement:active {
    background-image: none;
  }
  ::-webkit-scrollbar-button:horizontal:increment:active {
    background-image: none;
  }
  ::-webkit-scrollbar-button:vertical:decrement:active {
    background-image: none;
  }
  ::-webkit-scrollbar-button:vertical:increment:active {
    background-image: none;
  }
  ::-webkit-scrollbar-track-piece {
    background-color: transparent;
  }

  ::-webkit-scrollbar-thumb:vertical {
    height: 50px;
    background: -webkit-gradient(
      linear,
      left top,
      right top,
      color-stop(0%, $scrollbarBackground),
      color-stop(100%, $scrollbarBackground2)
    );
    border: 1px solid $scrollbarBorder;
    border-top: 1px solid $scrollbarBorder;
    border-left: 1px solid $scrollbarBorder;
  }

  ::-webkit-scrollbar-thumb:horizontal {
    width: 50px;
    background: -webkit-gradient(
      linear,
      left top,
      left bottom,
      color-stop(0%, $scrollbarBackground),
      color-stop(100%, $scrollbarBackground2)
    );
    border: 1px solid $scrollbarBorder;
    border-top: 1px solid $scrollbarBorder;
    border-left: 1px solid $scrollbarBorder;
  }
}

// Baron styles
.baron {
  // display: inline-block; // this brakes phantomjs rendering (width becomes 0)
  overflow: hidden;
}

// Fix for side menu on mobile devices
.main-view.baron {
  width: unset;
}

.baron__clipper {
  position: relative;
  overflow: hidden;
}

.baron__scroller {
  overflow-y: scroll;
  -ms-overflow-style: none;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  border: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  -webkit-overflow-scrolling: touch;
  /* remove line to customize scrollbar in iOs */
}

.baron__scroller::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.baron__track {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
}

.baron._scrollbar .baron__track {
  display: block;
}

.baron__free {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
}

.baron__bar {
  display: none;
  position: absolute;
  right: 0;
  z-index: 1;
  // width: 10px;
  background: #999;

  // height: 15px;
  width: 15px;
  transition:
    background-color 0.2s linear,
    opacity 0.2s linear;
  opacity: 0;
}

.baron._scrollbar .baron__bar {
  display: block;

  @include gradient-vertical($scrollbarBackground, $scrollbarBackground2);
  border-radius: 6px;
  width: 6px;
  /* there must be 'right' for ps__thumb-y */
  right: 0px;
  /* please don't change 'position' */
  position: absolute;

  // background-color: transparent;
  // opacity: 0.6;

  &:hover,
  &:focus {
    // background-color: transparent;
    opacity: 0.9;
  }
}

.panel-hover-highlight .baron__track .baron__bar {
  opacity: 0.6;
}

.baron._scrolling > .baron__track .baron__bar {
  opacity: 0.9;
}

.baron__control {
  display: none;
}

.baron.panel-content--scrollable {
  // Width needs to be set to prevent content width issues
  // Set to less than 100% for fixing Firefox issue (white stripe on the right of scrollbar)
  width: calc(100% - 2px);

  .baron__scroller {
    padding-top: 1px;
  }
}

.scroll-margin-helper {
  margin-right: 12px;
}
