/* charts.css — Optik aller eigenen Charts: Components/Shared/Charts (LineChart, BarChart, Sparkline, ChartLegend) und die
   Profile (PowerProfileChart, WorkoutProfileChart, CourseProfileChart, ZoneDistributionBar): grauer Grund, feine Linien,
   leise Achsen, Werte-Box mit Schatten.
   Global statt .razor.css, weil sich die Komponenten die Klassen teilen und velo-chart.js die Werte-Box baut (Elemente
   ohne Blazor-Scope-Attribut). Farben nur über Theme-Tokens → Dark Mode kommt von selbst. */

.vc {
    --vc-plate: var(--rz-base-200);
    --vc-gutter: 40px;
    position: relative;
    width: 100%;
    background: var(--vc-plate);
    border-radius: 8px;
    overflow: hidden;
    container-type: inline-size;
}

/* Zeichenfläche: links Rand für die Y-Beschriftung (--vc-gutter kommt aus der Komponente), unten für die Zeitachse,
   oben/rechts etwas Luft für Randpunkte und halbe Beschriftungen. */
.vc-plot {
    position: absolute;
    top: 10px;
    bottom: 20px;
    left: var(--vc-gutter);
    right: 10px;
    display: block;
    cursor: crosshair;
    touch-action: pan-y;
}

.vc-noaxis .vc-plot {
    bottom: 8px;
}

