@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans+Condensed:wght@400;500&display=swap');

/* ========================================
   namu.systems - Anti-Design Dashboard
   ======================================== */

:root {
    --canvas-white: #F7FAFC;
    --border-gray: #E2E8F0;
    --emphasis-gray: #CBD5E0;
    --text-gray: #718096;
    --dark-gray: #2D3748;
    --steel: #4A5568;
    --system-red: #F56565;
    --system-green: #48BB78;
    --system-blue: #4299E1;
}

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

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

body {
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    background: var(--canvas-white);
    color: var(--text-gray);
    font-size: 11px;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

/* ========================================
   Bokeh Background
   ======================================== */

.bokeh-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bokeh-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(20px);
    animation: bokehDrift 25s ease-in-out infinite alternate;
}

@keyframes bokehDrift {
    0% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(15px, -10px);
    }
    50% {
        transform: translate(-8px, 12px);
    }
    75% {
        transform: translate(10px, 5px);
    }
    100% {
        transform: translate(-5px, -8px);
    }
}

/* ========================================
   Header Bar
   ======================================== */

.header-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--canvas-white);
    border-bottom: 1px solid var(--steel);
    z-index: 100;
}

.header-domain {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--dark-gray);
    letter-spacing: 0.05em;
}

.header-status {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--dark-gray);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.05em;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.status-online {
    background: var(--system-green);
}

/* ========================================
   Left Navigation Panel
   ======================================== */

.left-nav {
    position: fixed;
    top: 48px;
    left: 0;
    width: 120px;
    height: calc(100% - 48px);
    background: var(--canvas-white);
    border-right: 1px solid var(--steel);
    display: flex;
    flex-direction: column;
    padding-top: 16px;
    z-index: 90;
    overflow-y: auto;
}

.nav-item {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 7px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-gray);
    text-decoration: none;
    padding: 10px 12px 10px 14px;
    border-left: 2px solid transparent;
    cursor: pointer;
    transition: border-color 200ms ease, color 200ms ease;
    display: block;
}

.nav-item:hover {
    color: var(--dark-gray);
}

.nav-item.active {
    border-left-color: var(--system-blue);
    color: var(--dark-gray);
}

/* ========================================
   Dashboard Grid
   ======================================== */

.dashboard-grid {
    position: relative;
    margin-top: 48px;
    margin-left: 120px;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(60px, auto);
    gap: 0;
    z-index: 1;
    min-height: calc(100vh - 48px);
}

/* ========================================
   Panel Base Styles
   ======================================== */

.panel {
    background: #FFFFFF;
    border-right: 1px solid var(--steel);
    border-bottom: 1px solid var(--steel);
    padding: 16px;
    position: relative;
    transition: border-color 200ms ease;
    overflow: hidden;
}

.panel:hover {
    border-color: var(--system-blue);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.panel-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    line-height: 1.1;
    color: var(--dark-gray);
}

.panel-id {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 400;
    color: var(--emphasis-gray);
    letter-spacing: 0.05em;
}

.panel-divider {
    width: 100%;
    height: 1px;
    background: var(--border-gray);
    margin-top: 4px;
    margin-bottom: 8px;
}

.panel-body {
    position: relative;
}

/* ========================================
   Panel Grid Positions
   ======================================== */

.panel-primary {
    grid-column: 1 / 9;
    grid-row: 1 / 6;
}

.panel-secondary {
    grid-column: 9 / 13;
    grid-row: 1 / 4;
}

.panel-tertiary {
    grid-column: 9 / 13;
    grid-row: 4 / 6;
}

.panel-topology {
    grid-column: 1 / 7;
    grid-row: 6 / 10;
}

.panel-logs {
    grid-column: 7 / 13;
    grid-row: 6 / 10;
}

.panel-analysis {
    grid-column: 1 / 5;
    grid-row: 10 / 13;
}

.panel-network {
    grid-column: 5 / 9;
    grid-row: 10 / 13;
}

.panel-status {
    grid-column: 9 / 13;
    grid-row: 10 / 13;
}

/* ========================================
   Loading States
   ======================================== */

.panel-loading {
    display: flex;
    align-items: center;
    gap: 4px;
}

.panel-loading[data-loading="false"] {
    display: none;
}

.loading-block {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--emphasis-gray);
    letter-spacing: 0.05em;
}

.loading-block::after {
    content: '\2588 \2590 \2588\2588 \258C \2580\2588\2588';
    animation: loadingCycle 500ms steps(4) infinite;
}

