.jqplot-target {
    color: @theme-color-text;
}

.jqplot-loading {
    background-color: @theme-color-background-contrast;
}

a.rowevolution-startmulti {
    color: @theme-color-link !important;
}

.rowevolution table.metrics td.text {
    color: @theme-color-text-light;
}

.rowevolution table.metrics td.text span.details,
.rowevolution .metric-selectbox select {
    color: @theme-color-text;
}

.piwik-graph {
    height: 250px;
}

.jqplot-legend-footer {
    display: none;
}

.jqplot-legend-footer.has-legend,
.jqplot-legend-footer.has-picker {
    // Used by jqplot.js to match the exported image legend layout.
    --jqplot-legend-footer-height: 38px;
    --jqplot-legend-swatch-size: 12px;
    --jqplot-legend-item-gap: 8px;
    --jqplot-legend-row-gap: 24px;
    --jqplot-legend-line-gap: 6px;
    --jqplot-legend-horizontal-padding: 12px;

    height: var(--jqplot-legend-footer-height);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
}

// Pie graphs already label their slices via the in-chart pieLegend, so the footer
// legend (a single-metric row) is redundant. Hide just the legend items and keep the
// footer (and its "Choose metrics" picker, which is how the displayed metric is switched).
.dataTableVizPie .jqplot-legend-footer .jqplot-legend-items {
    display: none;
}

// When evolution annotations are shown they sit above the legend footer and add
// their own spacing, so drop the default margin to avoid doubling the gap.
.evolution-annotations ~ .jqplot-legend-footer {
    margin-top: 0;
}

.jqplot-legend-picker {
    display: flex;
    align-items: center;
    flex: none;
}

.jqplot-legend-items {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    align-content: safe center;
    gap: var(--jqplot-legend-line-gap) var(--jqplot-legend-row-gap);
    height: var(--jqplot-legend-footer-height);
    overflow: hidden;
    flex: auto;
}

// One row stays centered (rule above); once the legend wraps to two rows, left-align it —
// but only in the wide layout. The narrow/stacked layout (.is-narrow) keeps it centered.
// Left-aligned, the legend butts up against the "Choose metrics" picker, so add a gap between them.
.jqplot-legend-footer.is-multi-row:not(.is-narrow) .jqplot-legend-items {
    justify-content: flex-start;
    margin-left: 18px;
}

.jqplot-legend-item {
    display: inline-flex;
    align-items: center;
    gap: var(--jqplot-legend-item-gap);
    max-width: 100%;
    min-width: 0;
}

.jqplot-legend-item.jqplot-legend-item-hidden {
    display: none;
}

.jqplot-legend-swatch {
    width: var(--jqplot-legend-swatch-size);
    height: var(--jqplot-legend-swatch-size);
    min-width: var(--jqplot-legend-swatch-size);
    border-radius: 50%;
    flex: none;
}

.jqplot-legend-label {
    color: @theme-color-text-lighter;
    font-size: 12px;
    line-height: 16px;
    min-width: 0;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

// When the report itself is narrow — its own width, not the viewport, so this also applies
// to reports shown as narrow dashboard widgets — the "Choose metrics" button and the legend
// can't sit side by side, so stack them: the legend keeps its row(s) on top and the picker
// drops onto its own full-width line below. jqplot.js measures the footer width and toggles
// `is-narrow` (a stand-in for a CSS container query, which less.php can't compile).
.jqplot-legend-footer.is-narrow {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: var(--jqplot-legend-line-gap);
}

.jqplot-legend-footer.is-narrow .jqplot-legend-items {
    order: 1;
}

.jqplot-legend-footer.is-narrow .jqplot-legend-picker {
    order: 2;
    display: block;
    width: 100%;
}

.dataTableVizEvolution {
    > .dataTableWrapper {
        width: 100%;
    }

    .piwik-graph {
        height: 170px;
    }
}

// With the redesigned legend, widgetized evolution charts match the 20px left/right
// padding of the reports page.
.widget .dataTableVizEvolution {
    padding-left: 20px;
    padding-right: 20px;
}

.widget .tagCloud {
    padding: 10px;
}
.widget .dataTableVizBar .jqplot-graph {
    padding: 0 10px 10px 10px;
}

.tooltip-series-color {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 6px;
    margin-right: 3px;
    position: relative;
    top: 1px;
}

.ui-tooltip h3.evolution-tooltip-header {
    margin-top: 4px;
}
