tree {
  outline: none;
  overflow: auto;
  display: block;
}

.tree-item > .tree-row {
  color: black;
  -webkit-user-select: none;
  border: 1px solid rgba(255,255,255,0); /* transparent white */
  background-color: rgba(255,255,255,0);
  border-radius: 2px;
  padding: 0px 3px;
  line-height: 20px;
  white-space: nowrap;
  cursor: default;
  position: relative;
  margin: -1px 0;
}

.expand-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: top;
  position: relative;
  top: 2px;
  background-image: -webkit-canvas(tree-triangle);
  background-position: 50% 50%;
  background-repeat: no-repeat;
  -webkit-transition: all .15s;
  opacity: .6;
  -webkit-transform: rotate(-90deg);
}

html[dir=rtl] .expand-icon {
  -webkit-transform: rotate(90deg);
}

.tree-item[expanded] > .tree-row > .expand-icon {
  background-image: -webkit-canvas(tree-triangle);
  -webkit-transform: rotate(0deg);
  opacity: .5;
}

.tree-row .expand-icon {
  visibility: hidden;
}

.tree-row[may-have-children] .expand-icon {
  visibility: visible;
}

.tree-row[has-children=false] .expand-icon {
  visibility: hidden;
}

.tree-row:hover {
  border-color: hsl(214, 91%, 85%);
  z-index: 1;
  background-color: hsl(214, 91%, 97%);
}

/*
  WebKit has a bug with attribute selectors so we apply selected to the tree row
  as well.

  https://bugs.webkit.org/show_bug.cgi?id=12519

*/
.tree-row[selected] {
  background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0.8),
                                            rgba(255,255,255,0));
}

.tree-row[selected] {
  border-color: hsl(0,0%,85%);
  background-color: hsl(0, 0%, 90%);
  z-index: 2;
}

.tree-row[selected]:hover,
tree:focus .tree-row[selected] {
  background-color: hsl(214, 91%, 89%);
  border-color: #7da2ce;
}

.tree-children[expanded] {
  display: block;
}

.tree-children {
  display: none;
}

.tree-item > .tree-row > * {
  display: inline-block;
  box-sizing: border-box;
}

.tree-label {
  -webkit-padding-start: 20px;
  background-image: url("../../../../../app/resources/folder_closed.png");
  background-position: 0 50%;
  background-repeat: no-repeat;
  white-space: pre;
}

/* We need to ensure that even empty labels take up space */
.tree-label:empty:after {
  content: " ";
  white-space: pre;
}

.tree-rename > .tree-row > .tree-label {
  -webkit-user-select: auto;
  -webkit-user-modify: read-write-plaintext-only;
  background: white;
  color: black;
  outline: 1px solid black;
}

html[dir=rtl] .tree-label {
  background-position: 100% 50%;
}

.tree-row[selected] > .tree-label {
  background-image: url("../../../../../app/resources/folder_open.png");
}

html[dir='rtl'] .tree-label {
  background-image: url("../../../../../app/resources/folder_closed_rtl.png");
}

html[dir='rtl'] .tree-row[selected] > .tree-label {
  background-image: url("../../../../../app/resources/folder_open_rtl.png");
}

.tree-item[editing] input {
  /* Do not inherit the line-height */
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  margin: -2px -8px -2px -3px;
  padding: 1px 7px 1px 1px;
}

html:not([os=mac]) .tree-item[editing] input {
  outline: none;
}

html[dir=rtl] .tree-item[editing] input {
  margin: -2px -3px -2px -8px;
  padding: 1px 1px 1px 7px;
}