:root {
    --bg-dark: #090b12;
    --bg-surface: rgba(15, 18, 29, 0.92);
    --bg-card: rgba(23, 27, 42, 0.88);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-cyan: #22d3ee;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    background: radial-gradient(circle at top left, #111827 0%, #090b12 55%, #06070c 100%);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow: hidden;
}

.tracker-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Header */
.tracker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    z-index: 1100;
    flex-wrap: wrap;
}

.header-left h1 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.header-sub {
    font-size: 11px;
    color: var(--text-secondary);
}

.add-watch-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.callsign-input {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    padding: 7px 12px;
    width: 210px;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.callsign-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.22);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #0891b2);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover {
    filter: brightness(1.12);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: rgba(30, 41, 59, 0.85);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
    background: rgba(51, 65, 85, 0.9);
    border-color: rgba(255, 255, 255, 0.22);
}

/* Mobile Sites Dropdown */
.mobile-picker-wrap {
    position: relative;
}

.mobile-picker-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 310px;
    max-height: 360px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65);
    z-index: 2000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mobile-picker-hdr {
    padding: 9px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--border-color);
}

.mobile-picker-list {
    overflow-y: auto;
    max-height: 315px;
}

.mobile-picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease;
}

.mobile-picker-item:hover {
    background: rgba(59, 130, 246, 0.15);
}

.mobile-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-item-call {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 13px;
    color: #93c5fd;
}

.mobile-item-meta {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: right;
}

.mobile-picker-empty {
    padding: 16px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link-btn {
    background: rgba(30, 41, 59, 0.75);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease;
}

.nav-link-btn:hover {
    background: rgba(51, 65, 85, 0.9);
}

.daemon-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
    border: 1px solid var(--border-color);
}

.daemon-pill.online {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.45);
    color: #34d399;
}

.daemon-pill.offline {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.45);
    color: #fca5a5;
}

.daemon-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

/* Controls & Active Watches Bar */
.controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(15, 23, 42, 0.78);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    z-index: 1050;
}

.watches-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 240px;
    overflow-x: auto;
}

.watches-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    white-space: nowrap;
}

.watches-list {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.watch-empty {
    font-size: 12px;
    color: var(--text-muted);
}

.watch-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.watch-pill:hover {
    border-color: rgba(34, 211, 238, 0.55);
}

.watch-pill.active {
    background: rgba(8, 145, 178, 0.25);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.25);
}

.watch-pill-call {
    font-family: var(--font-mono);
    font-weight: 700;
}

.watch-pill-ttl {
    font-size: 10px;
    color: var(--text-secondary);
}

.watch-pill-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.watch-pill-remove:hover {
    color: var(--accent-red);
}

.map-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeframe-group {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.tf-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.tf-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.tf-btn.active {
    background: var(--accent-blue);
    color: #fff;
}

.btn-toggle {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-toggle.active {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.55);
    color: #34d399;
}

/* Target Telemetry Spotlight */
.target-spotlight {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    z-index: 1020;
}

.spotlight-identity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spotlight-emoji {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(245, 158, 11, 0.18);
    border: 2px solid var(--accent-amber);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.spotlight-call {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 800;
    color: #fde68a;
}

.spotlight-sub {
    font-size: 11px;
    color: var(--text-secondary);
}

.spotlight-metrics {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.metric-chip {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 4px 10px;
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.metric-value {
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.spotlight-comment {
    font-size: 12px;
    color: #cbd5e1;
    font-style: italic;
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Map Area */
.map-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
}

#tracker-map {
    width: 100%;
    height: 100%;
    background: #0b0f19;
}

.osm-dark-tiles {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

.map-empty-overlay {
    position: absolute;
    inset: 0;
    background: rgba(9, 11, 18, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    pointer-events: none;
}

.empty-card {
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 24px 28px;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.empty-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.empty-card h2 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Exact APRS Pin, Moving Pulse, Flash, Trail & Dot Styles from MonitorWebsite */
.mon-marker {
    background: transparent;
    border: none;
}

.mon-pin {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.92);
    border: 2px solid var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    position: relative;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.55);
}

.mon-pin.tracker-target {
    border-color: var(--accent-amber);
    background: rgba(120, 53, 15, 0.9);
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.95);
    transform: scale(1.12);
}

.mon-pin.tracker-target .mon-pin-label {
    border-color: var(--accent-amber);
    color: #fde68a;
}

.mon-pin.mon-beacon-flash {
    border-color: #60a5fa !important;
    background: rgba(30, 58, 138, 0.55) !important;
    box-shadow: 0 0 22px rgba(59, 130, 246, 1), 0 0 38px rgba(59, 130, 246, 0.65) !important;
    transform: scale(1.22);
    animation: mon-beacon-flash-ring 1.8s ease-out 1;
}

@keyframes mon-beacon-flash-ring {
    0% { box-shadow: 0 0 14px rgba(59, 130, 246, 1), 0 0 0 0 rgba(59, 130, 246, 0.9); }
    70% { box-shadow: 0 0 24px rgba(59, 130, 246, 0.95), 0 0 0 18px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 10px rgba(59, 130, 246, 0.6), 0 0 0 0 rgba(59, 130, 246, 0); }
}

.mon-pin.aprs-moving {
    border-color: #22d3ee;
    background: rgba(8, 51, 68, 0.88);
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.9);
    animation: pulse-cyan 1.8s infinite;
}

@keyframes pulse-cyan {
    0% { box-shadow: 0 0 8px rgba(34, 211, 238, 0.75); }
    50% { box-shadow: 0 0 18px rgba(34, 211, 238, 1), 0 0 28px rgba(34, 211, 238, 0.45); }
    100% { box-shadow: 0 0 8px rgba(34, 211, 238, 0.75); }
}

.mon-pin-label {
    position: absolute;
    bottom: -17px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.84);
    color: #fff;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    font-family: var(--font-mono);
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

path.station-trail-moving {
    filter: drop-shadow(0 0 5px rgba(34, 211, 238, 0.85));
}

path.station-trail-line {
    filter: drop-shadow(0 0 3px rgba(59, 130, 246, 0.55));
}

.trail-beacon-dot {
    cursor: pointer !important;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.trail-beacon-dot:hover {
    filter: brightness(1.35) drop-shadow(0 0 6px rgba(59, 130, 246, 0.9));
}

/* Dark Leaflet Popups & Tooltips */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: rgba(15, 23, 42, 0.96);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.leaflet-tooltip {
    background: rgba(15, 23, 42, 0.94);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
