/* ==========================================================
   NEO99 :: GRID — Cyberpunk Operator Console
   Pass 2: Layout shell + xterm.js terminal integration
   Operator: CygnusWildstar
   ========================================================== */

/* ---- Design tokens ---- */
:root {
    /* Palette — TRON Legacy cyan */
    --cyan:           #00ffff;
    --cyan-bright:    #4dffff;
    --cyan-dim:       #008888;
    --cyan-deep:      #003333;
    --green:          #00ff99;
    --amber:          #ffaa00;        /* reserved for warnings */
    --red:            #ff3355;        /* reserved for errors */

    --bg-base:        #000308;        /* almost-black with a hint of blue */
    --bg-panel:       #02090f;
    --bg-panel-hi:    #061218;

    --border:         rgba(0, 255, 255, 0.35);
    --border-bright:  rgba(0, 255, 255, 0.7);

    --glow-sm:        0 0 4px rgba(0, 255, 255, 0.5);
    --glow-md:        0 0 8px rgba(0, 255, 255, 0.6);
    --glow-lg:        0 0 16px rgba(0, 255, 255, 0.5);

    /* Typography */
    --font-mono:      'Courier New', 'Consolas', 'Monaco', monospace;
    --font-display:   'Courier New', 'Consolas', 'Monaco', monospace;
}

/* ---- Reset / base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg-base);
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.4;
    text-shadow: var(--glow-sm);
    -webkit-font-smoothing: antialiased;
}

/* ---- Scanline overlay (subtle CRT effect) ---- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 255, 255, 0.03) 0px,
        rgba(0, 255, 255, 0.03) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 9999;
}

/* ---- Vignette (darken edges) ---- */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 50%,
        rgba(0, 0, 0, 0.5) 100%
    );
    pointer-events: none;
    z-index: 9998;
}

/* ==========================================================
   LAYOUT
   ========================================================== */

.grid-shell {
    display: grid;
    grid-template-rows: 40px 1fr 220px 28px;     /* added 160px row for lightcycle */
    grid-template-columns: 1fr;
    height: 100vh;
    width: 100vw;
}

/* ---- Top status bar ---- */
.bar-top {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 13px;
}

.bar-top .brand {
    color: var(--cyan-bright);
    font-weight: bold;
    letter-spacing: 0.3em;
}

.bar-top .operator {
    color: var(--cyan);
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 1.5em;
}

.bar-top .github-link {
    color: var(--cyan-dim);
    text-decoration: none;
    font-size: 12px;
    letter-spacing: 0.15em;
    transition: color 150ms ease, text-shadow 150ms ease;
}

.bar-top .github-link:hover {
    color: var(--cyan-bright);
    text-shadow: var(--glow-md);
}

.bar-top .github-link::before {
    content: '◆ ';
    color: var(--cyan-dim);
}

.bar-top .operator .label {
    color: var(--cyan-dim);
    margin-right: 0.5em;
}

/* ---- Bottom status bar ---- */
.bar-bottom {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    padding: 0 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg-panel);
    font-size: 12px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.bar-bottom .stat {
    color: var(--cyan);
}

.bar-bottom .stat .label {
    color: var(--cyan-dim);
    margin-right: 0.5em;
}

.bar-bottom .stat .value {
    color: var(--green);
}

/* ---- Main content area ---- */
.main {
    display: grid;
    grid-template-columns: 1fr 560px;        /* wider news column */
    grid-template-rows: 1fr;
    grid-row: 2 / 3;                          /* main occupies row 2 only */
    gap: 1px;
    background: var(--border);
    overflow: hidden;
}

/* ---- Terminal pane (left) ---- */
.terminal-pane {
    background: var(--bg-base);
    padding: 1rem;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 11px;
    color: var(--cyan-dim);
    flex-shrink: 0;
}

.pane-header .title {
    color: var(--cyan-bright);
}

.pane-header .indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    animation: pulse 2s ease-in-out infinite;
}

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

/* ---- xterm.js terminal container ---- */
#terminal {
    flex: 1;
    width: 100%;
    background: var(--bg-base);
    min-height: 0;          /* allows flex child to actually shrink */
}

/* Override xterm's default focus outline — we don't want a browser outline */
.xterm:focus,
.xterm-screen:focus,
.xterm:focus .xterm-screen {
    outline: none !important;
}

/* xterm's viewport — match scrollbar to our theme */
.xterm-viewport::-webkit-scrollbar {
    width: 8px;
}
.xterm-viewport::-webkit-scrollbar-track {
    background: var(--bg-base);
}
.xterm-viewport::-webkit-scrollbar-thumb {
    background: var(--cyan-deep);
}
.xterm-viewport::-webkit-scrollbar-thumb:hover {
    background: var(--cyan-dim);
}

/* Small breathing room inside the xterm canvas */
.xterm {
    padding: 4px;
}

