/* Map page styles extracted from map.html to comply with CSP (no inline styles) */
.footer {
    display: none !important;
}

.map-container {
    position: fixed;
    top: 56px; /* Height of navbar */
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    background: #f8f9fa;
    z-index: 1;
}

[data-bs-theme="dark"] .map-container {
    background: #121212;
}

.map-main {
    flex: 1;
    position: relative;
    overflow: hidden;
    order: 1;
}

.network-map {
    width: 100%;
    height: 100%;
    background: #f8f9fa;
    transition: background 0.2s ease;
}

[data-bs-theme="dark"] .network-map {
    background: #111418;
}

.loading-overlay, .error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(248, 249, 250, 0.9);
    z-index: 100;
}

[data-bs-theme="dark"] .loading-overlay,
[data-bs-theme="dark"] .error-overlay {
    background: rgba(18, 18, 18, 0.9);
    color: #e9ecef;
}

.error-overlay {
    color: #dc3545;
}

[data-bs-theme="dark"] .error-overlay {
    color: #ff6b6b;
}

.node-list-container {
    max-height: 400px;
    overflow-y: auto;
}

.node-list {
    max-height: 300px;
    overflow-y: auto;
}

.node-list-item {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.875rem;
}

.node-list-item:hover {
    background-color: #f8f9fa;
}

.node-list-item.selected {
    background-color: #e7f3ff;
    border-color: #0d6efd;
}

.signal-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.role-color-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.age-indicator {
    font-size: 0.75rem;
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    display: inline-block;
}

.age-fresh { background-color: #d1e7dd; color: #0f5132; }
.age-recent { background-color: #fff3cd; color: #664d03; }
.age-old { background-color: #f8d7da; color: #721c24; }

.traceroute-link-info {
    font-size: 0.9rem;
    min-width: 250px;
}

.traceroute-link-info .fw-bold {
    color: #0d6efd;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.25rem;
    margin-bottom: 0.5rem;
}

/* Custom marker cluster styles */
.marker-cluster-small {
    background-color: rgba(181, 226, 140, 0.6);
}
.marker-cluster-small div {
    background-color: rgba(110, 204, 57, 0.6);
}

.marker-cluster-medium {
    background-color: rgba(241, 211, 87, 0.6);
}
.marker-cluster-medium div {
    background-color: rgba(240, 194, 12, 0.6);
}

.marker-cluster-large {
    background-color: rgba(253, 156, 115, 0.6);
}
.marker-cluster-large div {
    background-color: rgba(241, 128, 23, 0.6);
}

/* Custom node marker styles */
.custom-node-marker {
    background: transparent !important;
    border: none !important;
}

.node-marker-container {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.map-fallback-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: auto;
    max-width: min(360px, calc(100% - 2rem));
    display: none;
    z-index: 120;
    pointer-events: none;
}

.map-fallback-overlay.is-visible {
    display: block;
}

.map-fallback-card {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.94);
    border-radius: 0.75rem;
    border: 1px solid rgba(33, 37, 41, 0.12);
    box-shadow: 0 0.75rem 1.5rem rgba(33, 37, 41, 0.16);
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
}

[data-bs-theme="dark"] .map-fallback-card {
    background: rgba(33, 37, 41, 0.94);
    border-color: rgba(222, 226, 230, 0.12);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.4);
}

.map-fallback-caption {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    color: var(--bs-secondary-color, #6c757d);
}

.map-fallback-summary {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1rem;
}

.map-fallback-summary dt {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--bs-secondary-color, #6c757d);
    margin-bottom: 0.35rem;
}

.map-fallback-summary dd {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
}

.map-fallback-selected {
    border-top: 1px solid rgba(33, 37, 41, 0.12);
    padding-top: 0.85rem;
}

[data-bs-theme="dark"] .map-fallback-selected {
    border-top-color: rgba(222, 226, 230, 0.12);
}

.map-fallback-selected-title {
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.map-fallback-selected-subtitle {
    font-size: 0.75rem;
}

.map-fallback-precision {
    margin: 0.75rem 0 1rem;
    text-align: center;
}

.map-fallback-precision-visual {
    --precision-size: 140px;
    width: var(--precision-size);
    height: var(--precision-size);
    border-radius: 50%;
    border: 2px dashed rgba(13, 110, 253, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.85rem;
    position: relative;
    transition: all 0.2s ease;
}

.map-fallback-precision-visual::after {
    content: "";
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0d6efd;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.35);
}

[data-bs-theme="dark"] .map-fallback-precision-visual::after {
    border-color: rgba(33, 37, 41, 0.95);
}

.map-fallback-precision[data-fallback-precision="tight"] .map-fallback-precision-visual {
    border-color: rgba(25, 135, 84, 0.6);
    box-shadow: 0 0 0 8px rgba(25, 135, 84, 0.08);
}

.map-fallback-precision[data-fallback-precision="medium"] .map-fallback-precision-visual {
    border-color: rgba(255, 193, 7, 0.6);
    box-shadow: 0 0 0 8px rgba(255, 193, 7, 0.1);
}

.map-fallback-precision[data-fallback-precision="wide"] .map-fallback-precision-visual {
    border-color: rgba(220, 53, 69, 0.5);
    box-shadow: 0 0 0 8px rgba(220, 53, 69, 0.08);
}

.map-fallback-precision-text {
    font-size: 0.8rem;
    color: var(--bs-secondary-color, #6c757d);
}

.map-fallback-precision-note {
    display: block;
    font-size: 0.7rem;
    color: var(--bs-secondary-color, #6c757d);
    margin-top: 0.2rem;
}

.map-fallback-details {
    font-size: 0.8rem;
    line-height: 1.4;
}

.map-fallback-details li + li {
    margin-top: 0.25rem;
}

.map-fallback-empty {
    margin: 0;
    color: var(--bs-secondary-color, #6c757d);
}

.node-marker-container:hover {
    transform: scale(1.1);
}

.node-marker-label {
    font-size: 10px;
    line-height: 1;
    max-width: 36px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* Additional mobile adjustments specific to map */
@media (max-width: 768px) {
    .map-container {
        flex-direction: column;
        top: 56px;
    }

    .map-main {
        order: 1;
        flex: 1;
    }

    /* Keep nested scroll only for node list and reduce its height for better usability */
    .node-list-container {
        max-height: 40vh; /* Smaller scrollable area */
        overflow-y: auto;
    }

    .node-list {
        max-height: 30vh; /* Nested list scroll area */
        overflow-y: auto;
    }
}

/* Legend line style */
.legend-line {
    display: inline-block;
    width: 22px;
    height: 0;
    margin-right: 4px;
    vertical-align: middle;
}
