﻿/* ==========================================================================
   vitabene – Seiten und fachliche Bausteine (Präfix vb-)
   Nur, was die Components Library nicht abdeckt; Farben und Abstände über Tokens.
   ========================================================================== */

/* ── Allgemein ────────────────────────────────────────────────────────────── */

.vb-abschnitt {
    margin-bottom: var(--oo-space-5);
}

.vb-filterleiste {
    margin-bottom: var(--oo-space-4);
}

/* Filterfelder in einer Zeile nebeneinander statt in voller Breite */
.vb-filterfeld {
    flex: 0 0 auto;
    width: 13rem;
}

.vb-filterfeld--breit {
    width: 17rem;
}

/* Text, Icons und Plaketten in einer Zeile mit Abstand (Plaketten in @if stehen sonst ohne Leerraum am Text) */
.vb-zeile {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--oo-space-1) var(--oo-space-2);
}

.vb-gedaempft {
    color: var(--oo-color-text-subtle);
}

.vb-text-gefahr {
    color: var(--oo-danger-dark);
    font-weight: 600;
}

/* Text in Warn-/Gefahrfarbe: dunklere Stufe, damit der Kontrast auch auf grauen Tabellenzeilen reicht */
.vb-text-warnung {
    color: var(--oo-warning-darker);
    font-weight: 600;
}

.vb-umbruch {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Listen ohne waagrechtes Scrollen: knapperer Zellabstand, Kopfzeilen und ausgewählte Spalten brechen um.
   TODO Components Library: DataGrid bräuchte eine kompakte Variante (Dense) und Umbruch je Spalte (Wrap). */
.vb-tabelle .oo-datagrid__table {
    font-size: var(--oo-font-size-sm);
}

.vb-tabelle .oo-datagrid__td,
.vb-tabelle .oo-datagrid__th-sort {
    padding: var(--oo-space-2) var(--oo-space-3);
}

.vb-tabelle .oo-datagrid__th,
.vb-tabelle .oo-datagrid__th-label {
    white-space: normal;
}

.vb-tabelle .oo-datagrid__td.vb-spalte--umbruch {
    white-space: normal;
    hyphens: auto;
    overflow-wrap: break-word;
    min-width: 5rem;
}

/* Zusatzzeile in einer sonst nicht umbrechenden Zelle darf umbrechen */
.vb-zeilenumbruch {
    white-space: normal;
}

/* Zellinhalt einzeilig mit … kürzen (voller Text im title) */
.vb-gekuerzt {
    display: block;
    max-width: 5.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sortiersymbol braucht keinen eigenen Platz: nur bei aktiver Sortierung sichtbar, sonst beim Hover über der Kopfzelle */
.vb-tabelle .oo-datagrid__th-sort {
    position: relative;
}

.vb-tabelle .oo-datagrid__th-inner .oo-icon.oo-datagrid__sort-icon:not(.oo-datagrid__sort-icon--active) {
    position: absolute;
    right: var(--oo-space-1);
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
}

.vb-tabelle .oo-datagrid__th:hover .oo-icon.oo-datagrid__sort-icon {
    opacity: 0.6;
}

.vb-zeitraum {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--oo-color-text-subtle);
}

.vb-trenner {
    flex: 1;
}

.vb-gruppentitel {
    display: flex;
    align-items: center;
    gap: var(--oo-space-2);
    margin: var(--oo-space-5) 0 var(--oo-space-2);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--oo-color-text-subtle);
}

.vb-speicherstatus {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--oo-space-3);
    min-height: 1.5rem;
}

.vb-kartenraster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
    gap: var(--oo-space-3);
}

.vb-kontaktzeile {
    display: inline-flex;
    align-items: center;
    gap: var(--oo-space-1);
    color: inherit;
    text-decoration: none;
}

a.vb-kontaktzeile:hover {
    color: var(--oo-primary);
}

/* ── Statusfarben (Wechselplan) ───────────────────────────────────────────── */

.vb-statuspunkt {
    display: inline-flex;
    align-items: center;
    gap: var(--oo-space-1);
    white-space: nowrap;
}

.vb-statuspunkt__farbe {
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: var(--oo-radius-sm);
    background: var(--vb-status-farbe);
    border: var(--oo-border-width) solid color-mix(in oklch, var(--vb-status-farbe) 70%, black);
    flex-shrink: 0;
}

/* Schraffur wie in der alten Oberfläche (Vorschlag, mit Vorbehalt) */
.vb-schraffiert {
    background: repeating-linear-gradient(-45deg,
        var(--vb-status-farbe) 0 0.3rem,
        color-mix(in oklch, var(--vb-status-farbe) 35%, white) 0.3rem 0.55rem);
}

.vb-legende {
    margin-bottom: var(--oo-space-3);
    font-size: 0.85rem;
    align-items: center;
}

