/**
 * Analytics
 *
 * SPDX-FileCopyrightText: 2026 Marcel Scherello
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

/* The native picker already names Analytics in its dialog title. */
.smart-picker-search .vs__dropdown-option:has(.group-name-icon[src*="/analytics/img/app-dark.svg"]) {
    display: none;
}

.analytics-reference-widget {
    display: flex;
    flex-direction: column;
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-large, 8px);
    background-color: var(--color-main-background);
    color: var(--color-main-text);
    overflow: hidden;
}

.analytics-reference-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
}

.analytics-reference-header img {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.analytics-reference-header a,
.analytics-reference-header span {
    font-weight: 600;
    color: var(--color-main-text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analytics-reference-header a:hover {
    text-decoration: underline;
}

.analytics-reference-body {
    position: relative;
    height: 350px;
    padding: 8px;
    box-sizing: border-box;
}

/* combined chart + table view: chart on top, scrollable table below */
.analytics-reference-body.analytics-reference-ct {
    height: auto;
}

/* table-only view: grow with the content, but stay scrollable within a cap */
.analytics-reference-body.analytics-reference-scroll {
    height: auto;
    max-height: 350px;
    overflow-y: auto;
    overflow-x: auto;
}

.analytics-reference-chart-area {
    position: relative;
    height: 334px;
}

.analytics-reference-ct .analytics-reference-chart-area {
    height: 260px;
}

.analytics-reference-table-area {
    max-height: 260px;
    overflow-y: auto;
    overflow-x: auto;
    margin-top: 8px;
}

.analytics-reference-body table {
    width: 100%;
}

.analytics-reference-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-maxcontrast, var(--color-text-lighter));
}

/* panorama grid: first page of the panorama, one cell per widget */
.analytics-reference-body.analytics-reference-panorama {
    height: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 8px;
}

.analytics-reference-panorama-cell {
    position: relative;
    height: 240px;
    padding: 4px;
    box-sizing: border-box;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius, 4px);
    overflow: hidden;
}

.analytics-reference-panorama-cell-title {
    height: 24px;
    padding-left: 6px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analytics-reference-panorama-cell-content {
    position: relative;
    height: calc(100% - 24px);
    overflow: hidden;
}

.analytics-reference-panorama-cell-content.analytics-reference-scroll {
    overflow-y: auto;
}

.analytics-reference-panorama-text {
    padding: 6px;
    white-space: pre-wrap;
    overflow-y: auto;
    height: 100%;
}

.analytics-reference-panorama-picture {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.analytics-reference-panorama-picture img {
    max-width: 90%;
    max-height: 90%;
}

.analytics-reference-footer {
    padding: 4px 12px;
    border-top: 1px solid var(--color-border);
    font-size: 0.9em;
}

.analytics-reference-footer a {
    color: var(--color-text-maxcontrast, var(--color-text-lighter));
}

/* static fallback card (also used while the rich object carries no id) */
.analytics-reference-fallback {
    display: flex;
    color: var(--color-main-text);
}

.analytics-reference-fallback img {
    width: 20%;
    padding: 20px;
    opacity: .5;
    box-sizing: border-box;
}

.analytics-reference-fallback-content {
    padding: 10px;
    width: 75%;
}

.analytics-reference-fallback-title {
    font-weight: 600;
}

.analytics-reference-fallback-subheader {
    margin-top: 1em;
}

/* KPI styles from style.css, which is not loaded in the reference context */
.analytics-reference-widget .kpiWidget {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.analytics-reference-widget .kpiWidgetContent {
    text-align: center;
}

.analytics-reference-widget .kpiWidgetTitel {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.analytics-reference-widget .kpiWidgetValue {
    font-size: 3.5rem;
    font-weight: 400;
}

.analytics-reference-panorama-cell .kpiWidgetTitel {
    font-size: 1.1rem;
}

.analytics-reference-panorama-cell .kpiWidgetValue {
    font-size: 2.2rem;
}
