
/* Leaflet-Grundlayout als lokale Absicherung.
   Dadurch bleiben Kartenkacheln und Zoom-Steuerung korrekt positioniert,
   auch wenn die externe Leaflet-CSS-Datei nicht geladen werden kann. */
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
    position: absolute;
    left: 0;
    top: 0;
}
.leaflet-container {
    position: relative;
    overflow: hidden;
    outline-offset: 1px;
    -webkit-tap-highlight-color: transparent;
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
    user-select: none;
    -webkit-user-drag: none;
}
.leaflet-marker-icon,
.leaflet-marker-shadow { display: block; }
.leaflet-container .leaflet-overlay-pane svg,
.leaflet-container .leaflet-marker-pane img,
.leaflet-container .leaflet-shadow-pane img,
.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-image-layer,
.leaflet-container .leaflet-tile {
    max-width: none !important;
    max-height: none !important;
}
.leaflet-container.leaflet-touch-zoom { touch-action: pan-x pan-y; }
.leaflet-container.leaflet-touch-drag { touch-action: none; touch-action: pinch-zoom; }
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom { touch-action: none; }
.leaflet-tile { visibility: hidden; }
.leaflet-tile-loaded { visibility: inherit; }
.leaflet-zoom-box {
    width: 0;
    height: 0;
    box-sizing: border-box;
    z-index: 800;
}
.leaflet-pane { z-index: 400; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }
.leaflet-map-pane canvas { z-index: 100; }
.leaflet-map-pane svg { z-index: 200; }
.leaflet-control {
    position: relative;
    z-index: 800;
    pointer-events: auto;
}
.leaflet-top,
.leaflet-bottom {
    position: absolute;
    z-index: 1000;
    pointer-events: none;
}
.leaflet-top { top: 0; }
.leaflet-right { right: 0; }
.leaflet-bottom { bottom: 0; }
.leaflet-left { left: 0; }
.leaflet-control { float: left; clear: both; }
.leaflet-right .leaflet-control { float: right; }
.leaflet-top .leaflet-control { margin-top: 10px; }
.leaflet-bottom .leaflet-control { margin-bottom: 10px; }
.leaflet-left .leaflet-control { margin-left: 10px; }
.leaflet-right .leaflet-control { margin-right: 10px; }
.leaflet-zoom-animated { transform-origin: 0 0; }
.leaflet-zoom-anim .leaflet-zoom-animated {
    transition: transform .25s cubic-bezier(0, 0, .25, 1);
}
.leaflet-zoom-anim .leaflet-tile,
.leaflet-pan-anim .leaflet-tile { transition: none; }
.leaflet-zoom-anim .leaflet-zoom-hide { visibility: hidden; }
.leaflet-interactive { cursor: pointer; }
.leaflet-grab { cursor: grab; }
.leaflet-dragging .leaflet-grab,
.leaflet-dragging .leaflet-grab .leaflet-interactive { cursor: grabbing; }
.leaflet-bar {
    box-shadow: 0 1px 5px rgba(0,0,0,.45);
    border-radius: 6px;
}
.leaflet-bar a {
    display: block;
    width: 30px;
    height: 30px;
    border-bottom: 1px solid #c7cdd3;
    background: #fff;
    color: #111;
    font: 700 20px/30px Arial, Helvetica, sans-serif;
    text-align: center;
    text-decoration: none;
}
.leaflet-bar a:first-child { border-radius: 6px 6px 0 0; }
.leaflet-bar a:last-child { border-bottom: 0; border-radius: 0 0 6px 6px; }
.leaflet-bar a:hover,
.leaflet-bar a:focus { background: #f0f2f4; }
.leaflet-bar a.leaflet-disabled { cursor: default; color: #aaa; background: #f4f4f4; }
.leaflet-control-attribution {
    margin: 0;
    padding: 0 5px;
    background: rgba(255,255,255,.82);
    color: #333;
    font-size: 11px;
    line-height: 1.4;
}
.leaflet-control-attribution a { color: #1769aa; text-decoration: none; }
.leaflet-popup {
    position: absolute;
    margin-bottom: 20px;
    text-align: center;
}
.leaflet-popup-content-wrapper {
    padding: 1px;
    text-align: left;
    border-radius: 12px;
}
.leaflet-popup-content { line-height: 1.3; }
.leaflet-popup-tip-container {
    position: absolute;
    left: 50%;
    width: 40px;
    height: 20px;
    margin-left: -20px;
    overflow: hidden;
    pointer-events: none;
}
.leaflet-popup-tip {
    width: 17px;
    height: 17px;
    margin: -10px auto 0;
    transform: rotate(45deg);
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip { box-shadow: 0 3px 14px rgba(0,0,0,.4); }
.leaflet-container a.leaflet-popup-close-button {
    position: absolute;
    top: 0;
    right: 0;
    width: 24px;
    height: 24px;
    border: 0;
    background: transparent;
    color: #a9b5c1;
    font: 20px/24px Tahoma, Verdana, sans-serif;
    text-align: center;
    text-decoration: none;
    z-index: 1;
}

:root {
    --bg: #0b1118;
    --panel: #121b25;
    --panel-2: #172330;
    --text: #f6f8fb;
    --muted: #9eacba;
    --border: #273646;
    --roadwork: #ffb020;
    --jam: #ef476f;
    --stationary: #4cc9f0;
    --hazard: #f94144;
    --ok: #46d37a;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { color: inherit; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.4rem;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 17, 24, .96);
}
.eyebrow {
    margin: 0 0 .2rem;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}
h1, h2 { margin: 0; line-height: 1.1; }
h1 { font-size: clamp(1.35rem, 2.2vw, 2rem); }
h2 { font-size: 1.2rem; }
.status {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: var(--muted);
    font-size: .9rem;
}
.status-dot {
    width: .7rem;
    height: .7rem;
    border-radius: 50%;
    background: #77808a;
    box-shadow: 0 0 0 .2rem rgba(119,128,138,.15);
}
.status.ok .status-dot { background: var(--ok); box-shadow: 0 0 0 .2rem rgba(70,211,122,.15); }
.status.warning .status-dot { background: var(--roadwork); box-shadow: 0 0 0 .2rem rgba(255,176,32,.15); }
.status.error .status-dot { background: var(--hazard); box-shadow: 0 0 0 .2rem rgba(249,65,68,.15); }

.ticker {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0,1fr) auto;
    align-items: center;
    min-height: 3.25rem;
    overflow: hidden;
    border-bottom: 1px solid #573321;
    background: #2a1d13;
}
.ticker[hidden] { display: none; }
.ticker-badge {
    z-index: 2;
    align-self: stretch;
    display: grid;
    place-items: center;
    padding: 0 1rem;
    background: var(--roadwork);
    color: #171006;
    font-weight: 900;
    letter-spacing: .08em;
}
.ticker-window { overflow: hidden; white-space: nowrap; }
.ticker-text {
    display: inline-block;
    min-width: 100%;
    padding-left: 100%;
    font-weight: 750;
    animation: ticker-scroll 16s linear 1;
}
.ticker-close {
    border: 0;
    background: transparent;
    padding: .5rem 1rem;
    color: #f7d9c4;
    font-size: 1.5rem;
    cursor: pointer;
}
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .ticker-text { animation: none; padding-left: 1rem; } }

main { padding: 1rem; }
.summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: .85rem;
}
.summary-card {
    min-height: 5rem;
    padding: .8rem 1rem;
    border: 1px solid var(--border);
    border-radius: .8rem;
    background: var(--panel);
    text-align: left;
    cursor: pointer;
}
.summary-card:hover, .summary-card:focus-visible { border-color: #526579; outline: none; }
.summary-card.is-active { background: var(--panel-2); box-shadow: inset 0 0 0 1px #60778f; }
.summary-card strong { display: block; margin-top: .25rem; font-size: 1.8rem; }
.summary-label { color: var(--muted); font-size: .86rem; }
.summary-card.roadwork strong { color: var(--roadwork); }
.summary-card.traffic-jam strong { color: var(--jam); }
.summary-card.stationary strong { color: var(--stationary); }
.summary-card.hazard strong { color: var(--hazard); }

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(340px, .7fr);
    gap: .85rem;
    min-height: calc(100vh - 14rem);
}
.map-panel, .feed-panel {
    position: relative;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: .9rem;
    overflow: hidden;
    background: var(--panel);
}
.map { height: 100%; min-height: 620px; }
.map-legend {
    position: absolute;
    z-index: 500;
    left: .8rem;
    bottom: .8rem;
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    padding: .55rem .7rem;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: .65rem;
    background: rgba(12,18,25,.9);
    color: #dce4eb;
    font-size: .78rem;
    backdrop-filter: blur(6px);
}
.map-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.dot { width: .65rem; height: .65rem; border-radius: 50%; display: inline-block; }
.dot.roadwork { background: var(--roadwork); }
.dot.traffic-jam { background: var(--jam); }
.dot.stationary { background: var(--stationary); }
.dot.hazard { background: var(--hazard); }

.feed-panel { display: flex; flex-direction: column; max-height: calc(100vh - 14rem); }
.feed-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}
.search-label input {
    width: min(15rem, 34vw);
    border: 1px solid var(--border);
    border-radius: .6rem;
    background: #0b131c;
    color: var(--text);
    padding: .6rem .7rem;
}
.search-label input:focus { outline: 2px solid #6e8aa6; outline-offset: 1px; }
.event-list { overflow: auto; }
.event-card {
    display: grid;
    grid-template-columns: .3rem 1fr;
    border-bottom: 1px solid var(--border);
    background: transparent;
}
.event-card button {
    grid-column: 2;
    width: 100%;
    border: 0;
    background: transparent;
    padding: .9rem 1rem;
    text-align: left;
    cursor: pointer;
}
.event-card button:hover, .event-card button:focus-visible { background: #172330; outline: none; }
.event-accent { grid-row: 1; grid-column: 1; background: #8a98a8; }
.event-card[data-type="roadwork"] .event-accent { background: var(--roadwork); }
.event-card[data-type="traffic_jam"] .event-accent { background: var(--jam); }
.event-card[data-type="stationary_vehicle"] .event-accent { background: var(--stationary); }
.event-card[data-type="hazard"] .event-accent { background: var(--hazard); }
.event-topline { display: flex; gap: .55rem; align-items: center; margin-bottom: .3rem; }
.event-type {
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.event-road { font-weight: 850; }
.event-card h3 { margin: 0 0 .35rem; font-size: .95rem; line-height: 1.3; }
.event-card p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.42; }
.event-meta { display: flex; gap: .7rem; margin-top: .45rem; color: #78899a; font-size: .72rem; }
.empty-state { padding: 2rem 1rem; color: var(--muted); text-align: center; }

footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .6rem 1.2rem;
    padding: .8rem 1.2rem 1.1rem;
    color: #7f90a1;
    font-size: .72rem;
}

.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #121b25; color: var(--text); }
.leaflet-popup-content { margin: .8rem 1rem; min-width: 220px; }
.popup-title { font-weight: 800; margin-bottom: .35rem; }
.popup-meta { color: #a7b4c1; font-size: .8rem; margin-bottom: .4rem; }
.popup-description { white-space: pre-line; font-size: .82rem; line-height: 1.4; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1100px) {
    .summary { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .workspace { grid-template-columns: 1fr; }
    .map { min-height: 56vh; }
    .feed-panel { max-height: none; }
}
@media (max-width: 680px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .summary { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .feed-head { align-items: stretch; flex-direction: column; }
    .search-label input { width: 100%; }
    .map { min-height: 58vh; }
    main { padding: .65rem; }
    .ticker-badge { padding: 0 .65rem; }
}
