/* monopole.systems - Systems Dashboard */

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

html, body {
    height: 100%;
    background: #0a1a14;
    font-family: 'Inter', sans-serif;
    color: #b8c8c0;
    overflow-x: hidden;
}

/* Grid Overlay */
#grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(74, 230, 138, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 230, 138, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#grid-overlay.visible {
    opacity: 1;
}

/* System Header */
#sys-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background: #0e231a;
    border-bottom: 1px solid #1e3a2e;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

#sys-header.visible {
    transform: translateY(0);
}

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

.sys-name {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: #4ae68a;
    letter-spacing: 0.08em;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ae68a;
    animation: pulse 2s ease-in-out infinite;
}

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

.status-text {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    font-weight: 400;
    color: #4ae68a;
    letter-spacing: 0.08em;
}

.header-right {
    display: flex;
    gap: 24px;
}

.metric {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    color: #5a7a6a;
    letter-spacing: 0.05em;
}

.metric .counter {
    color: #b8c8c0;
}

/* Dashboard */
#dashboard {
    position: relative;
    z-index: 1;
    padding: 72px 24px 24px;
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 16px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 48px);
}

/* Panels */
.panel {
    background: rgba(14, 35, 26, 0.8);
    border: 1px solid #1e3a2e;
    border-radius: 2px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid #1e3a2e;
    background: rgba(14, 35, 26, 0.5);
}

.panel-title {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    font-weight: 700;
    color: #4ae68a;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.panel-status {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    color: #5a7a6a;
    letter-spacing: 0.05em;
}

.pulse-warn {
    color: #e8a44a;
    animation: pulse 1.5s ease-in-out infinite;
}

.panel-content {
    padding: 16px;
}

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

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

.panel-small {
    grid-column: 2;
}

/* Node Graph */
#node-graph {
    width: 100%;
    height: auto;
    max-height: 60vh;
}

.node {
    transition: r 0.2s ease;
}

.node-center {
    filter: drop-shadow(0 0 6px rgba(74, 230, 138, 0.5));
}

.node-label {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    fill: #5a7a6a;
    letter-spacing: 0.1em;
}

.edge {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.5s ease-out;
}

.panel.visible .edge {
    stroke-dashoffset: 0;
}

/* Metrics */
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(30, 58, 46, 0.5);
}

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

.metric-label {
    font-family: 'Inter', sans-serif;
    font-size: clamp(0.75rem, 1.2vw, 0.85rem);
    font-weight: 400;
    color: #5a7a6a;
}

.metric-value {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: #b8c8c0;
}

.metric-value.red { color: #e84a4a; }
.metric-value.warn { color: #e8a44a; }
.metric-value.green { color: #4ae68a; }

/* Timeline */
.timeline-content {
    padding: 24px 16px;
}

.timeline-bar {
    display: flex;
    width: 100%;
    position: relative;
    height: 60px;
    border-bottom: 1px solid #1e3a2e;
}

.timeline-segment {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-left: 12px;
}

.timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ae68a;
    position: absolute;
    bottom: -4px;
}

.warn-dot {
    background: #e8a44a;
}

.active-dot {
    background: #4ae68a;
    animation: pulse 1.5s ease-in-out infinite;
}

.timeline-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    color: #4ae68a;
    letter-spacing: 0.05em;
}

.timeline-event {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    color: #5a7a6a;
    margin-top: 2px;
}

/* Log Panel */
.log-content {
    max-height: 250px;
    overflow-y: auto;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
}

.log-entry {
    padding: 4px 0;
    color: #5a7a6a;
    border-bottom: 1px solid rgba(30, 58, 46, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.log-entry.visible {
    opacity: 1;
}

/* Status Panel */
.status-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.existence-indicator {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
}

.existence-ring {
    width: 100px;
    height: 100px;
    border: 2px solid #e8a44a;
    border-radius: 50%;
    animation: ringPulse 3s ease-in-out infinite;
}

@keyframes ringPulse {
    0%, 100% { transform: scale(1); border-color: #e8a44a; }
    50% { transform: scale(1.05); border-color: #4ae68a; }
}

.existence-label {
    position: absolute;
    font-family: 'Space Mono', monospace;
    font-size: 0.55rem;
    color: #e8a44a;
    text-align: center;
    letter-spacing: 0.08em;
    line-height: 1.4;
}

.theory-confidence {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.conf-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    color: #5a7a6a;
    width: 100%;
}

.conf-bar {
    flex: 1;
    height: 6px;
    background: #1e3a2e;
    border-radius: 3px;
    overflow: hidden;
}

.conf-fill {
    height: 100%;
    background: #4ae68a;
    border-radius: 3px;
    transition: width 1.5s ease-out;
}

.conf-fill.conf-warn {
    background: #e84a4a;
}

.conf-value {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: #4ae68a;
    min-width: 36px;
    text-align: right;
}

.conf-value.warn {
    color: #e84a4a;
}

/* Scanline effect */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(10, 26, 20, 0.1) 2px,
        rgba(10, 26, 20, 0.1) 4px
    );
    pointer-events: none;
    z-index: 200;
}

/* Responsive */
@media (max-width: 768px) {
    #dashboard {
        grid-template-columns: 1fr;
    }

    .panel-large {
        grid-column: 1;
        grid-row: auto;
    }

    .panel-medium {
        grid-column: 1;
    }

    .panel-small {
        grid-column: 1;
    }

    .header-right {
        display: none;
    }

    .timeline-event {
        display: none;
    }
}
