:root {
    --primary-color: #00ffcc;
    --primary-glow: rgba(0, 255, 204, 0.4);
    --secondary-color: #00bfff;
    --bg-dark: #02050f;
    --panel-bg: rgba(3, 8, 23, 0.85);
    --text-muted: #8ea1bc;
    --text-light: #ffffff;
    --warn-color: #ffbc00;
    --success-color: #00ff66;
    --error-color: #ff4d6a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body, html { width: 100%; height: 100%; overflow: hidden; background-color: var(--bg-dark); font-family: 'Consolas', 'Courier New', monospace; color: var(--primary-color); }

/* Loading Screen */
#loading-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-dark); z-index: 9999; display: flex;
    align-items: center; justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}
#loading-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader { text-align: center; }
.loader-ring {
    width: 60px; height: 60px; margin: 0 auto 20px;
    border: 2px solid rgba(0, 255, 204, 0.1);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px var(--primary-glow);
}
.loader-text {
    font-size: 12px; color: var(--primary-color); letter-spacing: 3px;
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* Data Ticker */
.data-ticker {
    position: fixed; top: 0; left: 0; width: 100%; height: 32px;
    background: linear-gradient(90deg, rgba(0, 255, 204, 0.03), rgba(0, 191, 255, 0.06), rgba(0, 255, 204, 0.03));
    border-bottom: 1px solid rgba(0, 255, 204, 0.15);
    z-index: 100; overflow: hidden;
    display: flex; align-items: center;
}
.ticker-content {
    display: flex; white-space: nowrap;
    animation: ticker 45s linear infinite;
    padding-left: 100%;
}
.ticker-item { color: var(--text-light); font-size: 12px; letter-spacing: 1px; }
.ticker-sep { color: var(--primary-color); margin: 0 15px; opacity: 0.5; }
@keyframes ticker { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

#network-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }

.ui-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2; pointer-events: none;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 40px 30px 20px;
}
.pointer-enable { pointer-events: auto; }

.dashboard-header {
    background: linear-gradient(180deg, rgba(0, 255, 204, 0.08) 0%, rgba(2, 5, 15, 0.9) 100%);
    border: 1px solid rgba(0, 255, 204, 0.25); backdrop-filter: blur(15px);
    padding: 15px 30px; display: flex; justify-content: space-between; align-items: center;
    border-radius: 6px; box-shadow: 0 0 30px rgba(0, 255, 204, 0.1);
}
.header-title h1 {
    font-size: 20px; font-weight: bold; letter-spacing: 2px;
    color: var(--text-light); text-shadow: 0 0 10px var(--primary-glow);
}
.header-title span {
    color: var(--primary-color); font-size: 14px; margin-left: 15px;
    border-left: 2px solid var(--primary-glow); padding-left: 15px; font-weight: normal;
}
.header-status { font-size: 13px; display: flex; align-items: center; gap: 15px; }
.clock { color: var(--text-light); font-size: 13px; letter-spacing: 1px; }
.status-dot {
    width: 8px; height: 8px; background-color: var(--success-color);
    border-radius: 50%; display: inline-block; margin-right: 8px;
    box-shadow: 0 0 10px var(--success-color); animation: blink 1.5s infinite;
}
.fullscreen-btn {
    cursor: pointer; padding: 3px 8px; border: 1px solid rgba(0, 255, 204, 0.3);
    border-radius: 3px; font-size: 11px; transition: all 0.3s ease; color: var(--text-muted);
}
.fullscreen-btn:hover { background: rgba(0, 255, 204, 0.1); color: var(--primary-color); border-color: var(--primary-color); }
@keyframes blink { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; box-shadow: 0 0 15px var(--success-color); } }

