/* Shared route explorer component. */

.network-card {
    position: relative;
    min-height: 720px;
}

.network-heading {
    position: relative;
    z-index: 2;
}

.network-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.network-button,
.network-filter {
    min-height: 44px;
    appearance: none;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.045);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    transition:
        color 180ms ease,
        border-color 180ms ease,
        background 180ms ease,
        transform 180ms ease;
}

.network-button {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
}

.network-button:hover,
.network-filter:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.075);
}

.network-button:active,
.network-filter:active {
    transform: scale(0.97);
}

.network-button:focus-visible,
.network-filter:focus-visible,
.network-details button:focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 3px;
}

.network-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
}

.network-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
}

.network-filter span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 25px;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.075);
    font-size: 0.7rem;
}

.network-filter.active {
    color: #ffffff;
    border-color: rgba(232, 33, 39, 0.55);
    background: rgba(232, 33, 39, 0.18);
}

.network-filter.active span {
    background: rgba(232, 33, 39, 0.28);
}

.network-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    padding: 13px 28px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.78rem;
}

.network-legend > span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.network-help {
    margin-left: auto;
}

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

.legend-dot.visited {
    background: var(--success);
    box-shadow: 0 0 10px rgba(66, 211, 146, 0.55);
}

.legend-dot.unvisited {
    background: var(--accent-light);
    box-shadow: 0 0 10px rgba(232, 33, 39, 0.55);
}

.legend-dot.future {
    background: #798395;
    box-shadow: 0 0 10px rgba(121, 131, 149, 0.35);
}

.charger-network {
    position: relative;
    height: 560px;
    overflow: hidden;
    background:
        radial-gradient(
            circle at 50% 45%,
            rgba(255, 255, 255, 0.035),
            transparent 48%
        ),
        linear-gradient(
            rgba(255, 255, 255, 0.015) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.015) 1px,
            transparent 1px
        ),
        rgba(5, 7, 12, 0.42);
    background-size:
        auto,
        38px 38px,
        38px 38px,
        auto;
    touch-action: none;
}

#network-svg {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

#network-svg:active {
    cursor: grabbing;
}

.network-link {
    stroke: rgba(255, 255, 255, 0.11);
    stroke-width: 1.2;
    vector-effect: non-scaling-stroke;
}

.network-link.hidden {
    display: none;
}

.network-node {
    cursor: grab;
}

.network-node:active {
    cursor: grabbing;
}

.network-node circle {
    stroke: rgba(255, 255, 255, 0.64);
    stroke-width: 1.5;
    transition:
        opacity 180ms ease,
        stroke-width 180ms ease;
    vector-effect: non-scaling-stroke;
}

.network-node.visited circle {
    fill: var(--success);
    filter: drop-shadow(
        0 0 7px rgba(66, 211, 146, 0.48)
    );
}

.network-node.unvisited circle {
    fill: var(--accent);
    filter: drop-shadow(
        0 0 7px rgba(232, 33, 39, 0.48)
    );
}

.network-node.future circle {
    fill: #737d8d;
    filter: drop-shadow(
        0 0 5px rgba(115, 125, 141, 0.34)
    );
}

.network-node text {
    fill: rgba(245, 247, 251, 0.82);
    paint-order: stroke;
    stroke: rgba(9, 11, 16, 0.92);
    stroke-width: 4px;
    stroke-linejoin: round;
    font-size: 10px;
    font-weight: 750;
    pointer-events: none;
    user-select: none;
}

.network-node:hover circle,
.network-node.selected circle {
    stroke: #ffffff;
    stroke-width: 3;
}

.network-node.hidden {
    display: none;
}

.network-loading {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: rgba(9, 11, 16, 0.7);
    backdrop-filter: blur(8px);
    font-size: 0.86rem;
    font-weight: 750;
    letter-spacing: 0.02em;
}

.network-loading[hidden] {
    display: none;
}

.network-loading.error {
    color: var(--warning);
}

.network-details {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 4;
    width: min(320px, calc(100% - 36px));
    padding: 21px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 20px;
    background: rgba(14, 17, 24, 0.94);
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(20px);
}

.network-details[hidden] {
    display: none;
}

.network-details button {
    position: absolute;
    top: 11px;
    right: 13px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.055);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.network-details button:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
}

.network-detail-status {
    display: inline-flex;
    margin: 0 38px 13px 0;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.network-detail-status.visited {
    color: var(--success);
    background: rgba(66, 211, 146, 0.12);
}

.network-detail-status.unvisited {
    color: var(--accent-light);
    background: rgba(232, 33, 39, 0.14);
}

.network-detail-status.future {
    color: #aeb6c4;
    background: rgba(121, 131, 149, 0.15);
}

.network-details h3 {
    margin: 0 0 7px;
    font-size: 1.35rem;
    line-height: 1.08;
    letter-spacing: -0.035em;
}

#network-details-location {
    margin: 0 0 19px;
    color: var(--muted);
    font-size: 0.84rem;
}

.network-details dl {
    display: grid;
    gap: 12px;
    margin: 0;
}

.network-details dl div {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-top: 11px;
    border-top: 1px solid var(--border);
}

.network-details dt {
    color: var(--muted);
    font-size: 0.74rem;
}

.network-details dd {
    margin: 0;
    text-align: right;
    font-size: 0.78rem;
    font-weight: 800;
}

@media (prefers-reduced-motion: reduce) {
    .network-button,
    .network-filter,
    .network-node circle {
        transition: none;
    }
}

