/* ==========================================================================
   QDT shared Leaflet map component (wwwroot/css/shared/qdt-map.css)
   --------------------------------------------------------------------------
   Reusable across any tool page that needs to plot a real point on a real
   map - IP Geolocation Lookup today, potentially NetPath Pro, Website
   Inspector or others later. Pair with wwwroot/js/shared/qdt-map.js and the
   Leaflet CDN assets (see Views/Shared/_LeafletMapAssets.cshtml).
   Namespaced under .qdt-map-* so it never collides with any page's own
   theme classes.
   ========================================================================== */

.qdt-map-container {
    position: relative;
    width: 100%;
    height: 420px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #d9e8e7;
    box-shadow: 0 8px 26px rgba(16, 24, 40, 0.06);
    background: #eef5f4;
}

.qdt-map-container .leaflet-container {
    width: 100%;
    height: 100%;
    font-family: inherit;
    background: #eef5f4;
}

.qdt-map-empty {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    color: #667085;
    font-size: 0.85rem;
    line-height: 1.6;
}

/* ---------- modern pin marker (replaces Leaflet's default blue pin) ---------- */

.qdt-map-pin-wrap {
    background: transparent !important;
    border: none !important;
}

.qdt-map-pin {
    position: relative;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
}

.qdt-map-pin-ring {
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    border: 2px solid rgba(15, 118, 110, 0.35);
}

.qdt-map-pin-pulse {
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: rgba(20, 184, 166, 0.38);
    animation: qdt-map-pulse 2.4s cubic-bezier(0.2, 0.7, 0.4, 1) infinite;
}

