/* ============================================================
   NewcastleTek — Dark Theme
   ============================================================ */

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

/* Author display rules (flex/inline-flex below) otherwise beat the UA
   [hidden] rule, leaving per-model param fields visible regardless of
   the hidden attribute set by syncModelParamVisibility(). */
[hidden] {
    display: none !important;
}

body {
    background: #0a0a0f;
    color: #c0c0c8;
    font-family: 'JetBrains Mono', monospace;
    min-height: 100vh;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #12121a;
}
::-webkit-scrollbar-thumb {
    background: #00ff88;
    border-radius: 4px;
}

/* --- Boot Screen --- */
#boot-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #0a0a0f;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease;
}

.boot-container {
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.boot-logo {
    font-size: 72px;
    margin-bottom: 12px;
    animation: pulse 2s infinite;
}

.boot-title {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: 6px;
    color: #00ff88;
    text-shadow: 0 0 30px rgba(0, 255, 136, 0.3);
}

.boot-subtitle {
    font-size: 12px;
    color: #666;
    letter-spacing: 4px;
    margin-top: 4px;
}

.boot-progress {
    width: 100%;
    height: 3px;
    background: #1a1a2e;
    margin-top: 32px;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: #00ff88;
    transition: width 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.boot-status {
    margin-top: 16px;
    font-size: 13px;
    color: #888;
    font-family: 'JetBrains Mono', monospace;
}

.boot-version {
    margin-top: 24px;
    font-size: 11px;
    color: #333;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.7; }
}

/* --- Main App --- */
#main-app {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* --- Header --- */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(18, 18, 26, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid #1a1a2e;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

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

.ghost-icon {
    font-size: 28px;
}

.brand {
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 1px;
}

.tagline {
    font-size: 10px;
    color: #00ff88;
    letter-spacing: 2px;
    background: rgba(0, 255, 136, 0.1);
    padding: 2px 12px;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 136, 0.2);
}

nav {
    display: flex;
    gap: 8px;
}

nav a {
    color: #888;
    text-decoration: none;
    font-size: 13px;
    padding: 6px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

nav a:hover {
    color: #fff;
    background: #1a1a2e;
}

nav a.active {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
}

.power-meter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #888;
    background: #12121a;
    padding: 4px 16px;
    border-radius: 20px;
    border: 1px solid #1a1a2e;
}

.power-meter #powerValue {
    color: #00ff88;
    font-weight: 700;
}

/* --- Status Bar --- */
.status-bar {
    display: flex;
    gap: 24px;
    padding: 12px 20px;
    background: rgba(18, 18, 26, 0.6);
    border-radius: 10px;
    border: 1px solid #1a1a2e;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.status-item + .status-item {
    border-left: 1px solid #1e1e2e;
    padding-left: 24px;
}

.status-item .label {
    color: #555;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-item .value.online { color: #00ff88; }
.status-item .value.active { color: #ffaa00; }
.status-item .value.secured { color: #00ccff; }

/* --- Monte Carlo Paths Panel --- */
.mc-panel h2 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 14px;
    font-weight: 700;
    color: #e6e6ee;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
    padding-left: 12px;
    border-left: 3px solid #00ff88;
}

.mc-panel .mc-params {
    font-size: 11px;
    color: #555;
    letter-spacing: 1px;
    text-transform: none;
    font-weight: 400;
}

.mc-meta {
    font-size: 10px;
    color: #555;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

#pathsTableWrap {
    max-height: 440px;
    overflow: auto;
    background: #0d0d14;
    border: 1px solid #1a1a2e;
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

#pathsTableWrap::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
#pathsTableWrap::-webkit-scrollbar-track {
    background: #0d0d14;
}
#pathsTableWrap::-webkit-scrollbar-thumb {
    background: #26263a;
    border-radius: 4px;
}
#pathsTableWrap::-webkit-scrollbar-thumb:hover {
    background: #00ff88;
}
#pathsTableWrap::-webkit-scrollbar-corner {
    background: #0d0d14;
}

#pathsTable {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
}

#pathsTable th,
#pathsTable td {
    padding: 5px 10px;
    text-align: right;
    white-space: nowrap;
    color: #9aa0ae;
    border-bottom: 1px solid #131320;
}

#pathsTable thead th {
    position: sticky;
    top: 0;
    background: #12121a;
    color: #00ff88;
    font-weight: 700;
    letter-spacing: 0.5px;
    z-index: 2;
    border-bottom: 1px solid #1e1e2e;
}

#pathsTable th.row-id,
#pathsTable td.row-id {
    position: sticky;
    left: 0;
    background: #12121a;
    color: #6b7280;
    text-align: right;
    z-index: 1;
    border-right: 1px solid #1e1e2e;
}

#pathsTable thead th.row-id {
    z-index: 3;
    color: #00ff88;
}

#pathsTable tbody tr:hover td {
    background: rgba(0, 255, 136, 0.05);
    color: #e4e4ec;
}

/* --- Stats Panel --- */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 16px;
}

