/* LapViz Studio: what the Tailwind / KTUI classes of the web site do not cover. */

#blazor-error-ui[style*="display: block"],
#blazor-error-ui.show {
    display: block !important;
}

.lv-studio-loading {
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    animation: lv-studio-spin 0.8s linear infinite;
}

@keyframes lv-studio-spin {
    to {
        transform: rotate(360deg);
    }
}

/* uPlot in the theme colors */
.lv-studio-chart .uplot {
    font-family: var(--font-sans);
    color: var(--muted-foreground);
}

.lv-studio-chart .u-legend {
    display: none;
}

.lv-studio-chart .u-cursor-x {
    border-right: 1px dashed var(--muted-foreground);
}

.lv-studio-chart .u-cursor-y {
    display: none;
}

.lv-studio-chart .u-select {
    background: color-mix(in oklab, var(--primary) 15%, transparent);
}

/* Drop zone shown while a file is dragged over the window */
.lv-studio-drop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    background: color-mix(in oklab, var(--background) 80%, transparent);
    border: 3px dashed var(--primary);
}

.lv-studio-drop.active {
    display: flex;
}

.lv-studio-drop input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: copy;
}

/* Canvas views (map, scatter, histogram) fill their box */
.lv-studio-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* The z-indexes of Dockview (sashes 99, overlays 999...) stay inside the layout: the menus of the header stay above it */
#studio-dock {
    isolation: isolate;
}

/* The layout of the panels (Dockview, dock.js) in the colors of the site, light and dark (more specific than the theme
   of Dockview, whose styles are added after these ones) */
.dockview-theme-light.lv-dock {
    font-family: inherit;
    --dv-tabs-and-actions-container-font-size: 12px;
    --dv-tabs-and-actions-container-height: 32px;
    --dv-group-view-background-color: var(--background);
    --dv-tabs-and-actions-container-background-color: var(--muted);
    --dv-activegroup-visiblepanel-tab-background-color: var(--background);
    --dv-activegroup-hiddenpanel-tab-background-color: var(--muted);
    --dv-inactivegroup-visiblepanel-tab-background-color: var(--background);
    --dv-inactivegroup-hiddenpanel-tab-background-color: var(--muted);
    --dv-tab-divider-color: var(--border);
    --dv-activegroup-visiblepanel-tab-color: var(--foreground);
    --dv-activegroup-hiddenpanel-tab-color: var(--muted-foreground);
    --dv-inactivegroup-visiblepanel-tab-color: var(--secondary-foreground);
    --dv-inactivegroup-hiddenpanel-tab-color: var(--muted-foreground);
    --dv-separator-border: var(--border);
    --dv-paneview-active-outline-color: var(--primary);
    --dv-drag-over-background-color: color-mix(in srgb, var(--primary) 20%, transparent);
    --dv-icon-hover-background-color: var(--accent);
    --dv-scrollbar-background-color: var(--border);
}

.dark .dockview-theme-light.lv-dock {
    color-scheme: dark;
}

/* "?" of a group of panels (dock.js HelpAction): the help of the panel shown */
.lv-dock-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 100%;
    border: 0;
    background: transparent;
    color: var(--muted-foreground);
    font-size: 14px;
    cursor: pointer;
}

.lv-dock-help:hover {
    color: var(--primary);
}

/* The help of a panel, beside the studio (studio.js openHelpPanel) */
.lv-help-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    width: min(32rem, 100vw);
    border-left: 1px solid var(--border);
    background: var(--background);
    box-shadow: -8px 0 24px rgb(0 0 0 / 0.12);
}

.lv-help-panel[hidden] {
    display: none;
}

.lv-help-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 2.75rem;
    padding: 0 0.5rem 0 0.9rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.875rem;
}

.lv-help-bar .lv-help-title {
    flex: 1;
}

.lv-help-bar > i {
    color: var(--primary);
}

.lv-help-frame {
    flex: 1;
    width: 100%;
    border: 0;
}

/* A panel: its component fills it and scrolls */
.lv-dock-panel {
    height: 100%;
    overflow: auto;
    color: var(--foreground);
}

/* "+" of a chart (ChannelPicker): a channel added to it; a small select, its options listed when open */
.lv-chart-add {
    width: 1.75rem;
    height: 1.5rem;
    padding: 0;
    border-radius: 0.375rem;
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--muted-foreground);
    text-align: center;
    text-align-last: center;
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
}