.dashboard-main {
    display: flex; justify-content: space-between;
    height: calc(100% - 130px); margin: 15px 0; gap: 18px;
}
.panel {
    background: var(--panel-bg); border: 1px solid rgba(0, 255, 204, 0.15);
    backdrop-filter: blur(12px); border-radius: 6px; padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
    box-shadow: inset 0 0 20px rgba(0, 255, 204, 0.03);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.4s ease;
    max-height: calc(100vh - 200px);
}
.panel:hover { border-color: rgba(0, 255, 204, 0.25); }
.panel.collapsed { transform: scaleY(0.05); pointer-events: none; opacity: 0.3; }
.panel.collapsed .panel-content { opacity: 0; visibility: hidden; height: 0; overflow: hidden; }
.panel-left { width: 340px; display: flex; flex-direction: column; overflow: hidden; }
.panel-center { flex: 1; min-width: 350px; display: flex; flex-direction: column; overflow: hidden; }
.panel-right { width: 400px; display: flex; flex-direction: column; overflow: hidden; }
.panel-header {
    font-size: 14px; font-weight: bold; border-left: 4px solid var(--primary-color);
    padding-left: 10px; color: var(--text-light); display: flex; justify-content: space-between; align-items: center;
}
.panel-header span { color: rgba(0, 255, 204, 0.5); font-size: 10px; font-weight: normal; }
.panel-toggle {
    cursor: pointer; font-size: 10px; color: var(--primary-color); padding: 3px 6px;
    border: 1px solid rgba(0, 255, 204, 0.2); border-radius: 3px;
    transition: all 0.3s ease;
}
.panel-toggle:hover { background: rgba(0, 255, 204, 0.1); }
.panel.collapsed .panel-toggle { transform: rotate(180deg); }
.panel-content {
    display: flex; flex-direction: column; gap: 12px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow: hidden; min-height: 0; flex: 1;
}
.mt-10 { margin-top: 8px; }

.metric-card {
    background: rgba(0, 255, 204, 0.02); border: 1px solid rgba(0, 255, 204, 0.08);
    padding: 10px; border-radius: 4px; transition: all 0.3s ease;
}
.metric-card:hover { border-color: rgba(0, 255, 204, 0.3); background: rgba(0, 255, 204, 0.05); }
.metric-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.metric-name { font-size: 11px; color: var(--text-muted); }
.metric-value { font-size: 16px; font-weight: bold; text-shadow: 0 0 8px var(--primary-glow); }
.status-active { color: var(--success-color); text-shadow: 0 0 8px rgba(0, 255, 102, 0.4); font-size: 14px; }
.progress-track { width: 100%; height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary-color); transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 0 10px var(--primary-color); }
.highlight-fill { background: var(--secondary-color); box-shadow: 0 0 10px var(--secondary-color); }

/* Mini Charts */
.mini-chart-container { display: flex; flex-direction: column; gap: 10px; }
.chart-row {
    display: grid; grid-template-columns: 100px 1fr 50px;
    align-items: center; gap: 10px; padding: 8px;
    background: rgba(0, 255, 204, 0.02); border-radius: 4px;
    border: 1px solid rgba(0, 255, 204, 0.05);
}
.chart-label { font-size: 11px; color: var(--text-muted); }
.chart-value { font-size: 14px; font-weight: bold; color: var(--primary-color); text-align: right; }
.mini-chart {
    display: flex; align-items: flex-end; gap: 3px; height: 35px; padding: 0 5px;
}
.chart-bar {
    flex: 1; background: linear-gradient(180deg, var(--primary-color), rgba(0, 255, 204, 0.3));
    border-radius: 1px 1px 0 0; transition: height 0.5s ease;
    box-shadow: 0 0 4px var(--primary-glow);
}
.chart-bar:hover { background: linear-gradient(180deg, var(--secondary-color), rgba(0, 191, 255, 0.3)); }

/* Health Grid */
.health-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.health-item {
    display: flex; align-items: center; gap: 6px; padding: 8px;
    background: rgba(0, 255, 102, 0.03); border: 1px solid rgba(0, 255, 102, 0.1);
    border-radius: 4px; font-size: 11px; color: var(--text-light);
    transition: all 0.3s ease;
}
.health-item:hover { background: rgba(0, 255, 102, 0.08); border-color: rgba(0, 255, 102, 0.25); }
.health-icon {
    width: 8px; height: 8px; border-radius: 50%;
    box-shadow: 0 0 6px currentColor; animation: blink 2s infinite;
}
.status-ok { background-color: var(--success-color); color: var(--success-color); }
.status-warn { background-color: var(--warn-color); color: var(--warn-color); }
.status-error { background-color: var(--error-color); color: var(--error-color); }

