:root {
    --bg: #0d0d0d; --card: #161616; --text: #e0e0e0; --accent: #cc2318;
    --border: #333; --hover: rgba(204,35,24,0.12); --glow: rgba(204,35,24,0.35);
}
body { background: var(--bg); color: var(--text); font-family: system-ui,sans-serif; padding: 1rem; line-height: 1.5; }
.container { max-width: 1200px; margin: 0 auto; }
h1 {
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #f0f0f0, #e0e0e0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 1.2rem 0 0.6rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    text-align: center;
}

.meta {
    font-size: 0.95rem;
    color: #888;
    margin: 0 0 1.4rem;
    font-family: 'Segoe UI', system-ui, sans-serif;
    letter-spacing: 0.3px;
    text-align: center;
}

.meta::before {
    content: "• ";
    color: var(--accent);
    font-weight: bold;
}

/* Filters – modern toggle style */
#filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.9rem 1.4rem;
    margin: 1.1rem 0 1.8rem;
    padding: 0.6rem 1rem;
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
}

#filters label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.96rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    transition: all 0.18s ease;
    user-select: none;
}

#filters label:hover {
    background: var(--hover);
    color: var(--text);
}

.filter {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #555;
    border-radius: 4px;
    background: var(--input-bg);
    margin: 0;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.filter:checked {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.25);
}

.filter:checked::after {
    content: "✔";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 11px;
    font-weight: bold;
}

/* Make meta & count more prominent */
.meta strong {
    color: var(--text);
    font-weight: 600;
}

/* Optional: subtle separator line under filters */
#filters::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 1px;
    background: linear-gradient(to right, transparent, #444, transparent);
}

