/* BGPHorizon - Prefix Overview Styles */
/* Theme-aware styling using CSS variables from theme.css */

/* MOAS badge glow effect */
.moas-badge {
    box-shadow: 0 0 10px color-mix(in srgb, var(--highlight-5) 30%, transparent);
    animation: moas-pulse 2s ease-in-out infinite;
}

@keyframes moas-pulse {
    0%, 100% {
        box-shadow: 0 0 10px color-mix(in srgb, var(--highlight-5) 30%, transparent);
    }
    50% {
        box-shadow: 0 0 20px color-mix(in srgb, var(--highlight-5) 50%, transparent);
    }
}

/* AS path styling */
.as-path {
    word-break: break-all;
    line-height: 1.4;
}

/* Table row hover effect - using border instead of ::before to avoid layout issues */
tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--highlight-1);
}

/* Leaflet map theme */
#collector-map {
    background-color: var(--map-bg);
    z-index: 1;
    position: relative;
}

.leaflet-container {
    background: var(--map-bg);
    font-family: inherit;
}

.leaflet-control-zoom a {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

.leaflet-control-zoom a:hover {
    background-color: var(--bg-tertiary) !important;
}

.leaflet-control-attribution {
    background-color: color-mix(in srgb, var(--bg-primary) 80%, transparent) !important;
    color: var(--text-secondary) !important;
}

.leaflet-control-attribution a {
    color: var(--highlight-1) !important;
}

/* Custom map markers */
.collector-marker {
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.collector-marker:hover {
    transform: scale(1.3);
}

/* Color states based on data availability */
.collector-marker.has-data {
    background-color: var(--highlight-3);
}

.collector-marker.no-data {
    background-color: var(--text-secondary);
    border-color: var(--border);
    cursor: default;
    opacity: 0.7;
}

.collector-marker.mismatch {
    background-color: var(--highlight-5);
}

/* Legacy support */
.collector-marker.match {
    background-color: var(--highlight-3);
}

.collector-marker.high {
    background-color: var(--highlight-3);
}

.collector-marker.medium {
    background-color: var(--highlight-6);
}

.collector-marker.low {
    background-color: var(--text-secondary);
}

/* Selected marker styling */
.collector-marker.selected {
    border-color: var(--highlight-1);
    border-width: 3px;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--highlight-1) 40%, transparent), 0 2px 8px rgba(0, 0, 0, 0.5);
    animation: selected-pulse 2s ease-in-out infinite;
}

@keyframes selected-pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px color-mix(in srgb, var(--highlight-1) 40%, transparent), 0 2px 8px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 0 8px color-mix(in srgb, var(--highlight-1) 20%, transparent), 0 2px 12px rgba(0, 0, 0, 0.6);
    }
}

/* Max volume marker - green pulse to draw attention */
.collector-marker.max-volume:not(.selected) {
    animation: max-volume-pulse 2s ease-in-out infinite;
}

@keyframes max-volume-pulse {
    0%, 100% {
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--highlight-3) 50%, transparent), 0 2px 8px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 0 8px color-mix(in srgb, var(--highlight-3) 30%, transparent), 0 2px 12px rgba(0, 0, 0, 0.6);
    }
}

/* Map popup styling */
.leaflet-popup-content-wrapper {
    background-color: var(--popup-bg) !important;
    border: 1px solid var(--popup-border) !important;
    border-radius: 8px !important;
    color: var(--popup-text) !important;
}

.leaflet-popup-tip {
    background-color: var(--popup-bg) !important;
    border: 1px solid var(--popup-border) !important;
}

.leaflet-popup-close-button {
    color: var(--popup-text-secondary) !important;
}

.leaflet-popup-close-button:hover {
    color: var(--popup-text) !important;
}

/* Status indicator pulse */
@keyframes status-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: status-pulse 2s ease-in-out infinite;
}

/* Loading spinner */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* HTMX loading indicator */
.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-indicator {
    display: none;
}

/* Skeleton loading animation */
@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