.vc-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.vc-grid {
    stroke: var(--rz-base-300);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.vc-zero {
    stroke: var(--rz-base-400);
    background: var(--rz-base-400);
}

.vc-line {
    fill: none;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.vc-dash {
    stroke-dasharray: 5 4;
}

.vc-area {
    stroke: none;
    fill-opacity: 0.14;
}

/* Persönlicher Normalbereich (Bereitschaft-Detail): grün wie das Band der Sparklines in der Erholungs-Karte. */
.vc-band {
    fill: var(--rz-success);
    fill-opacity: 0.14;
}

.vc-plan {
    fill: var(--rz-primary-lighter);
    stroke: none;
}

.vc-ride {
    stroke: var(--zone-4);
}

/* Soll-Ist (PlanActualChart): Plan als Stufen-Umriss über der Zonen-Fläche der Fahrt, mit Plattenfarbe als Saum,
   damit er auf jeder Zonenfarbe lesbar bleibt. */
.vc-plan-line,
.vc-plan-halo {
    fill: none;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.vc-plan-halo {
    stroke: var(--vc-plate);
    stroke-width: 4;
    stroke-opacity: 0.85;
}

.vc-plan-line {
    stroke: var(--rz-text-color);
    stroke-width: 1.75;
}

.vc-ref {
    stroke: var(--rz-text-tertiary-color);
    stroke-width: 1;
    stroke-dasharray: 4 4;
    vector-effect: non-scaling-stroke;
}

.vc-ylabel,
.vc-ref-label,
.vc-xlabel {
    position: absolute;
    font-size: 0.68rem;
    line-height: 1;
    color: var(--rz-text-tertiary-color);
    white-space: nowrap;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

/* Y-Beschriftung im linken Rand, mittig auf ihrer Linie. */
.vc-ylabel {
    right: calc(100% + 6px);
    transform: translateY(-50%);
}

/* Über der Linie rechts; Hintergrund in Plattenfarbe, damit sie über Datenlinien lesbar bleibt. */
.vc-ref-label {
    right: 0;
    padding: 1px 3px;
    border-radius: 3px;
    background: var(--vc-plate);
    transform: translateY(calc(-100% - 1px));
}

.vc-xaxis {
    position: absolute;
    left: var(--vc-gutter);
    right: 10px;
    bottom: 0;
    height: 20px;
}

.vc-xlabel {
    bottom: 5px;
    transform: translateX(-50%);
}

@container (max-width: 520px) {
    .vc-minor,
    .vc-dense { display: none; }
}

/* ── Profile (.vc-edge): randlos, 16 px Zeitachse, Umriss statt Serienlinie ── */

.vc-edge .vc-plot {
    top: 0;
    left: 0;
    right: 0;
    bottom: 16px;
}

.vc-edge.vc-noaxis .vc-plot {
    bottom: 0;
}

.vc-edge .vc-xaxis {
    left: 0;
    right: 0;
    height: 16px;
}

.vc-edge .vc-xlabel {
    bottom: 3px;
}

.vc-edge .vc-ref-label {
    right: 4px;
}

/* Kompaktes Profil mit Werte-Box (WorkoutProfileChart Hover, Wochenübergang): zu flach für die Box, sie steht deshalb über
   dem Profil. Dafür darf die Platte nicht mehr abschneiden; die Rundung übernimmt der Clip der Zeichenfläche. */
.vc.vc-hover {
    overflow: visible;
}

.vc-hover .vc-svg {
    clip-path: inset(0 round 8px);
}

.vc-hover .vc-readout {
    top: auto;
    bottom: calc(100% + 6px);
}

/* Kein Platz über dem Profil (oben im Scrollbereich): darunter, gesetzt von velo-chart.js. */
.vc-hover .vc-readout.vc-readout-below {
    top: calc(100% + 6px);
    bottom: auto;
}

/* Kompakte Profile ohne Werte-Box (kein data-chart) zeigen kein Fadenkreuz-Symbol. */
velo-chart:not([data-chart]) {
    cursor: inherit;
}

/* Flächen aus vielen Polygonen: haarfeine Kontur in Flächenfarbe (inline stroke) deckt die hellen Kantenglättungs-
   Fugen zwischen Nachbarn ab. Halbtransparente Flächen bekommen keine, sonst doppelt deckende Ränder. */
.vc-edge .vc-svg polygon {
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.vc-outline {
    fill: none;
    stroke: var(--rz-text-secondary-color);
    stroke-width: 1.5;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

/* Fuge zwischen zwei Soll-Blöcken in Plattenfarbe — hält das Profil blockig. */
.vc-joint {
    stroke: var(--vc-plate);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

/* Freie Beschriftung im Chart (Höhe oben/unten im Streckenprofil). */
.vc-tag {
    position: absolute;
    padding: 1px 3px;
    border-radius: 3px;
    background: var(--vc-plate);
    font-size: 0.68rem;
    line-height: 1;
    color: var(--rz-text-tertiary-color);
    white-space: nowrap;
    pointer-events: none;
}

/* Platzhalter, wenn ein Profil keine Daten hat. */
.vc-empty {
    width: 100%;
    height: 2px;
    background: var(--rz-base-300);
    border-radius: 1px;
}

/* Punkte/Marker als HTML: bleiben rund. Ring in Plattenfarbe hält sie über Linien lesbar. Klicks laufen über
   velo-chart.js (Nähe), daher pointer-events: none. */
.vc-pt {
    position: absolute;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 0 2px var(--vc-plate);
    pointer-events: none;
    transition: transform 0.1s ease;
}

.vc-pt.vc-muted {
    background: color-mix(in srgb, var(--c) 55%, var(--vc-plate));
}

.vc-pt.vc-small {
    width: 7px;
    height: 7px;
    margin: -3.5px 0 0 -3.5px;
}

.vc-pt.vc-diamond {
    width: 9px;
    height: 9px;
    margin: -4.5px 0 0 -4.5px;
    border-radius: 1px;
    transform: rotate(45deg);
}

.vc-pt.vc-pt-hot {
    transform: scale(1.6);
    background: var(--c);
}

/* Tastaturfokus auf einem klickbaren Punkt: sichtbarer Ring */
button.vc-pt:focus-visible {
    outline: 2px solid var(--rz-primary, #5b53c6);
    outline-offset: 3px;
    transform: scale(1.6);
}

.vc-pt.vc-diamond.vc-pt-hot {
    transform: rotate(45deg) scale(1.6);
}

/* Fadenkreuz (LineChart) bzw. markierte Spalte (BarChart, .vc-colband). */
.vc-cursor {
    display: none;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 1px;
    background: var(--rz-text-tertiary-color);
    pointer-events: none;
}

.vc-cursor.vc-colband {
    background: color-mix(in srgb, var(--rz-text-color) 7%, transparent);
    border-radius: 4px;
}

.vc-dots {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.vc-dots i {
    position: absolute;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 0 2px var(--vc-plate);
}

.vc-readout {
    display: none;
    position: absolute;
    top: 0;
    z-index: 2;
    padding: 0.35rem 0.55rem;
    background: var(--rz-base-background-color);
    border: 1px solid var(--rz-base-300);
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--rz-text-secondary-color);
    white-space: nowrap;
    pointer-events: none;
}

.vc-r-head {
    color: var(--rz-text-tertiary-color);
}

.vc-r-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.vc-r-row b {
    font-weight: 700;
    color: var(--rz-text-color);
}

.vc-r-sub {
    max-width: 15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--rz-text-tertiary-color);
}

/* Serien-Schlüssel in Legende und Werte-Box: wie die Marke im Chart. */
.vc-key {
    display: inline-block;
    flex: 0 0 auto;
    width: 14px;
    height: 0;
    border-top: 2px solid var(--c);
}

.vc-key[data-k="dash"] {
    border-top-style: dashed;
}

.vc-key[data-k="dot"] {
    width: 8px;
    height: 8px;
    border: none;
    border-radius: 50%;
    background: var(--c);
}

.vc-key[data-k="diamond"] {
    width: 7px;
    height: 7px;
    margin: 0 1px;
    border: none;
    border-radius: 1px;
    background: var(--c);
    transform: rotate(45deg);
}

.vc-key[data-k="box"] {
    width: 10px;
    height: 10px;
    border: none;
    border-radius: 2px;
    background: var(--c);
}

.vc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.9rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--rz-text-secondary-color);
}

.vc-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* Zellen-Modus (Kalender-Heatmap): Zelle unter dem Zeiger mit Rahmen in Textfarbe. */
.vc-cell-hot {
    outline: 2px solid var(--rz-text-color);
    outline-offset: 1px;
}

/* ── Säulen (BarChart) ── */

.vc-hline {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--rz-base-300);
    pointer-events: none;
}

.vc-cols {
    position: absolute;
    inset: 0;
    display: flex;
}

.vc-col {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

/* Höchstens 24 px breit, oben 4 px rund, unten eckig auf der Grundlinie; 2 px Fuge zwischen gestapelten Teilen. */
.vc-bar {
    position: relative;
    width: min(24px, 70%);
    display: flex;
    flex-direction: column-reverse;
    gap: 2px;
    border-radius: 4px 4px 0 0;
    overflow: hidden;
    background: var(--c, transparent);
}

.vc-bar-abs {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.vc-seg {
    flex: 0 1 0;
    min-height: 0;
    background: var(--c);
}

/* ── Sparkline ── */

.vc-spark {
    position: relative;
    flex: 0 0 auto;
}

/* Innen 4 px Luft, damit Linie und Endpunkt nicht am Rand abgeschnitten werden. */
.vc-spark-in {
    position: absolute;
    inset: 4px 4px 4px 0;
}

.vc-spark-in svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.vc-spark .vc-pt {
    box-shadow: none;
}

/* Breite des Containers statt fester Width (Wellness-/Form-Kacheln) */
.vc-spark-fill {
    width: 100%;
    flex: 1 1 auto;
}

/* Persönlicher Normalbereich hinter der Linie (Wellness) */
.vc-spark-band {
    stroke: none;
    fill-opacity: 0.14;
}

.vc-spark-ref {
    stroke: var(--rz-text-tertiary-color);
    stroke-width: 1;
    stroke-dasharray: 3 3;
    vector-effect: non-scaling-stroke;
}

.vc-spark-band-edge {
    stroke-width: 1;
    stroke-dasharray: 2 2;
    stroke-opacity: 0.45;
    vector-effect: non-scaling-stroke;
}

/* Workout-Builder: durchsichtiger Knopf je Block im Soll-Profil (WorkoutProfileChart mit OnBlockClick). Antippen wählt den
   Block, der gewählte ist umrahmt. Die Knöpfe liegen im velo-chart, die Werte-Box folgt dem Finger weiter. */
.vc-block-hit {
    position: absolute;
    top: 0;
    bottom: 0;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    z-index: 1;
}

    .vc-block-hit:hover {
        background: color-mix(in srgb, var(--rz-primary) 6%, transparent);
    }

    .vc-block-hit.vc-block-selected {
        border-color: var(--rz-primary);
        background: color-mix(in srgb, var(--rz-primary) 12%, transparent);
    }