#map { height: 500px; margin: 1rem 0; border: 1px solid var(--border); border-radius: 12px; background: #0d0d0d; }
.alert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.2rem; }
.alert-card {
    background: var(--card); border-radius: 14px; padding: 1.3rem; border: 1px solid var(--border); transition: all 0.25s;
}
.alert-card:hover { transform: translateY(-4px); box-shadow: 0 10px 25px rgba(0,0,0,0.5), 0 0 18px var(--glow); border-color: var(--accent); }
.type-badge { display: inline-block; padding: 0.4rem 1rem; border-radius: 999px; font-weight: 700; margin-bottom: 0.8rem; }
.police { background: #1e40af; color: #bfdbfe; }
.hazard { background: #9a3412; color: #fed7aa; }
.accident { background: #9f1239; color: #fda4af; }
.road_closed { background: #6d28d9; color: #e9d5ff; }
.jam { background: #d97706; color: #fbbf24; }
.other { background: #374151; color: #d1d5db; }
.location { font-size: 1.15rem; font-weight: 600; color: #f3f4f6; margin-bottom: 0.0rem; }
.street { color: #9ca3af; margin-bottom: 0.0rem; display: inline;}
.street::before { content: " — "; color: #6b7280; }
.details { display: flex; flex-wrap: wrap; gap: 1.2rem; font-size: 0.92rem; color: #bbb; }
.detail-item span { color: #ddd; font-weight: 600; }
.reliability-high { color: #86efac; } .reliability-med { color: #fde047; } .reliability-low { color: #fca5a5; }
.thumbs { color: #60a5fa; font-weight: bold; }
.time-ago { font-size: 0.85rem; color: #aaa; margin-top: 0.0rem; }
.actions { margin-top: 1rem; display: flex; gap: 0.8rem; }
.actions button { padding: 0.5rem 1rem; background: #333; color: white; border: none; border-radius: 6px; cursor: pointer; }
.actions button:hover { background: var(--bg); }
.empty { text-align: center; padding: 4rem; color: #666; font-size: 1.3rem; }

/* Flash animation for recent police (used on both map markers and cards) */
@keyframes police-flash {
    0%   { filter: drop-shadow(0 0 6px #136dff); }
    25%  { filter: drop-shadow(0 0 12px #ef4444); }
    50%  { filter: drop-shadow(0 0 6px #136dff); }
    75%  { filter: drop-shadow(0 0 12px #ef4444); }
    100% { filter: drop-shadow(0 0 6px #136dff); }
}

.marker-police.recent-active,
.alert-card.recent-active {
    animation: police-flash 2s infinite ease-in-out;
}

.leaflet-div-icon {
    background: transparent !important;
    border: none !important;
    pointer-events: none;
}

.marker-container {
    position: relative;
    width: 36px;
    height: 50px;
    transform: translate(-50%, -100%);
}

.marker-pin {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 36px;
    height: 36px;
    background: inherit;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}
.marker-icon {
    position: absolute;
    top: 3px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 22px;
    color: white;
    pointer-events: none;
}

/* Type colors for markers */
.marker-police    .marker-pin { background: #3b82f6; }
.marker-hazard    .marker-pin { background: #f59e0b; }
.marker-accident  .marker-pin { background: #ef4444; }
.marker-closed    .marker-pin { background: #8b5cf6; }
.marker-jam       .marker-pin { background: #d97706; }
.marker-other     .marker-pin { background: #6b7280; }

.marker-accident::after {
    content: '';
    position: absolute;
    top: -32%;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgb(239, 68, 68) 0%, rgba(239,68,68,0) 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 1s infinite;
    pointer-events: none;
    z-index: -1;
}
@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.8; }
    70% { transform: translate(-50%, -50%) scale(1.4); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1.4); opacity: 0; }
}
/* .marker-priority {
    z-index: 1000 !important;
} */

/* Modern user location marker */
.user-marker-container {
    position: relative;
    width: 36px;                    /* reduced from 44px */
    height: 36px;
    transform: translate(-50%, -50%);
}

.user-marker-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;                    /* reduced from 28px */
    height: 22px;
    background: #3b82f6;
    border: 3px solid white;        /* kept 3px border for contrast */
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.4),   /* slightly softer outer glow */
        0 3px 10px rgba(0, 0, 0, 0.5);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.user-marker-icon {
    color: white;
    font-size: 9px;                 /* smaller text so "You" still fits nicely */
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    line-height: 1;
}

.user-marker-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;                    /* reduced from 38px */
    height: 30px;
    border: 2px solid #60a5fa;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.75;
    z-index: 1;
}

.user-marker-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;                    /* matches container */
    height: 36px;
    background: rgba(59, 130, 246, 0.35);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.7);  /* adjusted starting scale */
    animation: userPulse 2.2s infinite ease-out;
    z-index: 0;
    pointer-events: none;
}

@keyframes userPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.55);
        opacity: 1;
    }
    /* 50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.35;
    } */
    100% {
        transform: translate(-50%, -50%) scale(1.7);
        opacity: 0;
    }
}

/* Subtle heading arrow - scaled down */
.user-marker-core::after {
    content: '';
    position: absolute;
    bottom: -8px;                   /* moved closer */
    left: 50%;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #3b82f6;
    transform: translateX(-50%);
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));
}


/* Floating location button - modern map style */
.locate-btn.floating {
    position: absolute;
    bottom: 24px;
    right: 16px;
    z-index: 1000;                   /* above map layers */
    
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1e293b;             /* dark slate - matches your theme */
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    
    box-shadow: 
        0 4px 12px rgba(0,0,0,0.5),
        0 2px 6px rgba(0,0,0,0.3);
    
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.locate-btn.floating:hover {
    background: #334155;
    transform: scale(1.08);
    box-shadow: 
        0 6px 20px rgba(0,0,0,0.6),
        0 0 0 3px rgba(59,130,246,0.3);
}

.locate-btn.floating:active {
    transform: scale(0.96);
}

/* Active/tracking state */
.locate-btn.floating.tracking {
    background: #3b82f6;
    box-shadow: 
        0 4px 16px rgba(59,130,246,0.5),
        0 0 0 4px rgba(59,130,246,0.25);
}

.locate-btn.floating.tracking:hover {
    background: #2563eb;
}

/* Icons inside button */
.locate-btn .icon-default,
.locate-btn .icon-tracking,
.locate-btn .icon-stop {
    transition: opacity 0.3s ease;
}

.locate-btn .hidden {
    display: none;
}

/* Tooltip on hover */
.locate-btn.floating::after {
    content: attr(title);
    position: absolute;
    right: 58px;
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #e0e0e0;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(-50%) translateX(8px);
}

.locate-btn.floating:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}