/*
 * 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.
 */

body:matches(.page, .web-page) .toolbar.collapsed .dashboard.default > :matches(.resourcesSize, .time, .logs) {
    display: none;
}

body:not(.page, .web-page) .toolbar .dashboard.default > :matches(.resourcesCount, .resourcesSize, .time) {
    display: none;
}

.toolbar .dashboard.default {
    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
}

.toolbar .dashboard.default > .item {
    line-height: 13px;

    margin: 1px 0;
    padding: 0 5px;

    display: flex;

    min-width: 45px;

    justify-content: center;
    align-items: center;

    border-radius: 4px;
    border: 1px solid transparent;

    font-family: -webkit-system-font, sans-serif;
    font-variant-numeric: tabular-nums;
}

.toolbar .dashboard.default > :matches(.time, .resourcesSize) {
    min-width: 70px;
}

.toolbar .dashboard.default > .item.enabled:hover {
    border: 1px solid hsla(0, 0%, 0%, 0.1);
}

.toolbar .dashboard.default > .item.enabled:active {
    border: 1px solid hsla(0, 0%, 0%, 0.2);
}

.toolbar .dashboard.default > .item > * {
    display: flex;
    align-items: center;
}

.toolbar .dashboard.default > .item > img {
    opacity: 0.2;
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.toolbar .dashboard.default > .item.enabled > img {
    opacity: 0.5;
}

.toolbar .dashboard.default > .item.enabled:hover > img {
    opacity: 0.65;
}

.toolbar .dashboard.default > .item > div {
    display: flex;
    flex: 1;
    -webkit-padding-start: 2px;
    color: hsla(0, 0%, 0%, 0.2);
}

.toolbar .dashboard.default > .item.enabled > div {
    color: hsla(0, 0%, 0%, 0.7);
}

.toolbar .dashboard.default > .item.enabled:hover > div {
    color: hsla(0, 0%, 0%, 0.85);
}

.toolbar .dashboard.default > .resourcesCount > img {
    content: url(../Images/Resources.svg);
}

.toolbar .dashboard.default > .time > img {
    content: url(../Images/Time.svg);
}

.toolbar .dashboard.default > .logs > img {
    content: url(../Images/Logs.svg);
}

.toolbar .dashboard.default > .resourcesSize > img {
    content: url(../Images/Weight.svg);
}

.toolbar .dashboard.default > .errors > img {
    content: url(../Images/Errors.svg);
}

.toolbar .dashboard.default > .errors.enabled > img {
    content: url(../Images/ErrorsEnabled.svg);
    opacity: 0.9;
}

.toolbar .dashboard.default > .errors.enabled:hover > img {
    opacity: 1;
}

.toolbar .dashboard.default > .errors.enabled > div {
    color: hsla(359, 57%, 50%, 0.9);
}

.toolbar .dashboard.default > .errors.enabled:hover > div {
    color: hsl(359, 57%, 50%);
}

.toolbar .dashboard.default > .issues > img {
    content: url(../Images/Issues.svg);
}

.toolbar .dashboard.default > .issues.enabled > img {
    content: url(../Images/IssuesEnabled.svg);
    opacity: 0.9;
}

.toolbar .dashboard.default > .issues.enabled:hover > img {
    opacity: 1;
}

.toolbar .dashboard.default > .issues.enabled > div {
    color: hsla(43, 96%, 44%, 0.9);
}

.toolbar .dashboard.default > .issues.enabled:hover > div {
    color: hsl(43, 96%, 44%);
}

/* Styles for the pulsing animated state of console items */

.toolbar .dashboard.default > .item.pulsing {
    animation-name: console-item-pulse;
    animation-duration: 0.75s;
}

@keyframes console-item-pulse {
    50% { opacity: 0.6; }
}

@media (prefers-color-scheme: dark) {
    .toolbar .dashboard.default > .item > div {
        /* FIXME: introduce a variable for opacity and use it for both text and icons */
        color: hsla(0, 100%, 100%, 0.2);
    }

    .toolbar .dashboard.default > .item.enabled > div {
        color: var(--glyph-color);
    }

    .toolbar .dashboard.default > .item.enabled:hover {
        border-color: hsla(0, 0%, var(--foreground-lightness), 0.1);
    }

    .toolbar .dashboard.default > .item.enabled:hover > div {
        color: hsla(0, 100%, 100%, 0.85);
    }

    .toolbar .dashboard.default > .resourcesCount > img,
    .toolbar .dashboard.default > .resourcesSize > img,
    .toolbar .dashboard.default > .time > img,
    .toolbar .dashboard.default > .logs > img,
    .toolbar .dashboard.default > .errors:not(.enabled) > img,
    .toolbar .dashboard.default > .issues:not(.enabled) > img {
        filter: var(--filter-invert);
    }

    .toolbar .dashboard .item.button,
    .toolbar .dashboard .item.button:active {
        background: none;
    }

    .dashboard-container .advance-arrow {
        filter: var(--filter-invert);
    }
}
