/*
 * Ortung — Leitstand für die Live-Position.
 *
 * Gestaltung: Die Karte gehört dem Fahrzeug. Spur und Marker tragen
 * Verkehrszeichen-Blau, alles andere bleibt ruhig. Signalgelb erscheint nur,
 * wenn die Meldungen veraltet sind. Das eine auffällige Element ist der
 * Fahrzeugname als Kennzeichen-Schild.
 */

@font-face {
    font-family: 'Barlow Semi Condensed';
    src: url('../fonts/barlow-semi-condensed-500.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Barlow Semi Condensed';
    src: url('../fonts/barlow-semi-condensed-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --blau: #1f5fbf;          /* Verkehrszeichen-Blau (RAL 5017) */
    --blau-tief: #174a96;
    --gelb: #f2b600;          /* Signalgelb (RAL 1003) */
    --tinte: #1d2733;
    --tinte-leise: #4d5b6b;
    --grund: #e6eaee;
    --papier: #ffffff;
    --linie: #cfd6dd;
    --fehler: #b3261e;

    --schrift: 'Barlow Semi Condensed', 'Arial Narrow', system-ui, sans-serif;
    --leiste-breite: 20rem;
    --fokus: 0 0 0 3px var(--papier), 0 0 0 5px var(--blau);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
}

body {
    font-family: var(--schrift);
    font-weight: 500;
    font-size: 1.0625rem;
    line-height: 1.4;
    color: var(--tinte);
    background: var(--grund);
}

a {
    color: var(--blau);
}

/* Fokusrahmen NUR bei Tastaturbedienung (html.maus setzt eingabeart.js
   bei Klick/Tippen). :focus-visible allein zeigte ihn bei Textfeldern auch
   nach einem Mausklick. */
:focus {
    outline: none;
}

html:not(.maus) :focus-visible,
html:not(.maus) input:focus {
    box-shadow: var(--fokus);
}

/* ------------------------------------------------------------------ *
 * Kennzeichen-Schild
 * ------------------------------------------------------------------ */

.kennzeichen {
    display: inline-flex;
    align-items: stretch;
    max-width: 100%;
    border: 2px solid var(--tinte);
    border-radius: 5px;
    background: var(--papier);
    overflow: hidden;
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1;
    letter-spacing: 0.04em;
}

/* Der blaue EU-Streifen am linken Rand */
.kennzeichen::before {
    content: 'D';
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 1.5rem;
    padding-bottom: 0.25rem;
    background: var(--blau);
    color: var(--papier);
    font-size: 0.7rem;
    letter-spacing: 0;
}

.kennzeichen-text {
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ------------------------------------------------------------------ *
 * Knöpfe
 * ------------------------------------------------------------------ */

.knopf {
    font: inherit;
    font-weight: 700;
    min-height: 2.75rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 2px solid var(--blau);
    cursor: pointer;
}

.knopf-haupt {
    background: var(--blau);
    color: var(--papier);
}

.knopf-haupt:hover {
    background: var(--blau-tief);
    border-color: var(--blau-tief);
}

.knopf-haupt[aria-pressed='false'] {
    background: var(--papier);
    color: var(--blau);
}

.knopf-haupt[aria-pressed='false']:hover {
    background: #e8eff9;
    color: var(--blau-tief);
}

.knopf-leise {
    background: transparent;
    border-color: transparent;
    color: var(--tinte-leise);
    font-weight: 500;
    padding-inline: 0;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.knopf-leise:hover {
    color: var(--tinte);
}

/* ------------------------------------------------------------------ *
 * Leitstand: Karte + Leiste
 * ------------------------------------------------------------------ */

.leitstand {
    position: relative;
    display: grid;
    grid-template-columns: 1fr var(--leiste-breite);
    height: 100vh;
    height: 100dvh;
}

.karte {
    min-height: 0;
    background: var(--grund);
}

/* Kacheln leicht entsättigt: die blaue Spur soll die lauteste Farbe sein */
.karte .leaflet-tile-pane {
    filter: saturate(0.45) contrast(0.96) brightness(1.03);
}

.leiste {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.25rem 1.25rem 1rem;
    background: var(--papier);
    border-left: 1px solid var(--linie);
    overflow-y: auto;
}

.meldung {
    margin: 0.5rem 0 0;
    color: var(--tinte-leise);
}

.meldung.ist-veraltet {
    color: var(--tinte);
    font-weight: 700;
}

.tempo {
    margin: 0;
    line-height: 1;
}

.tempo-zahl {
    font-weight: 700;
    font-size: 4.5rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.tempo-einheit {
    font-size: 1.25rem;
    color: var(--tinte-leise);
}

.werte {
    margin: 0;
    display: grid;
    gap: 0;
}

.werte > div {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--linie);
}

.werte > div:last-child {
    border-bottom: 1px solid var(--linie);
}

.werte dt {
    color: var(--tinte-leise);
}

.werte dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.leiste-fuss {
    margin-top: auto;
    display: grid;
    gap: 0.75rem;
}

.spur-hinweis {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--tinte-leise);
}

.abmelden {
    margin: 0;
}

/* Hinweise über der Karte */
.hinweis {
    position: absolute;
    z-index: 1000;
    top: 1rem;
    left: 50%;
    transform: translateX(calc(-50% - var(--leiste-breite) / 2));
    max-width: min(32rem, calc(100% - var(--leiste-breite) - 2rem));
    margin: 0;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(29, 39, 51, 0.25);
}

.hinweis[hidden] {
    display: none;
}

.hinweis-funkstille {
    background: var(--gelb);
    color: var(--tinte);
}

.hinweis-fehler {
    top: 4rem;
    background: var(--fehler);
    color: var(--papier);
}

/* ------------------------------------------------------------------ *
 * Fahrzeug-Marker
 * ------------------------------------------------------------------ */

.fahrzeug-marker {
    background: none;
    border: 0;
}

.fahrzeug {
    position: relative;
    width: 40px;
    height: 40px;
}

/* Ruhiges Pulsieren nur, solange die Meldungen frisch sind */
.fahrzeug::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--blau);
    opacity: 0.25;
    animation: puls 2s ease-out infinite;
}

.fahrzeug-pfeil {
    position: absolute;
    inset: 0;
    display: block;
    transition: transform 0.6s ease;
}

.fahrzeug-pfeil path {
    fill: var(--blau);
    stroke: var(--papier);
    stroke-width: 2.5;
    stroke-linejoin: round;
}

.fahrzeug.ist-veraltet::before {
    animation: none;
    background: var(--gelb);
    opacity: 0.45;
}

.fahrzeug.ist-veraltet .fahrzeug-pfeil path {
    fill: var(--tinte-leise);
}

@keyframes puls {
    from { transform: scale(0.6); opacity: 0.45; }
    to { transform: scale(1.6); opacity: 0; }
}

/* Leaflet-Bedienelemente an die Schrift angleichen */
.leaflet-container {
    font-family: var(--schrift);
}

.leaflet-control-attribution {
    font-size: 0.8125rem;
}

/* ------------------------------------------------------------------ *
 * Anmeldung und Liste
 * ------------------------------------------------------------------ */

.anmeldung,
.liste {
    max-width: 26rem;
    margin: 0 auto;
    padding: 12vh 1rem 2rem;
}

.anmeldung-titel,
.liste-titel {
    margin: 0 0 0.25rem;
    font-weight: 700;
    font-size: 2.75rem;
    line-height: 1.1;
}

.anmeldung-titel::before {
    /* Der Pfeil des Fahrzeug-Markers als Zeichen der Anwendung */
    content: '';
    display: inline-block;
    width: 0.7em;
    height: 0.7em;
    margin-right: 0.25em;
    background: var(--blau);
    clip-path: polygon(50% 0, 100% 100%, 50% 75%, 0 100%);
}

.anmeldung-text {
    margin: 0 0 1.5rem;
    color: var(--tinte-leise);
}

.anmeldung-formular {
    display: grid;
    gap: 0.5rem;
    padding: 1.25rem;
    background: var(--papier);
    border: 1px solid var(--linie);
    border-radius: 8px;
}

.anmeldung-formular label {
    font-weight: 700;
}

.anmeldung-formular input {
    font: inherit;
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid #6b7785;
    border-radius: 6px;
    color: var(--tinte);
    background: var(--papier);
}


.anmeldung-formular .knopf {
    margin-top: 0.5rem;
}

.anmelde-fehler {
    margin: 0 0 1rem;
    padding: 0.5rem 0.75rem;
    border-left: 4px solid var(--fehler);
    background: #fbeceb;
    color: var(--fehler);
    font-weight: 700;
}

.liste-eintraege {
    list-style: none;
    margin: 1.5rem 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.tracker-eintrag a {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--linie);
    border-radius: 8px;
    background: var(--papier);
    color: var(--tinte);
    text-decoration: none;
}

.tracker-eintrag a:hover {
    border-color: var(--blau);
}

.tracker-zeit {
    color: var(--tinte-leise);
}

.liste-leer code {
    font-size: 0.95em;
}

/* ------------------------------------------------------------------ *
 * Schmale Bildschirme: Leiste wird zum Blatt unter der Karte
 * ------------------------------------------------------------------ */

@media (max-width: 760px) {
    .leitstand {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(55vh, 1fr) auto;
        height: auto;
        min-height: 100dvh;
    }

    .leiste {
        border-left: 0;
        border-top: 1px solid var(--linie);
        gap: 1rem;
    }

    .tempo-zahl {
        font-size: 3.5rem;
    }

    .hinweis {
        transform: translateX(-50%);
        max-width: calc(100% - 2rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .fahrzeug::before {
        animation: none;
    }

    .fahrzeug-pfeil {
        transition: none;
    }
}
