/* ========================================
   FIRM D — Mission Control Dashboard
   Corporate, Flat, Data-Dense Design
   Inspired by BurpSuite & Claude Security
   ======================================== */

/* CSS Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette — Corporate Security Theme */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1a202e;
    --border-color: #2d3748;
    --border-subtle: #1e2533;
    
    --text-primary: #f7fafc;
    --text-secondary: #cbd5e0;
    --text-muted: #718096;
    
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    
    --status-ok: #10b981;
    --status-watch: #f59e0b;
    --status-critical: #ef4444;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    
    /* Typography */
    --font-mono: 'SF Mono', 'Consolas', 'Monaco', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ========================================
   TOP NAVIGATION BAR
   ======================================== */

.topnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 64px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.brand-icon {
    font-size: 24px;
    color: var(--accent-cyan);
}

.brand-text {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.brand-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
}

.topnav-tabs {
    display: flex;
    gap: 4px;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--bg-tertiary);
    color: var(--accent-cyan);
}

.topnav-status {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.status-badge.operational {
    border-color: var(--status-ok);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-ok);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.timestamp {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
}

/* ========================================
   KPI HEADER BAR
   ======================================== */

.kpi-header {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.kpi-card {
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
}

.kpi-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
}

.kpi-change {
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.kpi-change.positive {
    color: var(--status-ok);
}

.kpi-change.critical {
    color: var(--status-critical);
}

/* ========================================
   DASHBOARD GRID
   ======================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
    padding: 24px;
    max-width: 1920px;
    margin: 0 auto;
}

/* Panel Layout Assignments */
.panel-engineering { grid-column: span 4; }
.panel-intelligence { grid-column: span 4; }
.panel-security { grid-column: span 4; }
.panel-marketing { grid-column: span 4; }
.panel-operations { grid-column: span 4; }
.panel-activity { grid-column: span 4; }
.panel-chart { grid-column: span 4; }
.panel-nodes { grid-column: span 4; }
.panel-health { grid-column: span 4; }

/* ========================================
   PANEL COMPONENT
   ======================================== */

.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.panel-status {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.panel-status.ok {
    background: rgba(16, 185, 129, 0.15);
    color: var(--status-ok);
    border: 1px solid var(--status-ok);
}

.panel-status.watch {
    background: rgba(245, 158, 11, 0.15);
    color: var(--status-watch);
    border: 1px solid var(--status-watch);
}

.panel-status.critical {
    background: rgba(239, 68, 68, 0.15);
    color: var(--status-critical);
    border: 1px solid var(--status-critical);
}

.panel-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.panel-content {
    padding: 20px;
    flex: 1;
}

/* ========================================
   DATA TABLE
   ======================================== */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table tr {
    border-bottom: 1px solid var(--border-subtle);
}

.data-table tr:last-child {
    border-bottom: none;
}

.data-table td {
    padding: 12px 0;
    font-size: 14px;
}

.data-table .label {
    color: var(--text-secondary);
    font-weight: 500;
}

.data-table .value {
    text-align: right;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
}

.data-table .value.positive {
    color: var(--status-ok);
}

.data-table .value.warning {
    color: var(--status-watch);
}

.data-table .value.critical {
    color: var(--status-critical);
}

/* ========================================
   ACTIVITY STREAM
   ======================================== */

.activity-stream {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.activity-icon.engineering { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.activity-icon.intelligence { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.activity-icon.security { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.activity-icon.marketing { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.activity-icon.operations { background: rgba(245, 158, 11, 0.15); color: var(--accent-orange); }

.activity-content {
    flex: 1;
}

.activity-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

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

/* ========================================
   NODES LIST
   ======================================== */

.nodes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.node-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
}

.node-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.node-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-ok);
}

/* ========================================
   HEALTH GRID
   ======================================== */

.health-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.health-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
}

.health-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.health-status {
    font-size: 12px;
    font-weight: 600;
    color: var(--status-ok);
}

/* ========================================
   CHARTS
   ======================================== */

canvas {
    width: 100% !important;
    max-height: 180px;
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 24px;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-brand {
    font-weight: 600;
    color: var(--text-secondary);
}

.footer-version {
    font-family: var(--font-mono);
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-link {
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--accent-cyan);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1400px) {
    .kpi-header {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .panel-engineering,
    .panel-intelligence,
    .panel-security,
    .panel-marketing,
    .panel-operations,
    .panel-chart {
        grid-column: span 6;
    }
    
    .panel-activity,
    .panel-nodes,
    .panel-health {
        grid-column: span 6;
    }
}

@media (max-width: 768px) {
    .topnav {
        flex-direction: column;
        height: auto;
        padding: 16px;
    }
    
    .topnav-tabs {
        width: 100%;
        overflow-x: auto;
    }
    
    .kpi-header {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        padding: 16px;
    }
    
    .panel-engineering,
    .panel-intelligence,
    .panel-security,
    .panel-marketing,
    .panel-operations,
    .panel-activity,
    .panel-chart,
    .panel-nodes,
    .panel-health {
        grid-column: span 1;
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
