/* mujun.io — Cyberpunk Data-Viz Dashboard */

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

:root {
    --bg-deep: #0a0e17;
    --bg-primary: #0e121b;
    --bg-panel: #1e2a3a;
    --border: #1e3a5a;
    --text-primary: #c8d6e5;
    --text-muted: #6a7a9a;
    --danger: #ff4f5e;
    --success: #2ecc71;
    --warning: #f39c12;
    --info: #4a9eff;
    --text-dim: #8a9ab0;
    --glass-bg: rgba(30, 42, 58, 0.6);
    --glass-border: rgba(30, 58, 90, 0.8);
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.75rem, 0.85vw, 0.9rem);
    line-height: 1.5;
}

/* Status Bar */
#status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 6vh;
    min-height: 36px;
    padding: 0 20px;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border);
}

.status-brand {
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

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

.indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.indicator.active {
    color: var(--success);
}

.indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
}

.indicator-dot.live {
    animation: pulse-live 2s ease-in-out infinite;
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--success); }
    50% { opacity: 0.4; box-shadow: none; }
}

.status-meta {
    display: flex;
    gap: 16px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.timestamp {
    color: var(--text-primary);
    font-weight: 700;
}

/* Dashboard Grid */
#dashboard {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
    height: calc(100vh - 6vh);
}

/* Panel Base */
.panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.3s;
}

.panel:hover {
    border-color: rgba(30, 58, 90, 1);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(30, 58, 90, 0.4);
    flex-shrink: 0;
}

.panel-label {
    font-family: 'Exo 2', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.panel-status {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-status.warning {
    color: var(--warning);
    background: rgba(243, 156, 18, 0.1);
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.panel-status.live-pulse {
    color: var(--success);
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid rgba(46, 204, 113, 0.3);
    animation: pulse-live 2s ease-in-out infinite;
}

.panel-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

/* Panel B: center, spans 2 rows */
.panel-b {
    grid-column: 2;
    grid-row: 1 / 3;
}

/* Panel A: Metrics */
.metric-hero {
    text-align: center;
    margin-bottom: 20px;
}

.metric-value {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: clamp(2.5rem, 4vw, 4rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.metric-unit {
    display: block;
    font-family: 'Exo 2', sans-serif;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 4px;
}

.metric-row {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.metric-item {
    text-align: center;
}

.metric-num {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-desc {
    display: block;
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.warning-text { color: var(--warning); }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }

/* Mini Chart */
.mini-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 60px;
    padding-top: 8px;
}

.chart-bar {
    flex: 1;
    background: var(--border);
    border-radius: 2px 2px 0 0;
    transition: background 0.3s;
}

.chart-bar.active-bar {
    background: var(--info);
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.4);
}

/* Panel B: Graph */
.graph-container {
    position: relative;
    padding: 0;
    overflow: hidden;
}

.graph-node {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    z-index: 2;
    transition: transform 0.2s;
}

.graph-node:hover {
    transform: scale(1.15);
}

.node-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    background: var(--bg-panel);
    flex-shrink: 0;
}

.node-primary .node-dot {
    border-color: var(--info);
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.3);
}

.node-danger .node-dot {
    border-color: var(--danger);
    box-shadow: 0 0 8px rgba(255, 79, 94, 0.4);
    background: rgba(255, 79, 94, 0.2);
}

.node-warning .node-dot {
    border-color: var(--warning);
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.3);
}

.node-success .node-dot {
    border-color: var(--success);
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.3);
}

.node-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-family: 'Exo 2', sans-serif;
}

/* Graph Edges SVG */
.graph-edges {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.edge {
    stroke-width: 0.3;
    fill: none;
}

.edge.valid {
    stroke: var(--success);
    opacity: 0.5;
}

.edge.contradiction {
    stroke: var(--danger);
    stroke-dasharray: 1.5 1;
    opacity: 0.7;
    animation: dash-flow 3s linear infinite;
}

.edge.warning {
    stroke: var(--warning);
    stroke-dasharray: 2 1;
    opacity: 0.5;
}

@keyframes dash-flow {
    to { stroke-dashoffset: -10; }
}

/* Panel C: Feed */
.feed-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
}

.feed-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
    border-radius: 4px;
    background: rgba(14, 18, 27, 0.5);
    border-left: 2px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}

.feed-item:hover {
    background: rgba(30, 42, 58, 0.4);
}

.feed-time {
    font-size: 0.6rem;
    color: var(--text-muted);
    min-width: 55px;
    flex-shrink: 0;
}

.feed-badge {
    font-size: 0.55rem;
    padding: 1px 6px;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    flex-shrink: 0;
}

.feed-badge.danger {
    color: var(--danger);
    background: rgba(255, 79, 94, 0.1);
}

.feed-badge.warning {
    color: var(--warning);
    background: rgba(243, 156, 18, 0.1);
}

.feed-badge.success {
    color: var(--success);
    background: rgba(46, 204, 113, 0.1);
}

.feed-badge.info {
    color: var(--info);
    background: rgba(52, 152, 219, 0.1);
}

.feed-text {
    font-size: 0.7rem;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Panel D: Command */
.command-area {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
}

.command-output {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 12px;
}

.cmd-line {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.cmd-prompt {
    color: var(--success);
    font-weight: 700;
    user-select: none;
}

.cmd-text {
    color: var(--text-primary);
}

.cmd-response {
    padding-left: 16px;
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-bottom: 4px;
}

.command-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

.cmd-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    caret-color: var(--success);
}

.cmd-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Panel E: Status Grid */
.status-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
}

.status-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(14, 18, 27, 0.5);
    border-radius: 4px;
    border: 1px solid rgba(30, 58, 90, 0.3);
    transition: border-color 0.2s;
}

.status-card:hover {
    border-color: var(--border);
}

.status-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.status-icon.success-bg {
    background: rgba(46, 204, 113, 0.15);
    color: var(--success);
}

.status-icon.warning-bg {
    background: rgba(243, 156, 18, 0.15);
    color: var(--warning);
}

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

.status-name {
    font-family: 'Exo 2', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
}

.status-value {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

/* Responsive */
@media (max-width: 1200px) {
    #dashboard {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
        overflow-y: auto;
    }

    .panel-b {
        grid-column: 1 / -1;
        grid-row: auto;
        min-height: 400px;
    }

    html, body {
        overflow: auto;
    }
}

@media (max-width: 768px) {
    #dashboard {
        grid-template-columns: 1fr;
    }

    .panel-b {
        min-height: 350px;
    }

    #status-bar {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 12px;
        gap: 8px;
    }
}
