/* ── Map Container ────────────────────────────────────────────────────────── */

#map {
    width: 100%;
    height: 100%;
    position: relative;
    background-color: #1a1a1a;
}

/* ── MapLibre Dark-mode overrides ────────────────────────────────────────── */

/* Route line colors are pre-compensated in js/map.js (routeTransitLineCanvasColor) to undo this filter. */
[data-bs-theme="dark"] .maplibregl-canvas-container .maplibregl-canvas {
    filter: invert(1) hue-rotate(180deg) contrast(90%) brightness(90%);
}

[data-bs-theme="dark"] .maplibregl-ctrl-group,
[data-bs-theme="dark"] .maplibregl-ctrl {
    filter: invert(1) hue-rotate(180deg);
}

[data-bs-theme="dark"] .maplibregl-popup {
    filter: none !important;
}

/* ── MapLibre Popup ───────────────────────────────────────────────────────── */

.maplibregl-popup {
    z-index: 10000 !important;
}

.maplibregl-popup-content {
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 12px;
}

.maplibregl-popup-tip {
    border-top-color: rgba(255, 255, 255, 0.92) !important;
    border-bottom-color: rgba(255, 255, 255, 0.92) !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

[data-bs-theme="dark"] .maplibregl-popup-tip {
    border-top-color: rgba(20, 20, 20, 0.88) !important;
    border-bottom-color: rgba(20, 20, 20, 0.88) !important;
    filter: none;
}

.maplibregl-popup-close-button {
    font-size: 18px;
    padding: 4px;
    color: #cbd5e1;
    right: 2px;
    top: 2px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
}

.maplibregl-popup-close-button:hover {
    background: #ef4444;
    color: #f1f5f9;
}

/* ── Vehicle Marker Mini Mode ────────────────────────────────────────────── */

.vehicle-marker--mini {
    width: 14px !important;
    height: 14px !important;
    min-width: unset !important;
    border-radius: 50% !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow: hidden;
    transition: width 0.15s ease, height 0.15s ease, border-radius 0.15s ease, padding 0.15s ease !important;
}

.vehicle-marker--mini > * {
    display: none !important;
}

.vehicle-marker:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.9);
    outline-offset: 2px;
}

@media (pointer: coarse) {
    .vehicle-marker--mini {
        width: 20px !important;
        height: 20px !important;
    }
}

/* ── Platform Markers ────────────────────────────────────────────────────── */

.platform-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    background-color: #ffffff;
    border: 2px solid #3b82f6;
}

.platform-marker:hover {
    transform: scale(1.3);
}

[data-bs-theme="dark"] .platform-marker {
    background-color: #0c0c0c;
    border-color: #4899da;
}

/* ── Vehicle Popup ───────────────────────────────────────────────────────── */

.vehicle-popup-content {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vehicle-popup-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.vehicle-popup-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.vehicle-popup-meta {
    font-size: 11px;
    color: #64748b;
}

[data-bs-theme="dark"] .vehicle-popup-content {
    background: rgba(20, 20, 20, 0.88);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

[data-bs-theme="dark"] .vehicle-popup-title {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .vehicle-popup-meta {
    color: #94a3b8;
}

/* ── Platform Popup ──────────────────────────────────────────────────────── */

.platform-popup-content {
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    font-size: 12px;
    color: #1e293b;
    white-space: nowrap;
    font-weight: 500;
}

[data-bs-theme="dark"] .platform-popup-content {
    background: rgba(15, 15, 15, 0.75);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.platform-popup-content.focused {
    font-size: 15px;
    font-weight: 600;
    padding: 10px 14px;
}
