/* Styling for the SharkMap component. Leaflet builds its DOM at runtime, outside Blazor's scoped-CSS
   attributes, so these rules live in a plain stylesheet rather than a .razor.css file. */

.shark-map {
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
    z-index: 0; /* Keep tiles under the header, drawer and dialogs. */
}

.shark-map-picking {
    cursor: crosshair;
}

/* Simple colored dot pin, generated as a divIcon so a new layer costs a color rather than an asset. */
.shark-map-pin-wrapper {
    background: none;
    border: none;
}

.shark-map-pin {
    display: block;
    position: relative;
    width: 18px;
    height: 18px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.shark-map-popup {
    max-width: 240px;
}

.shark-map-popup-thumb {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 6px;
}

.shark-map-popup-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.shark-map-popup-body {
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 6px;
}

.shark-map-popup-lines {
    margin: 0 0 6px;
    padding: 0;
    list-style: none;
    font-size: 0.8rem;
    line-height: 1.45;
}

.shark-map-popup-lines li + li {
    margin-top: 2px;
}

.shark-map-popup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.shark-map-popup-action {
    margin-top: 2px;
    padding: 4px 10px;
    border: 1px solid var(--nx-accent, #22d3ee);
    border-radius: 999px;
    background: transparent;
    color: var(--nx-accent, #0891b2);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.shark-map-popup-action:hover,
.shark-map-popup-action:focus-visible {
    background: var(--nx-accent, #22d3ee);
    color: var(--nx-bg, #0b1020);
}

.shark-map-popup-link {
    font-size: 0.85rem;
    font-weight: 500;
}

/* OpenStreetMap only publishes a light basemap. Rather than pay for a dark tile set, invert and
   re-rotate the hue so the tiles read as dark while roads/water keep roughly their real colors.
   Markers and controls sit in other panes and are left untouched. */
[data-theme="dark"] .shark-map .leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9);
}

[data-theme="dark"] .shark-map .leaflet-popup-content-wrapper,
[data-theme="dark"] .shark-map .leaflet-popup-tip,
[data-theme="dark"] .shark-map .leaflet-control-layers,
[data-theme="dark"] .shark-map .leaflet-bar a {
    background-color: var(--nx-surface-solid);
    color: var(--nx-text);
}

[data-theme="dark"] .shark-map .leaflet-control-attribution {
    background-color: rgba(0, 0, 0, 0.6);
    color: var(--nx-text-dim);
}

[data-theme="dark"] .shark-map .leaflet-control-attribution a {
    color: var(--nx-accent);
}

/* Live maps (the visitors page): a pin drops in when it appears, ripples when its marker gets
   new activity, and shrinks away when it leaves. sharkMap.js adds and removes these classes on
   the marker's element. The ripple is the pin's ::after, centered on its point, in the pin's
   own color. */
.shark-map-pin::after {
    content: "";
    position: absolute;
    left: -2px;
    bottom: -2px;
    width: 14px;
    height: 14px;
    margin: 0 0 -9px -9px;
    border: 2px solid currentColor;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.shark-map-pin-enter .shark-map-pin {
    animation: shark-map-drop 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.shark-map-pin-enter .shark-map-pin::after {
    animation: shark-map-ripple 1.2s ease-out 0.35s;
}

.shark-map-pin-pulse .shark-map-pin::after {
    animation: shark-map-ripple 1.2s ease-out;
}

.shark-map-pin-leave .shark-map-pin {
    animation: shark-map-leave 0.6s ease-in forwards;
}

@keyframes shark-map-drop {
    from { transform: translateY(-40px) rotate(-45deg) scale(0.4); opacity: 0; }
    60% { opacity: 1; }
    to { transform: rotate(-45deg); }
}

@keyframes shark-map-ripple {
    from { transform: scale(0.6); opacity: 0.9; }
    to { transform: scale(3.4); opacity: 0; }
}

@keyframes shark-map-leave {
    to { transform: rotate(-45deg) scale(0.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .shark-map-pin-enter .shark-map-pin,
    .shark-map-pin-enter .shark-map-pin::after,
    .shark-map-pin-pulse .shark-map-pin::after,
    .shark-map-pin-leave .shark-map-pin {
        animation: none;
    }
}

/* The heatmap canvas sits over the tiles and must not swallow drags or clicks. */
.shark-map-heat {
    pointer-events: none;
}
