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

.cpu-usage-combined-view {
    display: flex;
    width: 100%;
    height: calc(var(--cpu-usage-combined-view-height) + var(--cpu-usage-indicator-view-height) + 2px); /* +2 for borders */
    border-bottom: 1px solid var(--border-color);
}

.cpu-usage-combined-view > .graph,
.cpu-usage-combined-view > .graph > :matches(.stacked-area-chart, .range-chart),
.cpu-usage-combined-view > .graph > :matches(.stacked-area-chart, .range-chart) > svg {
    width: 100%;
    height: 100%;
}

.cpu-usage-combined-view > .graph > .stacked-area-chart {
    height: calc(var(--cpu-usage-combined-view-height));
}

.cpu-usage-combined-view > .graph > .range-chart {
    position: relative;
    z-index: calc(var(--timeline-marker-z-index) + 1);
    height: calc(var(--cpu-usage-indicator-view-height) + 2px); /* +2 for borders */
    background-color: var(--background-color-content);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.cpu-usage-combined-view > .details {
    flex-shrink: 0;
    width: 150px;
    padding-top: 10px;
    -webkit-padding-start: 15px;
    font-size: 12px;
    color: var(--text-color-secondary);
    overflow: hidden;
    text-overflow: ellipsis;

    --cpu-usage-combined-view-details-border-end: 1px solid var(--border-color);
}

body[dir=ltr] .cpu-usage-combined-view > .details {
    border-right: var(--cpu-usage-combined-view-details-border-end);
}

body[dir=rtl] .cpu-usage-combined-view > .details {
    border-left: var(--cpu-usage-combined-view-details-border-end);
}

.cpu-usage-combined-view > :matches(.details, .legend) > .name {
    color: var(--text-color);
    white-space: nowrap;
}

.cpu-usage-combined-view > .graph {
    position: relative;
}

body[dir=rtl] .cpu-usage-combined-view > .graph {
    transform: scaleX(-1);
}

.cpu-usage-combined-view > .details > .legend-container {
    font-size: 11px;
}

.cpu-usage-combined-view > .details > .legend-container > .row {
    display: flex;
}

.cpu-usage-combined-view > .details > .legend-container > .row + .row {
    margin-top: 4px;
}

.cpu-usage-combined-view > .details > .legend-container > .row > .swatch {
    width: 1em;
    height: 1em;
    margin-top: 1px;
    -webkit-margin-end: 4px;
}

.cpu-usage-combined-view > .details > .legend-container .swatch.total {
    background-color: none;
    border: none;
}

.cpu-usage-combined-view > .details > .legend-container .swatch.other-threads {
    background-color: var(--cpu-other-thread-fill-color);
    border: 1px solid var(--cpu-other-thread-stroke-color);
}

.cpu-usage-combined-view > .details > .legend-container .swatch.main-thread {
    background-color: var(--cpu-main-thread-fill-color);
    border: 1px solid var(--cpu-main-thread-stroke-color);
}

.cpu-usage-combined-view > .details > .legend-container .swatch.worker-threads {
    background-color: var(--cpu-worker-thread-fill-color);
    border: 1px solid var(--cpu-worker-thread-stroke-color);
}

.cpu-usage-combined-view > .graph > .range-chart rect {
    stroke-opacity: 0.25;
}

.cpu-usage-combined-view > .graph > .range-chart .sample-type-javascript {
    stroke: var(--cpu-javascript-stroke-color);
    fill: var(--cpu-javascript-fill-color);
}

.cpu-usage-combined-view > .graph > .range-chart .sample-type-style {
    stroke: var(--cpu-style-stroke-color);
    fill: var(--cpu-style-fill-color);
}

.cpu-usage-combined-view > .graph > .range-chart .sample-type-layout {
    stroke: var(--cpu-layout-stroke-color);
    fill: var(--cpu-layout-fill-color);
}

.cpu-usage-combined-view > .graph > .range-chart .sample-type-paint {
    stroke: var(--cpu-paint-stroke-color);
    fill: var(--cpu-paint-fill-color);
}
