/* ─── INTEL MAP: Live Global Surveillance ─────────────────── */

.imap-body {
    background: #050505;
    overflow: hidden;
    height: 100vh;
}

/* ─── Map canvas ─────────────────────────────────────────── */
#intelMap {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: #050505;
}

/* Leaflet dark-theme overrides */
.leaflet-container {
    background: #050505;
    font-family: 'JetBrains Mono', monospace;
}

.leaflet-control-zoom {
    border: 1px solid rgba(0, 204, 51, 0.3) !important;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.6) !important;
    margin-bottom: 46px !important;
    margin-left: 12px !important;
}

.leaflet-control-zoom a {
    background: rgba(10, 10, 10, 0.92) !important;
    color: #00cc33 !important;
    border-bottom: 1px solid rgba(0, 204, 51, 0.2) !important;
    font-family: 'JetBrains Mono', monospace;
}

.leaflet-control-zoom a:hover {
    background: rgba(0, 204, 51, 0.12) !important;
    color: #00ff41 !important;
}

.leaflet-control-attribution {
    background: rgba(5, 5, 5, 0.75) !important;
    color: rgba(255, 255, 255, 0.25) !important;
    font-size: 0.55rem !important;
    font-family: 'JetBrains Mono', monospace;
}

.leaflet-control-attribution a {
    color: rgba(0, 204, 51, 0.4) !important;
}

.leaflet-popup-content-wrapper {
    background: rgba(8, 10, 8, 0.96) !important;
    color: #d4d4d4 !important;
    border: 1px solid rgba(0, 204, 51, 0.35);
    border-radius: 2px;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.8);
    font-family: 'JetBrains Mono', monospace;
}

.leaflet-popup-tip {
    background: rgba(8, 10, 8, 0.96) !important;
    border: 1px solid rgba(0, 204, 51, 0.35);
}

.leaflet-popup-close-button {
    color: rgba(0, 204, 51, 0.6) !important;
}

/* ─── Marker styles ──────────────────────────────────────── */
.imap-quake-marker {
    border-radius: 50%;
    border: 1px solid rgba(255, 80, 40, 0.9);
    background: rgba(255, 80, 40, 0.35);
    box-shadow: 0 0 8px rgba(255, 80, 40, 0.5);
}

.imap-quake-marker.quake-major {
    border-color: #ff2a2a;
    background: rgba(255, 42, 42, 0.5);
    box-shadow: 0 0 16px rgba(255, 42, 42, 0.8);
    animation: imap-pulse 2s ease-in-out infinite;
}

.imap-event-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid rgba(201, 162, 39, 0.9);
    background: rgba(10, 10, 10, 0.85);
    color: #c9a227;
    font-size: 11px;
    transform: rotate(45deg);
    box-shadow: 0 0 8px rgba(201, 162, 39, 0.4);
}

.imap-event-marker span {
    transform: rotate(-45deg);
    display: block;
}

.imap-flight-marker {
    color: #00cc33;
    text-shadow: 0 0 6px rgba(0, 204, 51, 0.7);
    font-size: 13px;
    line-height: 1;
    transition: transform 0.5s linear;
}

.imap-iss-marker {
    position: relative;
}

.imap-iss-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #00ff41;
    border: 2px solid #050505;
    box-shadow: 0 0 14px rgba(0, 255, 65, 0.9);
    animation: imap-pulse 1.6s ease-in-out infinite;
}

@keyframes imap-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.imap-iss-trail {
    stroke: rgba(0, 255, 65, 0.5);
    stroke-width: 1.5;
    stroke-dasharray: 4 6;
    fill: none;
}

/* ─── Popup content ──────────────────────────────────────── */
.imap-popup-title {
    font-family: 'Orbitron', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: #00cc33;
    letter-spacing: 1px;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
}

.imap-popup-row {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.6;
}

.imap-popup-row b {
    color: rgba(201, 162, 39, 0.9);
    font-weight: 500;
}

/* ─── HUD chrome (top) ───────────────────────────────────── */
.imap-hud-top {
    position: fixed;
    top: var(--nav-height, 64px);
    left: 0;
    right: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: linear-gradient(180deg, rgba(5, 5, 5, 0.92), rgba(5, 5, 5, 0));
    pointer-events: none;
}

.imap-hud-left,
.imap-hud-readouts {
    pointer-events: auto;
}

.imap-title {
    font-family: 'Orbitron', monospace;
    font-size: 1.05rem;
    font-weight: 900;
    color: #00cc33;
    letter-spacing: 3px;
    text-shadow: 0 0 12px rgba(0, 204, 51, 0.5);
}

.imap-title-bracket {
    color: rgba(201, 162, 39, 0.9);
}

.imap-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    letter-spacing: 2.5px;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 2px;
}

.imap-hud-readouts {
    display: flex;
    gap: 0.6rem;
}

.imap-readout {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.3rem 0.7rem;
    background: rgba(8, 10, 8, 0.9);
    border: 1px solid rgba(0, 204, 51, 0.25);
    min-width: 62px;
}

.readout-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.52rem;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.35);
}

.readout-value {
    font-family: 'Orbitron', monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: #00ff41;
    line-height: 1.2;
}

.imap-readout.readout-alert .readout-value {
    color: #ff5030;
    animation: imap-pulse 1.2s ease-in-out infinite;
}