.lv-chart-add:hover {
    color: var(--foreground);
    border-color: var(--input);
}

/* The strip of the laps (Components/Dock/StripDock.razor): the session drawn small, a cell per lap */
.lv-strip-row {
    display: flex;
    flex: 1 1 0;
    min-height: 3.25rem;
    flex-direction: column;
}

.lv-strip-title {
    overflow: hidden;
    padding-bottom: 0.125rem;
    font-size: 11px;
    color: var(--muted-foreground);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.lv-strip {
    position: relative;
    flex: 1 1 0;
    min-height: 2.75rem;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--card);
}

.lv-strip-line {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.lv-strip-line polyline {
    fill: none;
    stroke: var(--muted-foreground);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.lv-strip-gap,
.lv-strip-lap {
    position: absolute;
    top: 0;
    bottom: 0;
}

/* Between the laps (pits, before the start): hatched, not selectable */
.lv-strip-gap {
    background: repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in srgb, var(--muted-foreground) 14%, transparent) 4px 5px);
}

.lv-strip-lap {
    display: flex;
    align-items: flex-start;
    border-inline-end: 1px solid var(--border);
    cursor: pointer;
    text-align: start;
}

.lv-strip-lap:hover {
    background: color-mix(in srgb, var(--accent) 60%, transparent);
}

.lv-strip-out {
    background: color-mix(in srgb, var(--muted) 70%, transparent);
}

.lv-strip-selected,
.lv-strip-selected:hover {
    background: color-mix(in srgb, var(--lap-color) 14%, transparent);
    box-shadow: inset 0 0 0 2px var(--lap-color);
}

