/* SpeyTech Inference Dashboard - Terminal Aesthetic */

:root {
    --bg-primary: #0a0a0a;
    --bg-panel: #1a1a1a;
    --bg-header: #2a2a2a;
    --border-color: #333;
    --text-primary: #00ff88;
    --text-cyan: #00ffff;
    --text-orange: #ff6600;
    --text-red: #ff4444;
    --text-dim: #666;
    --text-label: #888;
    --accent: #00ff88;
}

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

body {
    font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, #0f1a0f 0%, #1a1a1a 100%);
    border: 2px solid var(--accent);
    border-radius: 4px;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.header-title h1 {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.header-subtitle {
    font-size: 12px;
    color: var(--text-dim);
    margin-left: 20px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 25px;
}

.frame-counter, .uptime {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-label);
}

.live-dot {
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 10px var(--text-primary); }
    50% { opacity: 0.5; box-shadow: 0 0 5px var(--text-primary); }
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 280px 180px 280px 1fr;
    grid-template-rows: auto auto auto;
    gap: 15px;
    flex: 1;
}

/* Panels */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.panel-header {
    background: var(--bg-header);
    padding: 8px 12px;
    font-size: 11px;
    color: var(--text-label);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-content {
    padding: 12px;
}

/* Panel Positioning */
.input-panel {
    grid-column: 1;
    grid-row: 1 / 3;
}

.kernel-panel {
    grid-column: 2;
    grid-row: 1;
}

.output-panel {
    grid-column: 3;
    grid-row: 1 / 3;
}

.timing-panel {
    grid-column: 4;
    grid-row: 1 / 3;
}

.sparkline-panel {
    grid-column: 1 / 3;
    grid-row: 3;
}

.status-panel {
    grid-column: 3;
    grid-row: 3;
}

.ops-panel {
    grid-column: 4;
    grid-row: 3;
}

/* ASCII Display */
.ascii-display {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre;
    color: var(--text-dim);
}

.kernel-display {
    font-size: 13px;
    color: var(--text-primary);
    text-align: center;
}

/* Pattern Info */
.pattern-info {
    margin-top: 15px;
    font-size: 11px;
}

.pattern-info > div {
    margin-bottom: 6px;
}

.progress-bar {
    height: 6px;
    background: #222;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--text-primary);
    border-radius: 3px;
    transition: width 0.1s linear;
}

/* Kernel Info */
.kernel-info {
    margin-top: 15px;
    font-size: 11px;
}

/* Edge Stats */
.edge-stats {
    margin-top: 15px;
    font-size: 11px;
}

.edge-stats > div {
    margin-bottom: 4px;
}

.legend {
    margin-top: 15px;
    font-size: 11px;
    display: flex;
    gap: 15px;
}

/* Stat Rows */
.stat-row {
    display: flex;
    align-items: baseline;
    margin-bottom: 8px;
    font-size: 12px;
}

.stat-row .label {
    flex: 1;
}

.stat-row .value {
    margin-right: 10px;
}

.stat-row.highlight .value {
    font-size: 14px;
}

.stat-divider {
    height: 1px;
    background: var(--border-color);
    margin: 12px 0;
}

/* Status Rows */
.status-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12px;
}

.status-row .label {
    flex: 1;
}

.status-row .value {
    margin-right: 10px;
}

.status-row .value.small {
    font-size: 10px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.good {
    background: var(--text-primary);
    box-shadow: 0 0 6px var(--text-primary);
}

/* Status Badge */
.status-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

.status-badge.good {
    background: rgba(0, 255, 136, 0.2);
    color: var(--text-primary);
    border: 1px solid var(--text-primary);
}

.status-badge.warn {
    background: rgba(255, 170, 0, 0.2);
    color: #ffaa00;
    border: 1px solid #ffaa00;
}

/* Distribution Bar */
.distribution {
    margin-top: 15px;
}

.dist-bar {
    display: flex;
    height: 20px;
    background: #222;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.dist-main {
    background: var(--text-primary);
    transition: width 0.3s ease;
}

.dist-p99 {
    background: var(--text-cyan);
    transition: width 0.3s ease;
}

.dist-max {
    background: var(--text-red);
    transition: width 0.3s ease;
}

.dist-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-dim);
    margin-top: 4px;
    padding: 0 5px;
}

/* Sparkline */
.sparkline-container {
    position: relative;
    height: 120px;
}

#sparkline-canvas {
    width: 100%;
    height: 100%;
}

.y-axis {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 45px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-dim);
    padding: 5px 0;
    text-align: right;
    padding-right: 5px;
}

/* Labels and Values */
.label {
    color: var(--text-label);
}

.label-small {
    font-size: 10px;
    color: var(--text-dim);
}

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

.cyan {
    color: var(--text-cyan) !important;
}

.orange {
    color: var(--text-orange) !important;
}

.dim {
    color: var(--text-dim) !important;
}

/* Footer */
.footer {
    background: var(--bg-header);
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 11px;
    color: var(--text-label);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.separator {
    color: var(--border-color);
}

.footer-right {
    margin-left: auto;
}

.footer a {
    color: var(--text-primary);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }
    
    .input-panel { grid-column: 1; grid-row: 1; }
    .kernel-panel { grid-column: 2; grid-row: 1; }
    .output-panel { grid-column: 1; grid-row: 2; }
    .timing-panel { grid-column: 2; grid-row: 2; }
    .sparkline-panel { grid-column: 1 / 3; grid-row: 3; }
    .status-panel { grid-column: 1; grid-row: 4; }
    .ops-panel { grid-column: 2; grid-row: 4; }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .header-status {
        justify-content: center;
    }
    
    .header-subtitle {
        margin-left: 0;
        display: block;
        margin-top: 5px;
    }
    
    .footer {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .footer-right {
        margin-left: 0;
        width: 100%;
        text-align: center;
        margin-top: 10px;
    }
}

/* Scanline effect (subtle) */
.container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03) 0px,
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 1000;
}