/* ---- Feed pane (right) ---- */
.feed-pane {
    background: var(--bg-base);
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.feed-card {
    border: 1px solid var(--border);
    background: var(--bg-panel);
    overflow: hidden;
}

.feed-card .card-header {
    padding: 0.4rem 0.75rem;
    background: var(--bg-panel-hi);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 11px;
    color: var(--cyan-bright);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.feed-card .card-header .source {
    color: var(--cyan-bright);
}

.feed-card .card-header .count {
    color: var(--cyan-dim);
    font-size: 10px;
}

.feed-card .card-body {
    padding: 0.5rem 0.75rem;
    font-size: 12px;
    line-height: 1.5;
}

.feed-item {
    padding: 0.4rem 0;
    border-bottom: 1px dashed rgba(0, 255, 255, 0.15);
    color: var(--cyan);
    cursor: pointer;
    transition: color 150ms ease, text-shadow 150ms ease;
}

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

.feed-item:hover {
    color: var(--cyan-bright);
    text-shadow: var(--glow-md);
}

.feed-item .meta {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    color: var(--cyan-dim);
}

/* ==========================================================
   LIGHTCYCLE ARENA
   ========================================================== */

.lightcycle-pane {
    background: var(--bg-base);
    border-top: 1px solid var(--border);
    padding: 0.5rem 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    grid-row: 3 / 4;                    /* third row of grid-shell */
    grid-column: 1 / 2;                 /* spans just the left side */
    width: calc(100vw - 560px - 1px);   /* matches the terminal pane width */
    box-sizing: border-box;
    cursor: crosshair;
    transition: background 150ms ease;
}

.lightcycle-pane.focused {
    background: var(--bg-panel);
    box-shadow: inset 0 0 12px rgba(0, 255, 255, 0.15);
}

.lightcycle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--cyan-dim);
    margin-bottom: 0.25rem;
    flex-shrink: 0;
}

.lightcycle-header .lc-title {
    color: var(--cyan-dim);
}

.lightcycle-header .lc-controls {
    color: var(--cyan-dim);
    font-size: 10px;
    letter-spacing: 0.1em;
}

.lightcycle-header .lc-controls kbd {
    display: inline-block;
    padding: 0 4px;
    margin: 0 1px;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--bg-panel-hi);
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 10px;
}

.lightcycle-header .lc-score {
    color: var(--cyan);
}

.lightcycle-header .lc-score .p1 {
    color: var(--cyan-bright);
}

.lightcycle-header .lc-score .cpu {
    color: #ff66cc;
}

#lightcycle-arena {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.05;
    letter-spacing: 0;
    color: var(--cyan);
    white-space: pre;
    overflow: hidden;
    flex: 1;
    user-select: none;
}

/* Bottom bar now sits in row 4 */
.bar-bottom {
    grid-row: 4 / 5;
}
/* ==========================================================
   FEED PANE — scrollbar styling (Pass 4 refinement)
   ========================================================== */

.feed-pane {
    min-height: 0;                       /* allows the pane to actually scroll inside grid */
}

.feed-pane::-webkit-scrollbar {
    width: 8px;
}
.feed-pane::-webkit-scrollbar-track {
    background: var(--bg-panel);
}
.feed-pane::-webkit-scrollbar-thumb {
    background: var(--cyan-deep);
    border-radius: 4px;
}
.feed-pane::-webkit-scrollbar-thumb:hover {
    background: var(--cyan-dim);
}

/* Pass 4 final — proper monospace + tight line-height for clean trails */
#lightcycle-arena {
    font-family: "Cascadia Code", "Consolas", "DejaVu Sans Mono", "Courier New", monospace !important;
    line-height: 1.15 !important;
    letter-spacing: 0 !important;
    font-variant-ligatures: none;
    font-feature-settings: "kern" 0;       /* disable kerning */
    text-rendering: optimizeSpeed;          /* don't get clever with monospace */
    white-space: pre;
}


/* ==========================================================
   Per-feed scrolling (Phase 5 polish)
   Each feed card body gets its own scrollable area so users
   can scroll within one feed without affecting others.
   ========================================================== */
.feed-card .card-body {
    max-height: 180px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}
.feed-card .card-body::-webkit-scrollbar {
    width: 6px;
}
.feed-card .card-body::-webkit-scrollbar-track {
    background: transparent;
}
.feed-card .card-body::-webkit-scrollbar-thumb {
    background: var(--cyan-deep);
    border-radius: 3px;
}
.feed-card .card-body::-webkit-scrollbar-thumb:hover {
    background: var(--cyan-dim);
}
/* Firefox scrollbar styling */
.feed-card .card-body {
    scrollbar-width: thin;
    scrollbar-color: var(--cyan-deep) transparent;
}

/* ==========================================================
   System Telemetry panel (Phase 5)
   A live readout of deploy metadata, runtime, region, uptime.
   Styled as a feed card so it sits naturally with the others.
   ========================================================== */
.sysinfo-card .card-body.sysinfo-body {
    max-height: none;                    /* fixed-content panel, no scroll needed */
    overflow: visible;
    padding: 0.25rem 0;
}
.sysinfo-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 3px 0;
    font-family: var(--font-mono);
    font-size: 11px;
    border-bottom: 1px dashed rgba(0, 255, 255, 0.08);
}
.sysinfo-row:last-child {
    border-bottom: none;
}
.sysinfo-key {
    color: var(--cyan-dim);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    flex-shrink: 0;
    min-width: 90px;
}
.sysinfo-val {
    color: var(--cyan);
    text-align: right;
    word-break: break-all;
    padding-left: 0.5rem;
}
.sysinfo-val a {
    color: var(--cyan-bright);
    text-decoration: none;
    border-bottom: 1px dotted var(--cyan-dim);
}
.sysinfo-val a:hover {
    color: var(--cyan-bright);
    border-bottom-color: var(--cyan-bright);
}
