/* ═══════════════════════════════════════════════════
   Map — GIS Animations, Buses, Frequency, Heatmap
   ═══════════════════════════════════════════════════ */

/* ── Map Box ── */
.mapbox {
    background: linear-gradient(135deg, #e8f0f7 0%, #dde8f0 100%);
    border-radius: var(--r2);
    position: relative; overflow: hidden;
}
.map-grid {
    position: absolute; inset: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(15, 40, 80, .05) 0, rgba(15, 40, 80, .05) 1px, transparent 1px, transparent 30px),
        repeating-linear-gradient(90deg, rgba(15, 40, 80, .05) 0, rgba(15, 40, 80, .05) 1px, transparent 1px, transparent 30px);
}
.map-route {
    position: absolute;
    height: 3px; border-radius: 1.5px;
}
.map-route.dashed {
    border-top: 3px dashed var(--red);
    background: transparent;
}
.map-stop {
    position: absolute;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.map-stop.terminal {
    border-radius: 4px;
    border-width: 3px;
    z-index: 2;
}

/* ── Bus Animations ── */
.map-bus {
    position: absolute;
    border-radius: 4px;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
    font-size: 10px;
    display: flex; align-items: center; justify-content: center;
    z-index: 3;
    transition: transform 0.2s ease;
    cursor: pointer;
}
.map-bus:hover {
    transform: scale(1.2);
    z-index: 10;
}
.map-bus.live    { animation: pulse-green 3s infinite; }
.map-bus.delayed { animation: pulse-amber 3s infinite; }
.map-bus.deviated {
    animation: pulse-red 1.5s infinite;
    z-index: 5;
    border-color: var(--red);
}

@keyframes pulse-green {
    0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4); }
    70%  { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
@keyframes pulse-amber {
    0%   { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.4); }
    70%  { box-shadow: 0 0 0 8px rgba(217, 119, 6, 0); }
    100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
}
@keyframes pulse-red {
    0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
    70%  { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.map-lbl {
    position: absolute;
    font-size: 10px; font-weight: 800;
    color: var(--navy);
    background: rgba(255, 255, 255, .95);
    padding: 3px 6px; border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
    z-index: 4; pointer-events: none;
    font-family: var(--font);
}

/* ── Frequency Chart (Time Sheet) ── */
.freq-chart {
    position: relative; height: 160px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 10px;
    background: var(--bg);
    overflow: hidden;
}
.fc-axis {
    position: absolute; top: 10px;
    left: 60px; right: 20px;
    border-bottom: 1px solid var(--border2);
    height: 20px;
    display: flex; justify-content: space-between;
    font-size: 10px; color: var(--text-3); font-weight: 700;
    font-family: var(--mono);
}
.fc-row {
    position: absolute;
    left: 10px; right: 20px;
    height: 24px;
    display: flex; align-items: center;
}
.fc-label {
    width: 45px;
    font-size: 11px; font-weight: 700;
    font-family: var(--mono);
    color: var(--text-2);
}
.fc-track {
    flex: 1; position: relative;
    height: 100%;
    border-bottom: 1px dashed var(--border);
}
.fc-bar {
    position: absolute; top: 4px;
    height: 16px; border-radius: 4px;
    background: var(--blue); opacity: 0.8;
    transition: opacity .2s;
}
.fc-bar:hover { opacity: 1; }
.fc-bar.clash {
    background: var(--red); opacity: 1;
    border: 2px solid var(--red-bdr);
    z-index: 10;
    animation: pulse-red 2s infinite;
}

/* ── Heatmap ── */
.heatmap { display: flex; flex-direction: column; gap: 4px; }
.hm-row  { display: flex; align-items: center; gap: 8px; }
.hm-lbl  {
    width: 40px;
    font-size: 11px; font-family: var(--mono);
    font-weight: 700; color: var(--text-3);
}
.hm-cells { display: flex; gap: 2px; flex: 1; }
.hm-cell  { height: 16px; flex: 1; border-radius: 2px; transition: transform .15s; }
.hm-cell:hover { transform: scaleY(1.3); }
.hm-0 { background: var(--bg2); }
.hm-1 { background: #bae6fd; }
.hm-2 { background: #3b82f6; }
.hm-3 { background: #1e3a8a; }

/* ── Google Maps Containers ── */
#gmap-dash  { width: 100%; height: 100%; border-radius: var(--r2); display: none; }
#gmap-live  { width: 100%; height: 100%; min-height: 600px; border-radius: var(--r2); display: none; }
#gmap-stops { width: 100%; height: 100%; min-height: 450px; border-radius: var(--r2); display: none; }
