/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file. */

app-tree-view {
  display: block;
  outline: none;
  overflow: auto;
}

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

.expand-icon {
  transform: rotate(-90deg);
  -webkit-transition: all 150ms;
  background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxMSIgdmlld2JveD0iMCAwIDE2IDExIiBmaWxsPSIjN2E3YTdhIj4KICA8cGF0aCBkPSJNMCAwIEwwIDIgTDcgOSBMMTQgMiBMMTQgMCBMMCAwIiBzdHJva2U9ImJsYWNrIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPgo=) no-repeat center center;
  background-size: 8px 5px;
  display: inline-block;
  height: 16px;
  opacity: .6;
  position: relative;
  top: 6px;
  vertical-align: top;
  width: 16px;
}

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

.tree-item[expanded] > .tree-row > .expand-icon {
  transform: rotate(0);
  background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxMSIgdmlld2JveD0iMCAwIDE2IDExIiBmaWxsPSIjN2E3YTdhIj4KICA8cGF0aCBkPSJNMCAwIEwwIDIgTDcgOSBMMTQgMiBMMTQgMCBMMCAwIiBzdHJva2U9ImJsYWNrIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPgo=);
  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 {
  background-color: var(--hover-bg, hsl(214, 91%, 97%));
  border-color: transparent;
  z-index: 1;
}

/*
  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: none;
}

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

.tree-row[selected]:hover,
tree:focus .tree-row[selected] {
  background-color: var(--active-bg, hsl(214, 91%, 89%));
  border-color: transparent;
}

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

.tree-children {
  display: none;
}

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

.tree-label {
  -webkit-padding-start: 20px;
  background-position: 0 50%;
  background-repeat: no-repeat;
  white-space: pre;
}

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

html[dir=rtl] .tree-label,
html[dir=rtl] .tree-row[may-have-children] > .tree-label {
  background-image: -webkit-image-set(
      url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAASCAYAAAC5DOVpAAABRUlEQVR4Xs2UPUvEQBCG39mLnvhZXSEoWghWguAfsNPK1kYUG6+00fYKbSwtBLlrBFv/hKWVpVaWYiESReJdNNlxdhIRwkLIcYhDhmcHss/skuwSM2NQYTDACKoIjnZX9wRtj6fZurjuVJI50ebWBuYXl7SIokh5dnLqGnSCCt0xMz2F+OUB9zePWjMbZWN2QecVZexwcLiD4cYcNIjco4RCqEOBkrC8Bhzvt9rebfLTHYLJUWiYGkAGrMzGMEapCQKboOQDxKFCBCokN0GSA2liawVhmaz7lrE+DlgDmETFlH6pFCLln1VTvURm01/pyATArnbSXCZSGhrTVTNxhZ+2957JbaISJD3JLhC/Cj/B1lY8AXEkYIBtLs6lqchS/qPj9BFL1+fQIwjhf//WL1tZ38b51SX6iCaYuZB9h3eb9C/us28Uf7F5VS9BsgAAAABJRU5ErkJggg==) 1x);
}

html[dir=rtl] .tree-item[expanded] > .tree-row > .tree-label {
  background-image: -webkit-image-set(
     url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAASCAYAAAC5DOVpAAABTUlEQVR4Xs3Uy0oCUQDGcZ+s3qBt2yCYRZsg3ASFRQUtKroaWVZCQRkkhEGEXXyADJVg7KKVUjGpFRQEOufrzHcwc5ggh6AWf2Zz5nc+ZjEeAL/W32GDHa2aDA5pbjDosXG85/dZSY9YESTWxO0I9rYhudmF060elgh7mb+/k+vsmM8C3s6WUTEOVI+HqBZlpSNmlo9hPqnEs1Uc4iVuYVzSIkOgr73pCql1iHIMpkSJARiwsNeYF9XU2Ge4nFddBYBcELgJAXn58n0E4mEHwogSFMU9rv0eOxkC0qOq81ngwi/RBSC7BFyvArdrwN02sYrBT1DDGkEkR4jJZ73MtERnZHNqbXYRyK0AhXANdMSYmRgm0pA+KZuqw1wbcMBsYDU9QcABrJdRMHIhgnbM92Wde8wOGrvdBH8Yzzti0Y0gJ7tII2IHXeb5v/+zD5m5/ov62ALOAAAAAElFTkSuQmCC) 1x);
}

tree[icon-visibility=hidden] .tree-label {
  -webkit-padding-start: 0;
  background-image: none !important;
}

app-tree-view[icon-visibility=parent] .tree-label,
app-tree-view[icon-visibility=parent] .tree-row[has-children=false] > .tree-label {
  background-image: none;
}

.tree-label,
.tree-row[may-have-children] > .tree-label {
  background-image: -webkit-image-set(
      url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAASCAYAAAC5DOVpAAABLElEQVR4Xs2Ur0oEURhHz10UwQkmg6DNZvQFDAafYsHiGgwGg8lg1S5jEcEiNvEBLPZFQbC5yWCSdZf5ez/5wQUHlpW7sqAHPhi+4R4OA3ecmTEtWkyRGYDj7Y0dIGWUztHF/flEMon2DvcRSZIgXl+euL66TYF4maoWV1bpPT4gnPOIls9YXlpQtSEiqlWW7h60wQAMMwQYrG0Gj4V9eFm89zg9uVS1xjVlmBnOV4DhzIPG+/Bc43wddjUif3v+4Zt5QLKGCEmqofZhJKwZT7OsLiVSBTQlEoQy8s8IWS1ZARKVA7AgUiGqNMj6ABEyHaoKKPvfNRJoMMgHBOLKUFmVAUESkOjvrtNH9475uVliGeblWFnn7KabMiHrW21GMDPs99AclQn37/5nX4eJ9e7eNnr7AAAAAElFTkSuQmCC) 1x);
}

.tree-item[expanded] > .tree-row > .tree-label {
  background-image: -webkit-image-set(
      url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAASCAYAAAC5DOVpAAABUElEQVR4XrXUzUoCURyG8a6s7qBt2yBw0SYIN0FhUUGLij6NLCshoQwSwiDCzC4gQyVQ+7BSKkytoCBwPE+nP52FqaBii4dZzPDjPcMwHUDbaj821ttl01EjWysYhYRf+socS4ngjIDNYLLKOdJHxGeXLvYGpehuP+6hbgEbXC0Y6v0M9fZTmPLrb8UwVuEUKR+i9KLLnUiflxtmtaMKK2tEFYNkY15cwz3NZpZ2CqZXoPJHAqhcAPV8gHryQ8YL9x5Iu+HGBdcrkhWbNvERtJuVo4Lpo+j5IcF43IeHbbjbgtt1jazClRNSSxCfkqzz8fqYgcj6IL2pkTVZQGpZtwjJBYhOmgTT1wrIvDODyVFkhQES87o5g5goRyYEqokJlPYIQFIAqQYkWfHZKqhV7O8qRwWWOxyQmw0mz9f7zmw6mi2w467CjOpopX//BbWtb8Fi/ouV4PDxAAAAAElFTkSuQmCC) 1x);
}

/* 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-modify: read-write-plaintext-only;
  -webkit-user-select: auto;
  background: white;
  color: black;
  outline: 1px solid black;
}

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

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