* { margin: 0; padding: 0; box-sizing: border-box; }

.incident-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.incident-icon {
    font-size: 1.1rem;
    line-height: 1.4;
    flex-shrink: 0;
}

.incident-text {
    display: flex;
    flex-direction: column;
}

.incident-street {
    font-size: 0.85rem;
    color: #666;
}

:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #0f172a;
    --accent: #0891b2;
    --accent-light: #06b6d4;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);

    --green: #22c55e;
    --yellow: #eab308;
    --orange: #f97316;
    --red: #ef4444;
    --gray: #94a3b8;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Header ---------- */
.site-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #0e4a5c 100%);
    color: white;
    padding: 1.4rem 0;
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.brand-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.site-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.site-header p {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.65);
    margin-top: 0.1rem;
    font-weight: 400;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.status-pill {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.08);
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

#refresh-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--accent-light);
    color: #04202a;
    border: none;
    padding: 0.55rem 1.2rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    min-height: 44px;
    flex-shrink: 0;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.1s ease;
}
#refresh-btn:hover { background: #22d3ee; }
#refresh-btn:active { transform: scale(0.97); }

.refresh-icon {
    display: inline-block;
    font-size: 1rem;
}
#refresh-btn.spinning .refresh-icon {
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Mobile Tabs ---------- */
.mobile-tabs {
    display: flex;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.9rem;
    border: none;
    background: var(--surface);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    min-height: 48px;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}

/* ---------- Layout ---------- */
main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.25rem 2rem;
}

.panel { display: none; }
.panel.active { display: block; }

.map-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 0.5rem;
    overflow: hidden;
}

#map {
    height: calc(100vh - 230px);
    min-height: 360px;
    border-radius: calc(var(--radius-lg) - 4px);
    width: 100%;
}

.legend, #incident-list {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-top: 1rem;
    border: 1px solid var(--border);
}

.legend h3, #incident-list h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.8rem;
    letter-spacing: -0.01em;
}

.legend ul { list-style: none; display: flex; flex-direction: column; gap: 0.55rem; }

.legend li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}
.dot.green  { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.orange { background: var(--orange); }
.dot.red    { background: var(--red); }
.dot.gray   { background: var(--gray); }

/* ---------- Incident list ---------- */
#incidents-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.incident-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    border: 1px solid var(--border);
}

.loading, #incidents-content p {
    font-size: 0.88rem;
    color: var(--text-muted);
    padding: 0.5rem 0;
}

.error { color: var(--red) !important; }

/* ---------- Footer ---------- */
footer {
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ---------- Leaflet polish ---------- */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 0.2rem;
}

.leaflet-popup-content {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.5;
    margin: 0.7rem 0.9rem;
}

.leaflet-popup-content strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    color: var(--primary);
}

.leaflet-popup-tip {
    box-shadow: var(--shadow-sm);
}

.leaflet-control-zoom a {
    border-radius: var(--radius-sm) !important;
    color: var(--text) !important;
}

.leaflet-bar {
    border: none !important;
    box-shadow: var(--shadow) !important;
}

/* ---------- Scrollbar (optional, für Meldungsliste) ---------- */
#incident-list {
    max-height: 60vh;
    overflow-y: auto;
}

#incident-list::-webkit-scrollbar {
    width: 6px;
}

#incident-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}

/* ---------- Responsive Anpassungen ---------- */
@media (min-width: 769px) {
    .mobile-tabs { display: none; }

    .panel { display: block !important; }

    main {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 1.25rem;
        align-items: start;
    }

    #map-view { grid-column: 1; }
    #incidents-view {
        grid-column: 2;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    #map {
        height: calc(100vh - 160px);
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    .header-inner { flex-direction: column; align-items: flex-start; }

    .status-bar {
        width: 100%;
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .status-pill {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 0.75rem;
        padding: 0.5rem 0.7rem;
    }

    #refresh-btn {
        padding: 0.55rem 0.9rem;
        font-size: 0.8rem;
    }

    #map { height: calc(100vh - 280px); }
}

@media (max-width: 380px) {
    .status-pill { font-size: 0.68rem; }
    #refresh-btn span:not(.refresh-icon) { display: none; }
}

.incident-marker { background: transparent !important; border: none !important; }
.marker-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    border: 2px solid white;
}

.marker-icon-small {
    font-size: 0.7rem;
}

.marker-icon.marker-red    { border-color: #d32f2f; }
.marker-icon.marker-orange { border-color: #f57c00; }
.marker-icon.marker-yellow { border-color: #fbc02d; }
.marker-icon.marker-gray   { border-color: #9e9e9e; }