@keyframes loadingCycle {
    0% { opacity: 0.3; }
    25% { opacity: 0.6; }
    50% { opacity: 0.9; }
    75% { opacity: 0.6; }
    100% { opacity: 0.3; }
}

.panel-content[data-loaded="false"] {
    opacity: 0;
    display: none;
}

.panel-content[data-loaded="true"] {
    opacity: 1;
    display: block;
    animation: contentFadeIn 400ms ease forwards;
}

@keyframes contentFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   Body Text
   ======================================== */

.body-text {
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.2;
    color: var(--text-gray);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

/* ========================================
   Data Tables
   ======================================== */

.data-table {
    margin-top: 8px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-gray);
}

.data-row:last-child {
    border-bottom: none;
}

.data-label {
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-gray);
}

.data-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 400;
    line-height: 1;
    color: var(--dark-gray);
}

/* ========================================
   SVG Diagrams
   ======================================== */

.svg-diagram {
    width: 100%;
    height: auto;
    margin-top: 12px;
}

.topology-svg {
    max-height: 280px;
}

.svg-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 8px;
    font-weight: 600;
    fill: var(--text-gray);
    letter-spacing: 0.1em;
}

.svg-label-small {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 7px;
    font-weight: 400;
    fill: var(--emphasis-gray);
}

.draw-line {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.5s ease;
}

.draw-line.drawn {
    stroke-dashoffset: 0;
}

.draw-node {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.draw-node.visible {
    opacity: 1;
}

/* ========================================
   Subsystem List
   ======================================== */

.subsystem-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.subsystem-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-gray);
}

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

.subsystem-status {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

.subsystem-status.status-online {
    background: var(--system-green);
}

.subsystem-status.status-warning {
    background: var(--system-red);
}

.subsystem-name {
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    font-size: 10px;
    font-weight: 500;
    color: var(--dark-gray);
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.subsystem-code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 400;
    color: var(--emphasis-gray);
}

/* ========================================
   Metrics Grid
   ======================================== */

.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding-top: 4px;
}

.metric-item {
    text-align: center;
    padding: 8px 0;
}

.metric-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 24px;
    font-weight: 600;
    color: var(--dark-gray);
    line-height: 1;
}

.metric-unit {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 400;
    color: var(--emphasis-gray);
    margin-left: 1px;
}

.metric-label {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-gray);
    margin-top: 4px;
}

/* ========================================
   Log Entries
   ======================================== */

.log-entries {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 260px;
    overflow-y: auto;
}

.log-entry {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 3px 0;
    border-bottom: 1px solid var(--border-gray);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 400;
    color: var(--emphasis-gray);
    flex-shrink: 0;
    width: 55px;
}

.log-level {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.1em;
    flex-shrink: 0;
    width: 35px;
    text-align: center;
}

.log-level.log-info {
    color: var(--system-blue);
}

.log-level.log-warn {
    color: var(--system-red);
}

.log-level.log-ok {
    color: var(--system-green);
}

.log-msg {
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    font-size: 10px;
    font-weight: 400;
    color: var(--text-gray);
    line-height: 1.3;
}

/* ========================================
   Network Bars
   ======================================== */

.network-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 4px;
}

.network-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bar-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-gray);
    width: 60px;
    flex-shrink: 0;
}

.bar-track {
    flex: 1;
    height: 4px;
    background: var(--border-gray);
    position: relative;
}

.bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--steel);
    transition: width 1s ease;
}

.bar-fill-warn {
    background: var(--system-red);
}

.bar-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 400;
    color: var(--dark-gray);
    width: 50px;
    text-align: right;
    flex-shrink: 0;
}

/* ========================================
   Status Grid
   ======================================== */

.status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding-top: 4px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-indicator.status-online {
    background: var(--system-green);
}

.status-indicator.status-warning {
    background: var(--system-red);
}

.status-name {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--dark-gray);
}

/* ========================================
   Click Highlight Effect
   ======================================== */

.panel.click-highlight {
    border: 2px solid var(--system-blue);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 1024px) {
    .left-nav {
        width: 80px;
    }

    .nav-item {
        font-size: 6px;
        padding: 8px 8px 8px 10px;
    }

    .dashboard-grid {
        margin-left: 80px;
    }
}

@media (max-width: 768px) {
    .left-nav {
        display: none;
    }

    .dashboard-grid {
        margin-left: 0;
        grid-template-columns: 1fr;
    }

    .panel-primary,
    .panel-secondary,
    .panel-tertiary,
    .panel-topology,
    .panel-logs,
    .panel-analysis,
    .panel-network,
    .panel-status {
        grid-column: 1 / -1;
        grid-row: auto;
    }
}
