/* ==========================================================================
   BARESKRIM POLRI - CENTRAL COMMAND CENTER (PUSAT KOMANDO MULTI-ARMADA)
   Luxury Tactical Dark UI Stylesheet
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600;700&display=swap');

:root {
    --bg-deep: #060a14;
    --bg-main: #0b1222;
    --bg-panel: #111b30;
    --bg-panel-elevated: #172440;
    --bg-sidebar: #0c1426;
    --border-subtle: rgba(148, 163, 184, 0.15);
    --border-highlight: rgba(56, 189, 248, 0.4);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --gold-polri: #f59e0b;
    --orange-active: linear-gradient(90deg, #f97316 0%, #ea580c 100%);
    --card-blue: linear-gradient(135deg, #1d4ed8 0%, #0284c7 100%);
    --card-green: linear-gradient(135deg, #047857 0%, #10b981 100%);
    --card-purple: linear-gradient(135deg, #6d28d9 0%, #9333ea 100%);
    --card-orange: linear-gradient(135deg, #b45309 0%, #ea580c 100%);
    --card-crimson: linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
    --card-dispatch: linear-gradient(135deg, #0f2942 0%, #064e3b 100%);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   TOP CENTRAL COMMAND HEADER BAR
   ========================================================================== */
.top-header {
    height: 66px;
    background: linear-gradient(90deg, #090e1c 0%, #111d36 50%, #090e1c 100%);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1050;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.55);
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-emblem-mini {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.4));
}

.brand-titles {
    display: flex;
    flex-direction: column;
}

.brand-agency {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 1.3px;
    color: var(--gold-polri);
    text-transform: uppercase;
}

.brand-system {
    font-size: 1.02rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cmd-badge-hq {
    font-size: 0.62rem;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.25), rgba(234, 88, 12, 0.25));
    border: 1px solid rgba(245, 158, 11, 0.55);
    color: #fde68a;
    padding: 2px 9px;
    border-radius: 4px;
    font-weight: 800;
    letter-spacing: 0.7px;
}

.top-telemetry-pills {
    display: flex;
    align-items: center;
    gap: 10px;
}

.t-pill {
    background: rgba(23, 36, 64, 0.85);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.76rem;
}

.t-pill-online {
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: #34d399;
    font-weight: 700;
    border-radius: 20px;
    padding: 6px 14px;
}

.t-pill-alert {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: #fbbf24;
    font-weight: 700;
    border-radius: 20px;
    padding: 6px 14px;
}

.pulse-green {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.6);
    animation: pulseGlow 2s infinite;
}

.pulse-amber {
    width: 8px;
    height: 8px;
    background: #f59e0b;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(245, 158, 11, 0.7);
    animation: pulseAmber 1.4s infinite;
}

@keyframes pulseGlow {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulseAmber {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.8); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* ==========================================================================
   APP SHELL & SIDEBAR
   ========================================================================== */
.app-shell {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 94px);
}

.left-sidebar {
    width: 235px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px 12px;
    flex-shrink: 0;
}

.operator-card {
    background: linear-gradient(180deg, rgba(25, 38, 66, 0.8) 0%, rgba(12, 20, 38, 0.95) 100%);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    margin-bottom: 14px;
}

.operator-emblem {
    width: 64px;
    height: 64px;
    margin: 0 auto 8px auto;
    filter: drop-shadow(0 4px 12px rgba(245, 158, 11, 0.35));
}

.operator-role {
    font-size: 0.65rem;
    color: var(--gold-polri);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 2px;
}

.operator-name {
    font-size: 0.82rem;
    font-weight: 800;
    color: #ffffff;
}

.operator-nrp {
    font-size: 0.65rem;
    font-weight: 700;
    color: #38bdf8;
    margin-top: 2px;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-btn {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    text-decoration: none;
}

.nav-btn-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.nav-btn.active {
    background: var(--orange-active);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.4);
}

.nav-badge-count {
    font-size: 0.64rem;
    background: rgba(15, 23, 42, 0.45);
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
}

.sidebar-footer {
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    margin-top: 14px;
}

.sidebar-footer-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--gold-polri);
}

