/* Wave 10: Street Map Canvas — Map Styles
   Styles for MapCanvas, HeatmapOverlay, TrajectoryLayer, GeofenceDrawTool.
   Bootstrap 5.3 compatible. Font Awesome 6.7.2 icons. */

/* ── MapCanvas ── */
.map-canvas {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

/* Layer Toggle */
.map-layer-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255,255,255,0.95);
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.layer-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: none;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    white-space: nowrap;
}

.layer-btn:hover { background: #e9ecef; }
.layer-btn.active { background: #e3f2fd; font-weight: 600; }

.layer-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Entity Popup */
.map-popup {
    position: absolute;
    z-index: 20;
    width: 280px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: popup-in 0.2s ease-out;
}

@keyframes popup-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.popup-header {
    padding: 10px 14px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.popup-close {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
}

.popup-close:hover { opacity: 1; }

.popup-body {
    padding: 10px 14px;
    max-height: 200px;
    overflow-y: auto;
}

.popup-field {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.field-label { color: #6c757d; font-weight: 500; }
.field-value { color: #212529; font-weight: 600; }

.popup-actions {
    padding: 8px 14px;
    display: flex;
    gap: 8px;
    border-top: 1px solid #eee;
}

/* Draw Mode Indicator */
.map-draw-indicator {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: #00BCD4;
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Map Legend */
.map-legend {
    position: absolute;
    bottom: 30px;
    right: 12px;
    z-index: 10;
    background: rgba(255,255,255,0.95);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ── HeatmapOverlay ── */
.heatmap-controls {
    background: white;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.heatmap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
}

.heatmap-options {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.heatmap-legend { margin-top: 6px; }

.legend-gradient {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, rgba(33,102,172,0), rgb(103,169,207), rgb(209,229,240), rgb(253,219,199), rgb(239,138,98), rgb(178,24,43));
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #6c757d;
    margin-top: 2px;
}

/* ── TrajectoryLayer ── */
.trajectory-panel {
    background: white;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.trajectory-header {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.trajectory-stats {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 2px 0;
}

.stat-label { color: #6c757d; }
.stat-value { font-weight: 600; }

.speed-legend {
    display: flex;
    gap: 8px;
    font-size: 11px;
    align-items: center;
}

.speed-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* ── GeofenceDrawTool ── */
.geofence-panel {
    background: white;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.geofence-header {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.draw-mode-buttons {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.draw-instructions {
    font-size: 12px;
    color: #6c757d;
    background: #fff3e0;
    padding: 6px 10px;
    border-radius: 6px;
    border-left: 3px solid #FF9800;
}

/* ── SignalR Real-Time Animations ── */

@keyframes marker-pulse {
    0%   { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
    70%  { box-shadow: 0 0 0 12px transparent; opacity: 0.7; }
    100% { box-shadow: 0 0 0 0 transparent; opacity: 0; }
}

@keyframes popup-slide-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.wit-map-popup-animated {
    animation: popup-slide-in 0.3s ease-out;
}

.popup-pulse {
    width: 8px; height: 8px; border-radius: 50%;
    display: inline-block; margin-right: 8px;
    animation: marker-pulse 1.5s ease-out infinite;
}

.wit-marker-dot {
    cursor: pointer;
}

/* ── Map Loading Skeleton ── */
.map-loading-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 12px;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.map-loading-text {
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
}

.saved-geofences {
    border-top: 1px solid #eee;
    padding-top: 8px;
}

.saved-geofence-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: 12px;
}

.gf-name { font-weight: 600; flex: 1; }
.gf-type { color: #6c757d; font-size: 10px; }
.gf-trigger {
    background: #e3f2fd;
    color: #1565C0;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
}
