/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

.split-box {
  display: flex;
  flex: 1;
  min-width: 0;
  height: 100%;
  width: 100%;
}

.split-box.vert {
  flex-direction: row;
}

.split-box.horz {
  flex-direction: column;
}

.split-box > .uncontrolled {
  display: flex;
  flex: 1;
  min-width: 0;
  overflow: auto;
}

.split-box > .controlled {
  display: flex;
  overflow: auto;
}

.split-box > .splitter {
  background-image: none;
  border: 0;
  border-style: solid;
  border-color: transparent;
  background-color: var(--theme-splitter-color);
  background-clip: content-box;
  position: relative;

  box-sizing: border-box;

  /* Positive z-index positions the splitter on top of its siblings and makes
     it clickable on both sides. */
  z-index: 1;

  /* opt-out of forced colors because the transparent borders are turned into
     opaque ones in High Contrast Mode. --theme-splitter-color has specific value
     in High Contrast Mode so we should be fine */
  forced-color-adjust: none;
}

.split-box.vert > .splitter {
  min-width: var(--devtools-vertical-splitter-min-width);

  border-inline-start-width: var(--devtools-splitter-inline-start-width);
  border-inline-end-width: var(--devtools-splitter-inline-end-width);

  margin-inline-start: calc(-1 * var(--devtools-splitter-inline-start-width) - 1px);
  margin-inline-end: calc(-1 * var(--devtools-splitter-inline-end-width));

  cursor: ew-resize;
}

.split-box.horz > .splitter {
  /* Emphasize the horizontal splitter width and color */
  min-height: var(--devtools-emphasized-horizontal-splitter-min-height);

  background-color: var(--theme-emphasized-splitter-color);

  border-top-width: var(--devtools-splitter-top-width);
  border-bottom-width: var(--devtools-splitter-bottom-width);

  margin-top: calc(-1 * var(--devtools-splitter-top-width) - 1px);
  margin-bottom: calc(-1 * var(--devtools-splitter-bottom-width));

  cursor: ns-resize;
}

/* Emphasized splitter has the hover style. */
.split-box.horz > .splitter:hover {
  background-color: var(--theme-emphasized-splitter-color-hover);
}

.split-box.disabled {
  pointer-events: none;
}

/**
 * Make sure splitter panels are not processing any mouse
 * events. This is good for performance during splitter
 * bar dragging.
 */
.split-box.dragging > .controlled,
.split-box.dragging > .uncontrolled {
  pointer-events: none;
}
