/*
 * Copyright (C) 2013-2017 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.
 */

.hierarchical-path-component {
    display: flex;
    position: relative;
    height: 20px;
    min-width: 32px;

    font-size: 11px;
    font-family: -apple-system, sans-serif;

    --path-component-icon-margin-start: 4px;
    --path-component-icon-margin-end: 3px;
}

.hierarchical-path-component.show-selector-arrows {
    min-width: 44px;
}

.hierarchical-path-component.collapsed {
    min-width: 24px;
}

.hierarchical-path-component.collapsed > .icon {
    display: none;
}

.hierarchical-path-component.collapsed > .title {
    margin-left: 3px;
}

.hierarchical-path-component.collapsed > select {
    display: none;
}

.hierarchical-path-component > .icon {
    vertical-align: top;
    width: 16px;
    height: 16px;
}

.hierarchical-path-component > :matches(.icon, .selector-arrows) {
    margin-top: 2px;
    margin-bottom: 2px;
}

body[dir=ltr] .hierarchical-path-component > :matches(.icon, .selector-arrows) {
    margin-left: var(--path-component-icon-margin-start);
    margin-right: var(--path-component-icon-margin-end);
}

body[dir=rtl] .hierarchical-path-component > :matches(.icon, .selector-arrows) {
    margin-left: var(--path-component-icon-margin-end);
    margin-right: var(--path-component-icon-margin-start);
}

.hierarchical-path-component > .selector-arrows {
    vertical-align: top;
    width: 5px;
    height: 16px;
    opacity: 0.6;
    content: url(../Images/UpDownArrows.svg);
}

.hierarchical-path-component > .title {
    display: flex;
    flex: 1;

    vertical-align: top;

    text-shadow: hsla(0, 0%, 100%, 0.5) 0 1px 0;
    line-height: 20px;
    height: 20px;

    min-width: 0;
    max-width: 400px;
}

.hierarchical-path-component > .title > .content {
    min-width: 0;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hierarchical-path-component > select {
    opacity: 0;

    position: absolute;
    top: -1px;
    bottom: 0;

    --path-component-select-offset-start: 13px;
    --path-component-select-offset-end: 0;
}

/* Positioned so the text in the menu aligns with the text in .title. */
body[dir=ltr] .hierarchical-path-component > select {
    left: var(--path-component-select-offset-start);
    right: var(--path-component-select-offset-end);
}

body[dir=rtl] .hierarchical-path-component > select {
    left: var(--path-component-select-offset-end);
    right: var(--path-component-select-offset-start);
}

.hierarchical-path:not(.always-show-last-path-component-separator) > .hierarchical-path-component:last-child > .separator {
    visibility: hidden;
}

.hierarchical-path-component > .separator {
    display: inline-block;
    vertical-align: top;

    background-image: url(../Images/HierarchicalNavigationItemChevron.svg);
    background-repeat: no-repeat;
    background-position-y: center;

    opacity: 0.75;

    width: 7px;
    height: 20px;

    --path-component-separator-margin-start: 2px;
}

body[dir=ltr] .hierarchical-path-component > .separator {
    margin-left: var(--path-component-separator-margin-start);
}

body[dir=rtl] .hierarchical-path-component > .separator {
    margin-right: var(--path-component-separator-margin-start);
    /* Flip the icon horizontally. */
    transform: scaleX(-1);
}

.hierarchical-path-component.text-only {
    --text-only-path-component-padding-start: 5px;
    --text-only-path-component-padding-end: 1px;
    --text-only-path-component-select-offset-start: -8px;
}

body[dir=ltr] .hierarchical-path-component.text-only {
    padding-left: var(--text-only-path-component-padding-start);
    padding-right: var(--text-only-path-component-padding-end);
}

body[dir=rtl] .hierarchical-path-component.text-only {
    padding-left: var(--text-only-path-component-padding-end);
    padding-right: var(--text-only-path-component-padding-start);
}

body[dir=ltr] .hierarchical-path-component.text-only > select {
 /* Positions so the text in the menu aligns with the text in .title for text only path components. */
    left: var(--text-only-path-component-select-offset-start);
}

body[dir=rtl] .hierarchical-path-component.text-only > select {
 /* Positions so the text in the menu aligns with the text in .title for text only path components. */
    right: var(--text-only-path-component-select-offset-start);
}