.vb-legende__eintrag {
    display: inline-flex;
    align-items: center;
    gap: var(--oo-space-1);
}

.vb-balken-muster {
    display: inline-block;
    width: 1.4rem;
    height: 0.9rem;
    border-radius: var(--oo-radius-sm);
    background: var(--oo-gray-300);
}

/* ── Zeitachse ────────────────────────────────────────────────────────────── */

/* Einsatz-Panel: Von und Bis nebeneinander, die Dauer daneben */
.vb-zeitraumzeile {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--oo-space-2) var(--oo-space-4);
}

.vb-zeitraumzeile .oo-date-range-picker {
    flex: 1 1 24rem;
    flex-wrap: nowrap;
}

.vb-zeitraumzeile .oo-date-range-picker > * {
    flex: 1 1 0;
    min-width: 0;
}

.vb-zeitachse__leer {
    padding: var(--oo-space-4);
}

.vb-zeitachse {
    --vb-zeilenhoehe: 2.4rem;
    --vb-kopfhoehe: 3.4rem;
    overflow: auto;
    max-height: calc(100dvh - 17rem);
    min-height: 12rem;
    border: var(--oo-border-width) solid var(--oo-color-border);
    border-radius: var(--oo-radius-lg);
    background: var(--oo-color-surface);
}

.vb-zeitachse__raster {
    display: grid;
    grid-template-columns: var(--vb-kopfbreite) calc(var(--vb-tage) * var(--vb-tag));
    width: max-content;
    min-width: 100%;
}

.vb-zeitachse__ecke {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 4;
    height: var(--vb-kopfhoehe);
    display: flex;
    align-items: flex-end;
    padding: var(--oo-space-2) var(--oo-space-3);
    box-sizing: border-box;
    background: var(--oo-surface-2);
    border-bottom: var(--oo-border-width) solid var(--oo-color-border-strong);
    border-right: var(--oo-border-width) solid var(--oo-color-border-strong);
    font-size: 0.8rem;
    color: var(--oo-color-text-subtle);
}

.vb-zeitachse__kopf {
    position: sticky;
    top: 0;
    z-index: 3;
    height: var(--vb-kopfhoehe);
    background: var(--oo-surface-2);
    border-bottom: var(--oo-border-width) solid var(--oo-color-border-strong);
}

.vb-zeitachse__monate {
    position: relative;
    height: 1.3rem;
}

.vb-zeitachse__monat {
    position: absolute;
    top: 0;
    height: 100%;
    padding-left: var(--oo-space-2);
    box-sizing: border-box;
    border-left: var(--oo-border-width) solid var(--oo-color-border-strong);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}

.vb-zeitachse__tage {
    display: grid;
    grid-template-columns: repeat(var(--vb-tage), var(--vb-tag));
    height: calc(var(--vb-kopfhoehe) - 1.3rem);
}

.vb-zeitachse__tag {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    border-left: var(--oo-border-width) solid transparent;
    user-select: none;
}

.vb-zeitachse__tag:hover {
    background: color-mix(in oklch, var(--oo-primary) 12%, transparent);
}

.vb-zeitachse__wochentag {
    color: var(--oo-color-text-subtle);
}

.vb-zeitachse__tag--wochenende {
    color: var(--oo-color-text-subtle);
}

.vb-zeitachse__tag--bus {
    font-weight: 700;
    color: var(--oo-primary);
}

.vb-zeitachse__tag--heute {
    background: color-mix(in oklch, var(--oo-warning) 25%, transparent);
    font-weight: 700;
}

.vb-zeitachse__tag--monatsanfang {
    border-left-color: var(--oo-color-border-strong);
}

.vb-zeitachse__zeilenkopf {
    position: sticky;
    left: 0;
    z-index: 2;
    height: var(--vb-zeilenhoehe);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 var(--oo-space-3);
    box-sizing: border-box;
    background: var(--oo-color-surface);
    border-right: var(--oo-border-width) solid var(--oo-color-border-strong);
    border-bottom: var(--oo-border-width) solid var(--oo-color-border);
    cursor: pointer;
    overflow: hidden;
}

.vb-zeitachse__zeilenkopf strong,
.vb-zeitachse__zeilenkopf small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.vb-zeitachse__zeilenkopf small {
    color: var(--oo-color-text-subtle);
    font-size: 0.75rem;
}

.vb-zeitachse__zeilenkopf:hover strong {
    color: var(--oo-primary);
}

/* Zeile: Wochenlinien und Wochenende als Hintergrund, Balken darüber */
.vb-zeitachse__zeile {
    position: relative;
    height: var(--vb-zeilenhoehe);
    border-bottom: var(--oo-border-width) solid var(--oo-color-border);
    cursor: copy;
    background-image: repeating-linear-gradient(90deg,
        transparent 0,
        transparent calc(var(--vb-tag) - 1px),
        var(--oo-gray-150) calc(var(--vb-tag) - 1px),
        var(--oo-gray-150) var(--vb-tag));
}