.qdt-map-pin-dot {
    position: relative;
    z-index: 2;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: linear-gradient(145deg, #2dd4bf, #0b5d57);
    border: 3px solid #ffffff;
    box-shadow:
        0 3px 10px rgba(15, 118, 110, 0.5),
        0 0 0 1px rgba(15, 118, 110, 0.25);
}

@keyframes qdt-map-pulse {
    0%   { transform: scale(0.35); opacity: 0.85; }
    70%  { transform: scale(1.9);  opacity: 0; }
    100% { transform: scale(1.9);  opacity: 0; }
}

/* Optional color variants - pass colorClass: "is-good" | "is-warn" | "is-bad" to
   QdtMap.renderMulti() to band pins by whatever metric matters (e.g. latency). */
.qdt-map-pin.is-good .qdt-map-pin-dot { background: linear-gradient(145deg, #34d399, #0b7a4a); }
.qdt-map-pin.is-good .qdt-map-pin-pulse { background: rgba(52, 211, 153, 0.38); }
.qdt-map-pin.is-good .qdt-map-pin-ring { border-color: rgba(11, 122, 74, 0.35); }

.qdt-map-pin.is-warn .qdt-map-pin-dot { background: linear-gradient(145deg, #fbbf24, #b45309); }
.qdt-map-pin.is-warn .qdt-map-pin-pulse { background: rgba(251, 191, 36, 0.38); }
.qdt-map-pin.is-warn .qdt-map-pin-ring { border-color: rgba(180, 83, 9, 0.35); }

.qdt-map-pin.is-bad .qdt-map-pin-dot { background: linear-gradient(145deg, #fb7185, #b91c3c); }
.qdt-map-pin.is-bad .qdt-map-pin-pulse { background: rgba(251, 113, 133, 0.38); }
.qdt-map-pin.is-bad .qdt-map-pin-ring { border-color: rgba(185, 28, 60, 0.35); }

.qdt-map-pin.is-neutral .qdt-map-pin-dot { background: linear-gradient(145deg, #94a3b8, #475569); }
.qdt-map-pin.is-neutral .qdt-map-pin-pulse { background: rgba(148, 163, 184, 0.32); }
.qdt-map-pin.is-neutral .qdt-map-pin-ring { border-color: rgba(71, 85, 105, 0.32); }

/* ---------- "source" marker (e.g. the target under test) - visually distinct and blinking so
   it reads as a different kind of point from the destination pins around it ---------- */

.qdt-map-pin.qdt-map-pin-source {
    width: 42px;
    height: 42px;
}

.qdt-map-pin-source .qdt-map-pin-dot {
    width: 18px;
    height: 18px;
    background: linear-gradient(145deg, #60a5fa, #1d4ed8);
    box-shadow:
        0 3px 12px rgba(29, 78, 216, 0.55),
        0 0 0 1px rgba(29, 78, 216, 0.3);
}

.qdt-map-pin-source .qdt-map-pin-ring {
    border-color: rgba(29, 78, 216, 0.4);
}

.qdt-map-pin-source .qdt-map-pin-pulse {
    background: rgba(96, 165, 250, 0.42);
}

.qdt-map-pin-blink {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.9);
    animation: qdt-map-source-blink 1.15s ease-in-out infinite;
}

@keyframes qdt-map-source-blink {
    0%, 100% { opacity: 1; transform: scale(0.88); }
    50% { opacity: 0.12; transform: scale(1.3); }
}

/* A second, slower ring so the source reads as actively transmitting rather than
   just decorated - it expands outward in the direction the packets travel. */
.qdt-map-pin-source .qdt-map-pin-dot::after {
    content: "";
    position: absolute;
    inset: -9px;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.55);
    animation: qdt-map-source-emit 2.2s cubic-bezier(0.2, 0.7, 0.4, 1) infinite;
    pointer-events: none;
}

@keyframes qdt-map-source-emit {
    0% { transform: scale(0.5); opacity: 0.9; }
    75% { transform: scale(2.3); opacity: 0; }
    100% { transform: scale(2.3); opacity: 0; }
}

/* ---------- animated "sky route" arcs (renderPingMap) ---------- */

.qdt-map-container .qdt-map-arc {
    stroke-dasharray: 6 8;
    animation: qdt-map-arc-flow 1.4s linear infinite;
    filter: drop-shadow(0 0 2px currentColor);
}

.qdt-map-container .qdt-map-arc.is-neutral { stroke: #8b9dc9; color: #8b9dc9; opacity: 0.55; }
.qdt-map-container .qdt-map-arc.is-good { stroke: #10b981; color: #10b981; }
.qdt-map-container .qdt-map-arc.is-warn { stroke: #f59e0b; color: #f59e0b; }
.qdt-map-container .qdt-map-arc.is-bad { stroke: #ef4444; color: #ef4444; }

@keyframes qdt-map-arc-flow {
    to { stroke-dashoffset: -140; }
}

/* ---------- travelling "packet" along each route (startFlows) ---------- */

.qdt-map-flow-wrap {
    background: transparent !important;
    border: none !important;
    pointer-events: none;
}

.qdt-map-flow {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #8b9dc9;
    box-shadow:
        0 0 0 3px rgba(139, 157, 201, 0.22),
        0 0 12px 3px rgba(139, 157, 201, 0.75);
    animation: qdt-map-flow-throb 1.1s ease-in-out infinite;
}

.qdt-map-flow.is-good {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22), 0 0 12px 3px rgba(16, 185, 129, 0.8);
}

.qdt-map-flow.is-warn {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22), 0 0 12px 3px rgba(245, 158, 11, 0.8);
}

.qdt-map-flow.is-bad {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.22), 0 0 12px 3px rgba(239, 68, 68, 0.8);
}

@keyframes qdt-map-flow-throb {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.72); opacity: 0.75; }
}

@media (prefers-reduced-motion: reduce) {
    .qdt-map-flow,
    .qdt-map-container .qdt-map-arc,
    .qdt-map-pin-blink,
    .qdt-map-pin-pulse {
        animation: none;
    }
}

/* ---------- popup ---------- */

.qdt-map-container .leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(16, 24, 40, 0.18);
}

.qdt-map-container .leaflet-popup-content {
    margin: 12px 16px;
}

.qdt-map-popup-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 900;
    color: #102a2e;
}

.qdt-map-popup-sub {
    display: block;
    margin-top: 2px;
    color: #667085;
    font-size: 0.76rem;
}

/* ---------- attribution / controls, toned down to match the site's aesthetic ---------- */

.qdt-map-container .leaflet-control-attribution {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.86);
    border-radius: 6px 0 0 0;
}

.qdt-map-container .leaflet-control-zoom a {
    border-radius: 8px;
}

@media (max-width: 780px) {
    .qdt-map-container {
        height: 300px;
    }
}
