@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;700&display=swap');

:root {
    --bg-base: #020202;
    --bg-panel: #050505;
    --bg-panel-hover: #080808;
    --border-color: #1f1f1f;
    --border-active: #333333;
    --cyan: #38bdf8;
    --emerald: #10b981;
    --emerald-dim: rgba(16, 185, 129, 0.2);
    --cyan-dim: rgba(56, 189, 248, 0.2);
    --text-main: #d4d4d4;
    --text-muted: #525252;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-mono);
    height: 100vh;
    overflow: hidden;
}

/* Subtle CRT Scanlines & Scanning Bar */
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(to bottom, transparent 50%, rgba(56, 189, 248, 0.015) 51%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 9998;
}

body::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 15vh;
    background: linear-gradient(to bottom, transparent, rgba(16, 185, 129, 0.03), transparent);
    animation: scan 6s linear infinite;
    pointer-events: none;
    z-index: 9999;
}

@keyframes scan {
    0% {
        transform: translateY(-20vh);
    }

    100% {
        transform: translateY(120vh);
    }
}

/* Layout */
.app-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-rows: 60vh minmax(0, 1fr);
    grid-template-areas:
        "terminal sidebar"
        "bottom sidebar";
    height: 100vh;
    padding: 16px;
    gap: 16px;
    position: relative;
    z-index: 10;
}

/* Panels generic style */
.panel {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background-color: var(--border-active);
    opacity: 0.5;
    transition: background-color 0.3s ease;
}

.panel:hover::before {
    background-color: var(--cyan);
    opacity: 0.8;
}

/* Panel Header */
.panel-header {
    background: #000;
    border-bottom: 1px solid var(--border-color);
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.panel:hover .panel-header {
    color: var(--cyan);
}

.status-indicator {
    color: var(--emerald);
    position: relative;
    padding-left: 12px;
}

.status-indicator::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background-color: var(--emerald);
    box-shadow: 0 0 8px var(--emerald);
    animation: blink 2s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* Terminal Area */
.terminal-panel {
    grid-area: terminal;
}

.terminal-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-line {
    opacity: 0;
    animation: typeLog 0.1s forwards;
}

.log-sys {
    color: var(--text-main);
}

.log-bracket {
    color: var(--text-muted);
}

.log-ok {
    color: var(--emerald);
    text-shadow: 0 0 5px var(--emerald-dim);
}

.log-warn {
    color: #f59e0b;
}

.log-err {
    color: #ef4444;
}

.terminal-input-line {
    padding: 0 16px 16px 16px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
}

.prompt {
    color: var(--cyan);
    margin-right: 8px;
}

#terminal-input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    flex: 1;
    outline: none;
    caret-color: var(--cyan);
}

@keyframes typeLog {
    to {
        opacity: 1;
    }
}

/* Telemetry Sidebar */
.sidebar-panel {
    grid-area: sidebar;
}

.telemetry-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    height: 100%;
}

.metric-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
}

.metric-val {
    color: var(--text-main);
}

.progress-bar-container {
    height: 4px;
    background-color: var(--border-color);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    transition: width 0.3s ease;
}

.cyan-bar {
    background-color: var(--cyan);
    box-shadow: 0 0 10px var(--cyan-dim);
}

.emerald-bar {
    background-color: var(--emerald);
    box-shadow: 0 0 10px var(--emerald-dim);
}

.chart-container {
    height: 40px;
    width: 100%;
    display: flex;
    align-items: flex-end;
    gap: 1px;
}

.chart-bar {
    flex: 1;
    background-color: var(--border-active);
    transition: height 0.2s ease, background-color 0.2s ease;
}

/* Bottom Section Layout */
.bottom-section {
    grid-area: bottom;
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 16px;
}

/* Dropzone Panel */
.dropzone-panel {
    display: flex;
    flex-direction: column;
}

.dropzone-content {
    flex: 1;
    padding: 16px;
    display: flex;
}

.drop-area {
    flex: 1;
    border: 1px dashed var(--border-active);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.01) 0%, rgba(255, 255, 255, 0) 100%);
}

.drop-area:hover,
.drop-area.dragover {
    border-color: var(--cyan);
    background: rgba(56, 189, 248, 0.03);
    box-shadow: inset 0 0 20px var(--cyan-dim);
}

.drop-area.dragover {
    border-style: solid;
}

.drop-area:hover .drop-icon {
    color: var(--cyan);
    transform: translateY(-2px);
}

.drop-icon {
    color: var(--text-muted);
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.drop-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.drop-subtext {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Comparison Dashboard */
.comparison-panel {
    display: flex;
    flex-direction: column;
}

.comparison-content {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.benchmark-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.benchmark-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 400;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.benchmark-table td {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.progress-container .progress-bar {
    height: 4px;
}

.cpu-bar {
    background-color: var(--text-muted);
}

.gpu-bar {
    background-color: var(--emerald);
    box-shadow: 0 0 8px var(--emerald-dim);
}

.progress-container span {
    min-width: 45px;
    text-align: right;
}

.target-name {
    color: var(--text-muted);
}

.highlight {
    color: var(--emerald);
    font-weight: 700;
}

.model-info {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dotted var(--border-color);
    font-size: 0.7rem;
    display: flex;
    gap: 8px;
}

.model-info .label {
    color: var(--text-muted);
}

.model-info .value {
    color: var(--cyan);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-active);
}

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

.sample-data-links {
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
}

.sample-data-links .sample-title {
    color: var(--text-muted);
    font-weight: 700;
}

.sample-data-links button {
    background: transparent;
    border: 1px dashed var(--border-active);
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sample-data-links button:hover {
    border: 1px solid var(--cyan);
    color: var(--cyan);
    background: rgba(56, 189, 248, 0.05);
    box-shadow: 0 0 10px var(--cyan-dim);
}

@keyframes pulseEmerald {
    0% {
        color: var(--emerald);
        text-shadow: 0 0 8px var(--emerald-dim);
        opacity: 1;
    }

    50% {
        color: #fff;
        text-shadow: 0 0 20px var(--emerald);
        opacity: 0.8;
    }

    100% {
        color: var(--emerald);
        text-shadow: 0 0 8px var(--emerald-dim);
        opacity: 1;
    }
}

.pulse-emerald {
    animation: pulseEmerald 0.5s ease-in-out 3;
}