/* ─── Side panels ────────────────────────────────────────── */
.imap-layers,
.imap-channels {
    position: fixed;
    top: calc(var(--nav-height, 64px) + 74px);
    z-index: 500;
    width: 218px;
    background: rgba(8, 10, 8, 0.92);
    border: 1px solid rgba(0, 204, 51, 0.25);
    backdrop-filter: blur(6px);
    max-height: calc(100vh - var(--nav-height, 64px) - 150px);
    display: flex;
    flex-direction: column;
}

.imap-layers { left: 0.75rem; }
.imap-channels { right: 0.75rem; width: 190px; }

.imap-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid rgba(0, 204, 51, 0.2);
    font-family: 'Orbitron', monospace;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #00cc33;
    cursor: pointer;
    user-select: none;
}

.imap-panel-toggle {
    background: none;
    border: none;
    color: rgba(0, 204, 51, 0.7);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease;
}

.imap-panel-body {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 204, 51, 0.3) transparent;
}

.imap-panel-body::-webkit-scrollbar { width: 4px; }
.imap-panel-body::-webkit-scrollbar-thumb { background: rgba(0, 204, 51, 0.3); }

.imap-layers.collapsed .imap-panel-body,
.imap-layers.collapsed .imap-panel-footer,
.imap-channels.collapsed .imap-panel-body {
    display: none;
}

.imap-layers.collapsed .imap-panel-toggle,
.imap-channels.collapsed .imap-panel-toggle {
    transform: rotate(-90deg);
}

/* Layer rows */
.imap-layer-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: background 0.15s ease;
}

.imap-layer-row:hover {
    background: rgba(0, 204, 51, 0.05);
}

.imap-layer-row input[type="checkbox"] {
    accent-color: #00cc33;
    width: 12px;
    height: 12px;
    cursor: pointer;
}

.layer-swatch {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sw-quake { background: #ff5030; box-shadow: 0 0 5px rgba(255, 80, 48, 0.7); }
.sw-event { background: #c9a227; box-shadow: 0 0 5px rgba(201, 162, 39, 0.7); }
.sw-flight { background: #00cc33; box-shadow: 0 0 5px rgba(0, 204, 51, 0.7); }
.sw-iss { background: #00ff41; box-shadow: 0 0 5px rgba(0, 255, 65, 0.7); }

.layer-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.75);
    flex: 1;
}

.layer-src {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5rem;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.25);
}

.imap-panel-footer {
    padding: 0.4rem 0.7rem;
    border-top: 1px solid rgba(0, 204, 51, 0.2);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.55rem;
    letter-spacing: 1px;
    color: rgba(0, 255, 65, 0.55);
}

.imap-panel-footer.feed-degraded { color: rgba(255, 80, 48, 0.7); }

/* ─── Channel grid ───────────────────────────────────────── */
.imap-channel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: rgba(255, 255, 255, 0.04);
}

.imap-channel-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.2rem;
    background: rgba(8, 10, 8, 0.95);
    border: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.55rem;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.imap-channel-chip:hover {
    background: rgba(0, 204, 51, 0.12);
    color: #00ff41;
}

.imap-channel-chip.chip-active {
    background: rgba(0, 204, 51, 0.2);
    color: #00ff41;
    box-shadow: inset 0 0 0 1px rgba(0, 204, 51, 0.5);
}

/* ─── Floating stream player ─────────────────────────────── */
.imap-player {
    position: fixed;
    bottom: 3.2rem;
    right: 0.75rem;
    z-index: 600;
    width: 400px;
    max-width: calc(100vw - 1.5rem);
    background: rgba(8, 10, 8, 0.97);
    border: 1px solid rgba(0, 204, 51, 0.4);
    box-shadow: 0 0 32px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 204, 51, 0.15);
}

.imap-player-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    background: rgba(0, 204, 51, 0.08);
    border-bottom: 1px solid rgba(0, 204, 51, 0.25);
    cursor: move;
    user-select: none;
}

.imap-player-title {
    font-family: 'Orbitron', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #00cc33;
    text-transform: uppercase;
}

.imap-player-title::before {
    content: '● ';
    color: #ff2a2a;
    animation: imap-pulse 1.2s ease-in-out infinite;
}

.imap-player-controls {
    display: flex;
    gap: 0.3rem;
}

.imap-player-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.imap-player-btn:hover {
    background: rgba(0, 204, 51, 0.15);
    color: #00ff41;
    border-color: rgba(0, 204, 51, 0.4);
}

.imap-player-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.imap-player-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ─── Bottom ticker ──────────────────────────────────────── */
.imap-ticker {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 1rem;
    background: rgba(5, 5, 5, 0.94);
    border-top: 1px solid rgba(0, 204, 51, 0.25);
    font-family: 'JetBrains Mono', monospace;
    overflow: hidden;
}

.ticker-prefix {
    color: #c9a227;
    font-size: 0.65rem;
    flex-shrink: 0;
}

.ticker-text {
    font-size: 0.62rem;
    letter-spacing: 1px;
    color: rgba(0, 255, 65, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
    .imap-hud-readouts { display: none; }
    .imap-channels { display: none; }
    .imap-layers { width: 190px; }
}

@media (max-width: 600px) {
    .imap-layers {
        top: auto;
        bottom: 3rem;
        max-height: 40vh;
    }
    .imap-player { width: calc(100vw - 1.5rem); }
}