.stat-card {
    background: linear-gradient(180deg, #131320 0%, #111118 100%);
    border: 1px solid #1a1a2e;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: #2a2a40;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.stat-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 10px;
    color: #555;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.stat-value {
    font-size: 21px;
    font-weight: 700;
    color: #e8e8f0;
    margin-top: 4px;
    display: block;
    font-variant-numeric: tabular-nums;
}

    .stat-value.active { color: #ffaa00; }
    .stat-value.secured { color: #00ccff; }

    .stat-sub {
        display: block;
        margin-top: 3px;
        font-size: 10px;
        color: #6a6a80;
        font-variant-numeric: tabular-nums;
        min-height: 13px;
    }

    .stat-src {
        display: none;
        margin-top: 3px;
        font-size: 9px;
        letter-spacing: 1px;
        text-transform: uppercase;
        color: #b08330;
        background: rgba(255, 170, 0, 0.08);
        border: 1px solid rgba(255, 170, 0, 0.25);
        border-radius: 4px;
        padding: 1px 5px;
    }

    .stat-src.on { display: inline-block; }


/* --- Compute Test --- */
.compute-test {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.mc-t-control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #94a3b8;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.mc-t-input {
    width: 74px;
    background: rgba(0, 255, 136, 0.06);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: #00ff88;
    border-radius: 6px;
    padding: 9px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

.mc-t-input:focus {
    outline: 2px solid #00ff88;
    outline-offset: 2px;
}

.mc-t-input.invalid {
    border-color: #ff5566;
    background: rgba(255, 60, 90, 0.10);
    color: #ff8899;
}

.mc-t-input.invalid:focus {
    outline-color: #ff5566;
}

.mc-t-error {
    flex-basis: 100%;
    color: #ff5566;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: none;
    text-align: center;
    min-height: 14px;
}

.mc-seed-input {
    width: 116px;
    font-size: 13px;
}

/* --- Model selector + per-model params (ROADMAP item 4) --- */
.compute-test {
    flex-wrap: wrap;
}

.mc-model-select {
    background: rgba(0, 255, 136, 0.06);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: #00ff88;
    border-radius: 6px;
    padding: 9px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.mc-model-select:focus {
    outline: 2px solid #00ff88;
    outline-offset: 2px;
}

.mc-model-select option {
    background: #0b1110;
    color: #00ff88;
}

.mc-model-params {
    flex-basis: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #94a3b8;
    letter-spacing: 0.5px;
}

.mc-model-params .mp {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mc-model-params label {
    color: #94a3b8;
    text-transform: none;
    min-width: 42px;
    text-align: right;
}

.mc-model-params .mc-t-input {
    width: 84px;
}

.test-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.4);
}

.test-btn {
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
    padding: 12px 32px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.test-btn:hover {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00ff88;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.2);
}

.test-btn:active {
    transform: translateY(0);
}

.test-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.test-btn:focus-visible,
.export-btn:focus-visible {
    outline: 2px solid #00ff88;
    outline-offset: 2px;
}

.test-btn.batch {
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
}

.test-btn.batch:hover {
    background: rgba(0, 255, 136, 0.2);
}

.test-btn.parallel {
    border-color: #ff8800;
    background: rgba(255, 136, 0, 0.1);
    color: #ff8800;
}

.test-btn.parallel:hover {
    background: rgba(255, 136, 0, 0.2);
    border-color: #ff8800;
    box-shadow: 0 4px 20px rgba(255, 136, 0, 0.2);
}

/* --- Export Section --- */
.export-section {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.export-btn {
    padding: 10px 20px;
    border: 1px solid #444;
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    transition: all 0.2s;
}

.export-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #00ff88;
    color: #00ff88;
}

/* --- Console Panel --- */
.console-panel {
    background: #0a0a10;
    border: 1px solid #1a1a2e;
    border-radius: 12px;
    overflow: hidden;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #111118;
    border-bottom: 1px solid #1a1a2e;
    font-size: 12px;
    color: #666;
}

.console-header button {
    background: none;
    border: none;
    color: #444;
    cursor: pointer;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    transition: color 0.2s;
}

.console-header button:hover {
    color: #fff;
}

.console-body {
    padding: 12px 16px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.8;
    color: #888;
    font-family: 'JetBrains Mono', monospace;
}

.console-body .log-entry {
    border-bottom: 1px solid #0d0d14;
    padding: 2px 0;
}

.console-body .log-entry .time {
    color: #444;
    margin-right: 12px;
}

.console-body .log-entry .msg-info { color: #888; }
.console-body .log-entry .msg-success { color: #00ff88; }
.console-body .log-entry .msg-warning { color: #ffaa00; }
.console-body .log-entry .msg-error { color: #ff4444; }

/* --- Responsive --- */
@media (max-width: 768px) {
    header {
        flex-wrap: wrap;
        gap: 12px;
    }
    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
    }
    .boot-title {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .stats-panel {
        grid-template-columns: 1fr 1fr;
    }
    .status-bar {
        flex-wrap: wrap;
        gap: 8px;
    }
}