.animate-pulse > div {
    animation: skeleton-pulse 2s ease-in-out infinite;
}

/* Badge styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

/* Data cell monospace styling */
.font-mono {
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-feature-settings: 'liga' 0;
}

/* Event type badges */
.event-announcement {
    background-color: color-mix(in srgb, var(--highlight-3) 20%, transparent);
    color: var(--highlight-3);
}

.event-withdrawal {
    background-color: color-mix(in srgb, var(--highlight-5) 20%, transparent);
    color: var(--highlight-5);
}

/* Modal backdrop */
#modal-container {
    z-index: 10000 !important;
}

#modal-container:not(.hidden) {
    display: flex;
    align-items: center;
    justify-content: center;
}

#modal-container .absolute.inset-0 {
    z-index: 10001;
}

#modal-content {
    z-index: 10002;
}

/* Focus states */
input:focus,
select:focus,
button:focus {
    outline: none;
    ring: 2px;
    ring-color: var(--highlight-1);
}

/* Responsive table */
@media (max-width: 768px) {
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.75rem;
    }

    th, td {
        padding: 0.5rem;
    }
}

/* Tooltip for truncated content - only apply to non-interactive elements */
[title]:not(a):not(button):not(.copyable):not(.collector-link):not(.cursor-pointer) {
    cursor: help;
}

/* Clickable collector link */
.collector-link {
    cursor: pointer !important;
    transition: text-decoration 0.15s, opacity 0.15s;
}

.collector-link:hover {
    text-decoration: underline;
    opacity: 0.9;
}

/* Click-to-copy elements */
.copyable {
    cursor: pointer !important;
    transition: opacity 0.15s, transform 0.1s;
}

.copyable:hover {
    opacity: 0.85;
}

.copyable:active {
    transform: scale(0.95);
}

/* Copy button */
.copy-btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:active {
    transform: scale(0.9);
}

/* Collector popup (non-map) */
.collector-popup {
    background-color: var(--popup-bg);
    border: 1px solid var(--popup-border);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    color: var(--popup-text);
    font-size: 14px;
    max-width: 280px;
}

/* Popup content classes (used by both map and non-map popups) */
.popup-content {
    min-width: 200px;
}

.popup-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.popup-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--popup-text);
}

.popup-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
}

.popup-badge-info {
    background: color-mix(in srgb, var(--highlight-1) 20%, transparent);
    color: var(--highlight-1);
}

.popup-badge-purple {
    background: color-mix(in srgb, var(--highlight-4) 20%, transparent);
    color: var(--highlight-4);
}

.popup-badge-success {
    background: color-mix(in srgb, var(--highlight-3) 20%, transparent);
    color: var(--highlight-3);
}

.popup-badge-row {
    margin-bottom: 8px;
}

.popup-location {
    font-size: 12px;
    color: var(--popup-text-secondary);
    margin-bottom: 8px;
}

.popup-stats {
    font-size: 12px;
    border-top: 1px solid var(--popup-border);
    padding-top: 8px;
}

.popup-stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.popup-stat-row:last-child {
    margin-bottom: 0;
}

.popup-stat-label {
    color: var(--popup-text-secondary);
}

.popup-stat-value {
    font-family: monospace;
}

.popup-stat-success {
    color: var(--highlight-3);
}

.popup-stat-error {
    color: var(--highlight-5);
}

.popup-actions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--popup-border);
}

.popup-btn {
    width: 100%;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
    border: none;
}

.popup-btn-primary {
    background: var(--highlight-3);
    color: #ffffff;
}

.popup-btn-primary:hover {
    background: color-mix(in srgb, var(--highlight-3) 80%, black);
}

.popup-btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--popup-text);
}

.popup-btn-secondary:hover {
    background: var(--border);
}

.popup-no-data {
    font-size: 12px;
    color: var(--popup-text-secondary);
    padding: 12px;
    text-align: center;
    background: color-mix(in srgb, var(--bg-tertiary) 50%, transparent);
    border-radius: 6px;
}