.vb-zeitachse__zeile:hover,
.vb-zeitachse__zeilenkopf:hover + .vb-zeitachse__zeile {
    background-color: color-mix(in oklch, var(--oo-primary) 5%, transparent);
}

.vb-balken {
    position: absolute;
    top: 0.35rem;
    bottom: 0.35rem;
    display: flex;
    align-items: center;
    padding: 0 var(--oo-space-2);
    box-sizing: border-box;
    border-radius: var(--oo-radius-sm);
    background-color: var(--vb-status-farbe);
    color: color-mix(in oklch, var(--vb-status-farbe) 20%, black);
    border: var(--oo-border-width) solid color-mix(in oklch, var(--vb-status-farbe) 70%, black);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    transition: box-shadow var(--oo-transition-fast), transform var(--oo-transition-fast);
}

.vb-balken:hover,
.vb-balken:focus-visible {
    box-shadow: var(--oo-shadow-sm);
    z-index: 1;
    outline: none;
    transform: translateY(-1px);
}

.vb-balken__text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Lesbar auch auf Schraffur */
    text-shadow: 0 0 2px color-mix(in oklch, var(--vb-status-farbe) 30%, white);
}

.vb-balken--leer {
    font-style: italic;
}

/* Doppelt belegte Betreuerin: roter Rahmen, gut sichtbar */
.vb-balken--konflikt {
    outline: 2px solid var(--oo-danger);
    outline-offset: 1px;
}

.vb-balken--anfang-unsicher {
    border-left-style: dashed;
    border-left-width: 3px;
}

.vb-balken--ende-unsicher {
    border-right-style: dashed;
    border-right-width: 3px;
}

/* ── Übersicht (Dashboard) ────────────────────────────────────────────────── */

/* Listen der Übersicht: in den Tabs als Abschnitte mit Überschrift, Datum rechts ohne Umbruch */
.vb-dashtab {
    display: flex;
    flex-direction: column;
    gap: var(--oo-space-5);
    padding-top: var(--oo-space-3);
}

.vb-dashliste__titel {
    display: flex;
    align-items: center;
    gap: var(--oo-space-2);
    margin: 0 0 var(--oo-space-2);
    font-size: var(--oo-font-size-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--oo-color-text-subtle);
}

.vb-dashliste__datum {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Nächste Busse: je Wechseltag zwei Spalten (nach Österreich / nach Rumänien), Namen als Fließtext */
.vb-bustag {
    padding: var(--oo-space-3) 0;
    border-bottom: var(--oo-border-width) solid var(--oo-color-border);
}

.vb-bustag:first-child {
    padding-top: 0;
}

.vb-bustag:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.vb-bustag__datum {
    display: inline-block;
    margin-bottom: var(--oo-space-2);
    font-weight: 600;
}

.vb-bustag__richtungen {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: var(--oo-space-3) var(--oo-space-5);
}

.vb-busrichtung {
    display: flex;
    flex-direction: column;
    gap: var(--oo-space-1);
}

.vb-busrichtung__kopf {
    display: flex;
    align-items: center;
    gap: var(--oo-space-1);
    color: var(--oo-color-text-subtle);
}

.vb-busrichtung__zahl {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.vb-busrichtung__namen {
    line-height: 1.5;
}

/* Noch nicht fix (Vorschlag, mit Vorbehalt): gestrichelt unterstrichen, Details im Tooltip */
.vb-busname--offen {
    text-decoration: underline dashed var(--oo-color-text-subtle);
    text-underline-offset: 3px;
}

/* ── Aufgaben ─────────────────────────────────────────────────────────────── */

.vb-aufgabe {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: var(--oo-space-1);
}

.vb-aufgabe__betreff {
    display: flex;
    align-items: center;
    gap: var(--oo-space-1);
}

.vb-aufgabe__bezug {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--oo-space-2);
    font-size: 0.85rem;
}

.vb-aufgabe--erledigt .vb-aufgabe__betreff {
    text-decoration: line-through;
    color: var(--oo-color-text-subtle);
}

.vb-faellig {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
}

/* ── Verlauf ──────────────────────────────────────────────────────────────── */

.vb-verlauf__datum {
    display: block;
    font-size: 0.8rem;
    color: var(--oo-color-text-subtle);
    font-variant-numeric: tabular-nums;
}

/* ── Schnellsuche ─────────────────────────────────────────────────────────── */

.vb-suchtreffer {
    display: flex;
    flex-direction: column;
}

.vb-suchtreffer span {
    font-size: 0.85rem;
    color: var(--oo-color-text-subtle);
}

.vb-suchtreffer--inaktiv strong {
    color: var(--oo-color-text-subtle);
}