/* Terminal */
.terminal-wrap {
    flex: 1; display: flex; flex-direction: column;
    overflow: hidden;
}
.terminal-container {
    flex: 1 1 0%;
    overflow-y: auto; overflow-x: hidden;
    font-size: 11px !important; line-height: 1.5;
    background: rgba(0,0,0,0.4); border: 1px solid rgba(0,255,204,0.08);
    padding: 10px; border-radius: 4px; scrollbar-width: none;
    box-sizing: border-box;
}
.terminal-container::-webkit-scrollbar { display: none; }
.log-row {
    word-break: break-all;
    animation: slideIn 0.3s ease-out; padding: 2px 0;
}
.log-time { color: #555; }
.log-agent { color: var(--secondary-color); }
.log-text { color: var(--primary-color); }
.log-warn .log-text { color: var(--warn-color); }
.log-info .log-text { color: var(--secondary-color); }
.log-success .log-text { color: var(--success-color); }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }

/* Event Timeline */
.timeline-container {
    max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
    padding: 8px; background: rgba(0, 0, 0, 0.2); border: 1px solid rgba(0, 255, 204, 0.05);
    border-radius: 4px; scrollbar-width: none;
}
.timeline-container::-webkit-scrollbar { display: none; }
.timeline-event {
    display: flex; gap: 10px; align-items: flex-start; padding: 6px 8px;
    background: rgba(0, 255, 204, 0.02); border-radius: 3px;
    border-left: 3px solid var(--primary-color);
    animation: fadeIn 0.4s ease;
}
.timeline-event.event-warn { border-left-color: var(--warn-color); }
.timeline-event.event-success { border-left-color: var(--success-color); }
.timeline-event.event-info { border-left-color: var(--secondary-color); }
.timeline-time { font-size: 10px; color: #555; min-width: 65px; white-space: nowrap; }
.timeline-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.event-warn .timeline-dot { background: var(--warn-color); box-shadow: 0 0 4px var(--warn-color); }
.event-success .timeline-dot { background: var(--success-color); box-shadow: 0 0 4px var(--success-color); }
.event-info .timeline-dot { background: var(--secondary-color); box-shadow: 0 0 4px var(--secondary-color); }
.timeline-msg { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

.dashboard-footer {
    background: var(--panel-bg); border: 1px solid rgba(0, 255, 204, 0.2);
    padding: 12px 30px; display: flex; justify-content: space-between; align-items: center;
    border-radius: 6px; font-size: 12px; color: var(--text-muted);
    backdrop-filter: blur(10px);
}
.title-highlight { color: var(--text-light); font-size: 13px; letter-spacing: 1px; }
.footer-right { display: flex; gap: 10px; }
.cert-tag {
    border: 1px solid rgba(0, 255, 204, 0.4); padding: 3px 8px; font-size: 10px;
    border-radius: 3px; background: rgba(0, 255, 204, 0.08); color: var(--text-light);
    box-shadow: 0 0 5px rgba(0, 255, 204, 0.1); transition: all 0.3s ease;
}
.cert-tag:hover { background: rgba(0, 255, 204, 0.15); border-color: var(--primary-color); }
.website-btn {
    border: 1px solid var(--primary-color); padding: 3px 12px; font-size: 10px;
    border-radius: 3px; background: rgba(0, 255, 204, 0.12); color: var(--primary-color);
    box-shadow: 0 0 8px rgba(0, 255, 204, 0.15); transition: all 0.3s ease;
    text-decoration: none; cursor: pointer; font-family: inherit;
}
.website-btn:hover {
    background: var(--primary-color); color: var(--bg-dark);
    box-shadow: 0 0 15px var(--primary-glow);
}

/* Fullscreen */
body.fullscreen .data-ticker,
body.fullscreen .dashboard-footer { display: none; }
body.fullscreen .ui-container { padding: 20px; }