.lv-strip-label {
    max-width: 100%;
    overflow: hidden;
    padding: 1px 4px;
    font-size: 10px;
    line-height: 1.2;
    color: var(--muted-foreground);
    white-space: nowrap;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

.lv-strip-selected .lv-strip-label {
    color: var(--foreground);
}

.lv-strip-best,
.lv-strip-selected .lv-strip-best {
    font-weight: 600;
    color: #7c3aed; /* violet-600: the best lap everywhere in the studio */
}

.dark .lv-strip-best,
.dark .lv-strip-selected .lv-strip-best {
    color: #a78bfa; /* violet-400 */
}

/* The lap times along the session (Components/Dock/LapTimesDock.razor): SVG in percentages, the labels in HTML */
.lv-times {
    display: flex;
    flex: 1 1 0;
    min-height: 10rem;
    gap: 0.25rem;
}

.lv-times-y {
    position: relative;
    width: 3.5rem;
    flex-shrink: 0;
}

.lv-times-y span,
.lv-times-x span {
    position: absolute;
    font-size: 10px;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.lv-times-y span {
    right: 0;
    transform: translateY(-50%);
}

.lv-times-plot {
    position: relative;
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-width: 0;
}

.lv-times-plot svg {
    flex: 1 1 0;
    overflow: visible;
    border-bottom: 1px solid var(--border);
}

.lv-times-x {
    position: relative;
    height: 1rem;
}

.lv-times-x span {
    top: 2px;
    transform: translateX(-50%);
}

.lv-times-grid {
    stroke: var(--border);
    stroke-width: 1;
}

.lv-times-line {
    stroke-width: 1.5;
    stroke-opacity: 0.55;
}

.lv-times-trend {
    stroke-width: 1.5;
    stroke-dasharray: 5 4;
}

.lv-times-dot {
    fill: var(--series);
    stroke: var(--card);
    stroke-width: 1.5;
    cursor: pointer;
}

.lv-times-dot:hover {
    stroke: var(--foreground);
}

.lv-times-slow {
    fill: var(--card);
    stroke: var(--series);
}

.lv-times-best {
    fill: #7c3aed; /* violet-600: the best lap everywhere in the studio */
}

.dark .lv-times-best {
    fill: #a78bfa;
}

.lv-times-dot[data-selected] {
    stroke: var(--lap-color);
    stroke-width: 3;
}

/* The dashboard (Components/Dock/DashboardDock.razor, wwwroot/js/dashboard.js): the gauges of a dash */
.lv-dash-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.5rem;
}

.lv-dash-label {
    font-size: 11px;
    color: var(--muted-foreground);
}

.lv-dash-time {
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.lv-dash-gauges {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: 0.75rem;
}

.lv-dash-gauge {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--card);
    padding: 0.25rem 0.5rem 0.5rem;
    text-align: center;
}

.lv-dash-arc {
    fill: none;
    stroke: var(--border);
    stroke-width: 7;
    stroke-linecap: round;
}

.lv-dash-fill {
    fill: none;
    stroke-width: 7;
    stroke-linecap: round;
    opacity: 0.35;
}

.lv-dash-needle {
    stroke-linecap: round;
}

.lv-dash-hub {
    fill: var(--foreground);
}

.lv-dash-scale {
    font-size: 8px;
    fill: var(--muted-foreground);
}

.lv-dash-value {
    font-size: 17px;
    font-weight: 600;
    fill: var(--foreground);
    font-variant-numeric: tabular-nums;
}

.lv-dash-name {
    font-size: 12px;
    font-weight: 500;
}

.lv-dash-name span,
.lv-dash-gaps {
    font-size: 11px;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
}

/* The values of the laps next to the cursor of a chart (button Values), in the area of the curves */
.lv-studio-values {
    position: absolute;
    z-index: 6;
    pointer-events: none;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: color-mix(in oklab, var(--background) 94%, transparent);
    color: var(--foreground);
    box-shadow: 0 4px 14px rgb(0 0 0 / 0.12);
    font-size: 11px;
    line-height: 1.5;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.lv-studio-values .lv-head,
.lv-studio-values .lv-channel,
.lv-studio-values .lv-gap,
.lv-studio-values .lv-author {
    color: var(--muted-foreground);
}

.lv-studio-values .lv-channel {
    margin-top: 0.125rem;
    font-weight: 500;
}

.lv-studio-values .lv-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.lv-studio-values .lv-dot {
    width: 0.5rem;
    height: 0.5rem;
    flex: none;
    border-radius: 9999px;
}

.lv-studio-values .lv-lap {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lv-studio-values .lv-value {
    margin-left: auto;
    padding-left: 0.75rem;
    font-weight: 600;
}

.lv-studio-values .lv-gap {
    min-width: 2.75rem;
    text-align: right;
}

.lv-studio-values .lv-note {
    display: flex;
    gap: 0.375rem;
    max-width: 16rem;
    margin-top: 0.25rem;
    padding-top: 0.25rem;
    border-top: 1px solid var(--border);
    white-space: normal;
}

.lv-studio-values .lv-flag {
    width: 0.5rem;
    height: 0.5rem;
    flex: none;
    margin-top: 0.25rem;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

/* The cursor stays where the chart was clicked while its menu is open */
.lv-studio-chart .lv-studio-frozen .u-cursor-x {
    border-right: 1.5px solid var(--primary);
}

/* The menu of a click on the charts, and its note form */
.lv-studio-menu {
    position: fixed;
    z-index: 70;
    min-width: 14rem;
    padding: 0.25rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--background);
    color: var(--foreground);
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.18);
    font-size: 0.8125rem;
}

.lv-studio-menu .lv-head {
    padding: 0.375rem 0.625rem 0.25rem;
    font-size: 11px;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
}

.lv-studio-menu [role=menuitem] {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.625rem;
    border-radius: 0.3rem;
    text-align: start;
}

.lv-studio-menu [role=menuitem]:hover,
.lv-studio-menu [role=menuitem]:focus-visible {
    background: var(--accent);
    outline: none;
}

.lv-studio-menu [role=menuitem] i {
    color: var(--muted-foreground);
}

.lv-studio-menu .lv-hint {
    margin-left: auto;
    padding-left: 1rem;
    font-size: 11px;
    color: var(--muted-foreground);
}

.lv-studio-menu hr {
    margin: 0.25rem 0;
    border-color: var(--border);
}

.lv-studio-note {
    display: flex;
    width: 18rem;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.625rem;
}

.lv-studio-note .lv-head {
    padding: 0;
}

.lv-studio-note .lv-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.lv-studio-note .lv-private {
    font-size: 11px;
    color: var(--muted-foreground);
}

.lv-studio-flash {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    z-index: 80;
    transform: translateX(-50%);
    padding: 0.5rem 0.875rem;
    border-radius: 0.375rem;
    background: var(--foreground);
    color: var(--background);
    font-size: 0.8125rem;
}