.sidebar-footer-sub {
    font-size: 0.64rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.btn-lock-terminal {
    width: 100%;
    background: rgba(220, 38, 38, 0.18);
    border: 1px solid rgba(220, 38, 38, 0.5);
    color: #fca5a5;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-lock-terminal:hover {
    background: #dc2626;
    color: #ffffff;
}

/* ==========================================================================
   MAIN COMMAND STAGE (PUSAT KOMANDO MULTI-UNIT)
   ========================================================================== */
.main-stage {
    flex: 1;
    padding: 14px 18px;
    background: var(--bg-main);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Top 5 National Fleet KPI Cards */
.kpi-strip {
    display: grid;
    grid-template-columns: 1fr 1fr 1.15fr 1fr 1.35fr;
    gap: 12px;
}

.kpi-card {
    border-radius: 10px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.kpi-blue { background: var(--card-blue); }
.kpi-green { background: var(--card-green); }
.kpi-purple { background: var(--card-purple); }
.kpi-orange { background: var(--card-orange); }
.kpi-dispatch {
    background: var(--card-dispatch);
    border: 1px solid rgba(56, 189, 248, 0.4);
    justify-content: space-between;
}

.kpi-icon-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.kpi-info {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 0.66rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.kpi-val {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.kpi-sub {
    font-size: 0.67rem;
    color: rgba(255, 255, 255, 0.88);
}

.btn-hq-broadcast {
    background: linear-gradient(135deg, #f97316 0%, #dc2626 100%);
    border: 1px solid #fdba74;
    color: #ffffff;
    padding: 8px 13px;
    border-radius: 7px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
    transition: all 0.2s;
}

.btn-hq-broadcast:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.6);
}

/* ==========================================================================
   PRIMARY COMMAND ROW: MULTI-UNIT GIS MAP (LEFT) + ALL-UNITS FLEET MATRIX (RIGHT)
   ========================================================================== */
.hq-primary-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 14px;
}

.tactical-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
    flex-wrap: wrap;
}

.panel-head-title {
    font-size: 0.84rem;
    font-weight: 800;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.2px;
}

.pill-select {
    background: #1e293b;
    color: #ffffff;
    border: 1px solid #3b82f6;
    padding: 5px 11px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.pill-select:hover {
    background: #2563eb;
}

.region-filter-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.region-chip {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.69rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.region-chip:hover, .region-chip.active {
    background: rgba(37, 99, 235, 0.3);
    border-color: #38bdf8;
    color: #ffffff;
}

/* Map Viewport */
.map-viewport {
    position: relative;
    height: 360px;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background: #081121;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.map-mode-tactical .leaflet-tile-pane {
    filter: invert(100%) hue-rotate(180deg) brightness(92%) contrast(92%) saturate(120%);
}

.map-overlay-legend {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    z-index: 500;
    background: rgba(9, 14, 28, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.7rem;
}

/* Custom Map Callsign Pin */
.hq-unit-pin {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hq-pin-tag {
    background: rgba(9, 14, 28, 0.92);
    border: 1px solid #38bdf8;
    color: #ffffff;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(0,0,0,0.6);
    margin-bottom: 3px;
}

.hq-pin-tag.warn {
    border-color: #f59e0b;
    background: rgba(69, 26, 3, 0.95);
    color: #fde68a;
}

/* ==========================================================================
   RIGHT PANEL: LIVE MULTI-VEHICLE FLEET MATRIX (SEMUA MOBIL DI LAPANGAN)
   ========================================================================== */
.fleet-matrix-scroll {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 396px;
    overflow-y: auto;
    padding-right: 4px;
}

.fleet-matrix-scroll::-webkit-scrollbar { width: 5px; }
.fleet-matrix-scroll::-webkit-scrollbar-track { background: #0b1222; }
.fleet-matrix-scroll::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.fleet-unit-row {
    background: var(--bg-panel-elevated);
    border: 1px solid var(--border-subtle);
    border-left: 4px solid #10b981;
    border-radius: 9px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.fleet-unit-row.unit-warn {
    border-left-color: #f59e0b;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.08) 0%, rgba(23, 36, 64, 0.95) 35%);
}

.fleet-unit-row:hover, .fleet-unit-row.selected {
    border-color: #38bdf8;
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.2);
}

.fur-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.fur-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fur-name {
    font-size: 0.84rem;
    font-weight: 800;
    color: #ffffff;
}

.fur-plate {
    font-size: 0.65rem;
    background: #0f172a;
    border: 1px solid #334155;
    color: #93c5fd;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.fur-region {
    font-size: 0.7rem;
    color: var(--gold-polri);
    font-weight: 700;
}

.fur-mid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.fur-sensors {
    display: grid;
    grid-template-columns: repeat(5, 1fr) auto;
    gap: 6px;
    align-items: center;
    background: rgba(9, 14, 28, 0.65);
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.fur-s-cell {
    display: flex;
    flex-direction: column;
    font-size: 0.68rem;
}

.fur-s-lbl {
    font-size: 0.58rem;
    color: var(--text-muted);
    font-weight: 700;
}

.fur-s-val {
    font-weight: 800;
    color: #ffffff;
}

.btn-inspect-unit {
    background: rgba(37, 99, 235, 0.25);
    border: 1px solid #3b82f6;
    color: #93c5fd;
    padding: 4px 9px;
    border-radius: 5px;
    font-size: 0.66rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.btn-inspect-unit:hover {
    background: #2563eb;
    color: #ffffff;
}

/* ==========================================================================
   MIDDLE ROW: MULTI-UNIT UAV / DRONE & FLIR SURVEILLANCE WALL (4 LIVE FEEDS) + REMOTE INSPECTOR
   ========================================================================== */
.hq-mid-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 14px;
}

.uav-wall-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.uav-cam-box {
    position: relative;
    height: 118px;
    background: linear-gradient(160deg, #071b26 0%, #0d2e3d 55%, #06151f 100%);
    border-radius: 8px;
    border: 1px solid rgba(56, 189, 248, 0.25);
    overflow: hidden;
    padding: 7px 9px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
}

.uav-cam-box.hotspot-alert {
    border-color: #f59e0b;
    box-shadow: inset 0 0 18px rgba(245, 158, 11, 0.2);
}

.uav-cam-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 3;
    font-size: 0.66rem;
    font-weight: 800;
}

.uav-cam-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 3;
    font-size: 0.63rem;
}

.flir-mini-badge {
    background: linear-gradient(90deg, #dc2626, #ea580c);
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 0.62rem;
}

/* ==========================================================================
   SELECTED UNIT TELEMETRY INSPECTOR (DRILL-DOWN COCKPIT IN HQ)
   ========================================================================== */
.gauges-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 4px 0;
}

.gauge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.gauge-svg {
    width: 96px;
    height: 96px;
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: #1e293b;
    stroke-width: 9;
}

.gauge-fill {
    fill: none;
    stroke-width: 9;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}

.gauge-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gauge-param {
    font-size: 0.58rem;
    color: var(--text-secondary);
    font-weight: 700;
}

.gauge-val {
    font-size: 0.9rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.15;
}

.gauge-unit {
    font-size: 0.54rem;
    font-weight: 700;
}

/* Mini Stepper inside Inspector */
.hq-stepper-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(9, 14, 28, 0.7);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 0.7rem;
}

/* ==========================================================================
   BOTTOM ROW: NATIONAL MULTI-UNIT ALERT STREAM + CROSS-REGIONAL CHART
   ========================================================================== */
.forensic-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.74rem;
}

.forensic-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 700;
    padding: 7px 9px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.68rem;
    text-transform: uppercase;
}

.forensic-table td {
    padding: 8px 9px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    color: #e2e8f0;
}

.status-normal {
    color: #34d399;
    font-weight: 700;
}

.status-warn {
    color: #fbbf24;
    font-weight: 800;
}

.chart-filter-pills {
    display: flex;
    gap: 6px;
}

.chart-pill {
    background: #1e293b;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
}

.chart-pill.active {
    background: #2563eb;
    border-color: #3b82f6;
    color: #ffffff;
}

.cmd-footer {
    height: 28px;
    background: #060911;
    border-top: 1px solid var(--border-subtle);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.cmd-view-section {
    display: none;
    flex-direction: column;
    gap: 14px;
}

.cmd-view-section.active {
    display: flex;
}

/* Modal Dispatch Instruction */
.hq-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(6, 10, 20, 0.8);
    backdrop-filter: blur(6px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.hq-modal-backdrop.open {
    display: flex;
}

.hq-modal-box {
    width: 480px;
    max-width: 92vw;
    background: var(--bg-panel);
    border: 1px solid #38bdf8;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.7);
}

@media (max-width: 1280px) {
    .kpi-strip { grid-template-columns: repeat(3, 1fr); }
    .hq-primary-grid, .hq-mid-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .app-shell { flex-direction: column; }
    .left-sidebar { width: 100%; }
    .kpi-strip { grid-template-columns: 1fr; }
    .top-header { height: auto; padding: 12px; flex-wrap: wrap; gap: 10px; }
}
