/*
 * Copyright (C) 2016 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.
 */

.tree-outline,
.tree-outline .children {
    margin: 0;
    padding: 0;
    list-style: none;
    outline: none;

    --tree-outline-icon-margin-start: 16px;
    --tree-outline-icon-margin-end: 3px;

    --tree-outline-status-margin-start: 4px;
}

.tree-outline .children {
    display: none;
}

.tree-outline .children.expanded {
    display: block;
}

.tree-outline .item {
    height: 20px;

    padding: 0 5px;

    border-top: 1px solid transparent;

    white-space: nowrap;
}

.tree-outline.compact .item {
    height: inherit;
}

.tree-outline.large .item {
    height: 36px;
    line-height: 34px;

    --tree-outline-icon-margin-end: 6px;
}

body[dir=ltr] .tree-outline .item :matches(.disclosure-button, .icon) {
    float: left;
}

body[dir=rtl] .tree-outline .item :matches(.disclosure-button, .icon) {
    float: right;
}

.tree-outline.hide-disclosure-buttons > .children {
    display: none;
}

.tree-outline > .children.hide-disclosure-buttons > .children {
    display: none;
}

body[dir=ltr] .tree-outline:not(.hide-disclosure-buttons) .item:not(.parent) > .icon {
    margin-left: var(--tree-outline-icon-margin-start);
}

body[dir=rtl] .tree-outline:not(.hide-disclosure-buttons) .item:not(.parent) > .icon {
    margin-right: var(--tree-outline-icon-margin-start);
}

.tree-outline .item .disclosure-button {
    display: none;
    width: 16px;
    height: 16px;
    background-color: transparent;
    background-image: url(../Images/DisclosureTriangles.svg#closed-normal);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 13px 13px;
    border: none;
    -webkit-appearance: none;
}

body[dir=rtl] .tree-outline .item .disclosure-button {
    transform: scaleX(-1);
}

.tree-outline.hide-disclosure-buttons .item .disclosure-button {
    display: none;
}

.tree-outline .item.parent .disclosure-button {
    display: block;
}

.tree-outline:matches(:focus, .force-focus) .item.selected .disclosure-button {
    background-image: url(../Images/DisclosureTriangles.svg#closed-selected) !important;
}

.tree-outline .item.expanded .disclosure-button {
    background-image: url(../Images/DisclosureTriangles.svg#open-normal);
}

.tree-outline:matches(:focus, .force-focus) .item.selected.expanded .disclosure-button {
    background-image: url(../Images/DisclosureTriangles.svg#open-selected) !important;
}

.tree-outline .item .icon {
    position: relative;
    width: 16px;
    height: 16px;
    margin-top: 1px;
}

body[dir=ltr] .tree-outline .item .icon {
    margin-right: var(--tree-outline-icon-margin-end);
}

body[dir=rtl] .tree-outline .item .icon {
    margin-left: var(--tree-outline-icon-margin-end);
}

.tree-outline.compact .item .icon {
    margin-top: 0;
}

.tree-outline.large .item .icon {
    width: 24px;
    height: 24px;
    margin-top: 5px;
}

.tree-outline .item .status {
    margin-top: 1px;
    line-height: 1em;
}

body[dir=ltr] .tree-outline .item .status {
    float: right;
    margin-left: var(--tree-outline-status-margin-start);
}

body[dir=rtl] .tree-outline .item .status {
    float: left;
    margin-right: var(--tree-outline-status-margin-start);
}

.tree-outline.large .item .status {
    margin-top: 9px;
}

.tree-outline .item .status:empty {
    display: none;
}

.tree-outline .item.selected {
    background-color: var(--selected-background-color-unfocused);
}

.tree-outline:matches(:focus, .force-focus) .item.selected {
    color: var(--selected-foreground-color);
    background-color: var(--selected-background-color);
}

.tree-outline .item .titles {
    position: relative;
    top: 2px;

    line-height: normal;

    padding-bottom: 1px;

    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.tree-outline.compact .item .titles {
    top: 0;
}

.tree-outline.large .item .titles {
    top: 10px;
}

.tree-outline .item .highlighted {
    background-color: hsla(53, 83%, 53%, 0.2);
    border-bottom: 1px solid hsl(47, 82%, 60%);
}

.tree-outline .item .title::after {
    content: "\A"; /* Newline */
    white-space: pre;
}

.tree-outline .item .subtitle {
    font-size: inherit;
    color: hsla(0, 0%, 0%, 0.7);
}

.tree-outline.large .item .subtitle {
    font-size: 9px;
}

.tree-outline:matches(:focus, .force-focus) .item.selected .subtitle {
    color: hsla(0, 0%, 100%, 0.9);
}

.tree-outline .item .titles.no-subtitle .subtitle,
.tree-outline .item .subtitle:empty {
    display: none;
}

.tree-outline:not(.large) .item .status .indeterminate-progress-spinner {
    margin-top: 1px;
    width: 14px;
    height: 14px;
}

.tree-outline .item .title::after {
    content: "";
}

.tree-outline .item .subtitle::before,
.tree-outline .item .alternate-subtitle::before {
    content: " — ";
}