@media (max-width: 620px) {
    .network-heading {
        align-items: stretch;
    }

    .network-actions {
        width: 100%;
    }

    .network-button {
        width: 100%;
        justify-content: center;
    }

    .network-toolbar {
        padding: 15px 18px;
    }

    .network-filter {
        flex: 1 1 calc(50% - 6px);
        justify-content: space-between;
    }

    .network-legend {
        gap: 12px;
        padding: 13px 18px;
    }

    .network-help {
        width: 100%;
        margin-left: 0;
    }

    .charger-network {
        position: relative;
        height: 560px;
        overflow: hidden;
        background:
            radial-gradient(
                circle at 50% 45%,
                rgba(255, 255, 255, 0.035),
                transparent 48%
            ),
            linear-gradient(
                rgba(255, 255, 255, 0.015) 1px,
                transparent 1px
            ),
            linear-gradient(
                90deg,
                rgba(255, 255, 255, 0.015) 1px,
                transparent 1px
            ),
            rgba(5, 7, 12, 0.42);
        background-size:
            auto,
            38px 38px,
            38px 38px,
            auto;
        touch-action: none;
    }

    .network-canvas {
        position: absolute;
        inset: 0;
        z-index: 1;
        display: block;
        width: 100%;
        height: 100%;
        min-width: 0;
        min-height: 0;
    }

    .network-canvas > div {
        width: 100% !important;
        height: 100% !important;
    }

    .network-canvas canvas {
        display: block;
    }

    .network-loading {
        z-index: 3;
    }

    .network-details {
        z-index: 4;
    }

    #network-svg {
        display: block;
        width: 100%;
        height: 100%;
        cursor: grab;
    }

    .network-render-canvas {
        display: block;
        width: 100%;
        height: 100%;
        touch-action: none;
    }

    .network-details {
        top: 12px;
        right: 12px;
        width: calc(100% - 24px);
    }
}

.network-legend-group {
    display: grid;
    gap: 8px;
}

.network-legend-group strong {
    font-size: 0.74rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}

.network-legend-divider {
    height: 1px;
    margin: 4px 0;
    background: rgba(255, 255, 255, 0.1);
}

.network-link-sample {
    display: block;
    width: 34px;
    height: 0;
    border-top-style: solid;
    border-top-width: 3px;
    border-radius: 999px;
}

.network-link-sample.corridor {
    border-top-color: rgba(148, 163, 184, 0.8);
}

.network-link-sample.circuit {
    border-top-color: rgba(167, 139, 250, 0.9);
}

.network-link-sample.bridge {
    border-top-color: rgba(245, 158, 11, 0.95);
    border-top-style: dashed;
}

.network-link-sample.access {
    border-top-color: rgba(56, 189, 248, 0.92);
}

.network-link-sample.ferry {
    border-top-color: rgba(96, 165, 250, 1);
    border-top-width: 4px;
    border-top-style: dashed;
}

.network-legend {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 18px 24px;

    padding: 14px 16px;

    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.network-legend-section {
    display: grid;
    gap: 8px;
}

.network-legend-section > strong {
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}

.network-legend-items {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.network-legend-item {
    position: relative;

    display: inline-flex;
    align-items: center;
    gap: 7px;

    min-height: 24px;

    font-size: 0.78rem;
    color: rgba(216, 222, 233, 0.76);
}

.network-legend-divider {
    align-self: stretch;
    width: 1px;
    min-height: 38px;

    background: rgba(255, 255, 255, 0.1);
}

.network-link-sample {
    display: inline-block;
    width: 34px;
    height: 0;

    border-top-width: 3px;
    border-top-style: solid;
    border-radius: 999px;
}

.network-link-sample.corridor {
    border-top-color: rgba(148, 163, 184, 0.9);
}

.network-link-sample.circuit {
    border-top-color: rgba(167, 139, 250, 0.95);
}

.network-link-sample.bridge {
    border-top-color: rgba(245, 158, 11, 0.95);
    border-top-style: dashed;
}

.network-link-sample.access {
    border-top-color: rgba(56, 189, 248, 0.95);
}

.network-link-sample.ferry {
    border-top-width: 4px;
    border-top-style: dashed;
    border-top-color: rgba(96, 165, 250, 1);
}

.network-help {
    margin-left: auto;
    align-self: center;

    font-size: 0.78rem;
    color: rgba(216, 222, 233, 0.68);
}

/* Tooltip */

.network-tooltip {
    cursor: help;
    outline: none;
}

.network-tooltip::before,
.network-tooltip::after {
    position: absolute;
    left: 50%;
    z-index: 30;

    opacity: 0;
    pointer-events: none;

    transition:
        opacity 120ms ease,
        transform 120ms ease;
}

.network-tooltip::before {
    content: attr(data-tooltip);

    bottom: calc(100% + 10px);
    transform: translate(-50%, 5px);

    width: max-content;
    max-width: 250px;
    padding: 8px 10px;

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;

    background: rgba(9, 11, 16, 0.96);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);

    font-size: 0.72rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);

    white-space: normal;
}

.network-tooltip::after {
    content: "";

    bottom: calc(100% + 4px);
    transform: translate(-50%, 5px);

    border: 6px solid transparent;
    border-top-color: rgba(9, 11, 16, 0.96);
}

.network-tooltip:hover::before,
.network-tooltip:hover::after,
.network-tooltip:focus-visible::before,
.network-tooltip:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 900px) {
    .network-legend-divider {
        display: none;
    }

    .network-help {
        width: 100%;
        margin-left: 0;
    }
}
