:root {
    --bg-color: #06080f;
    --bg-secondary: #0d1117;
    --card-bg: rgba(255, 255, 255, 0.025);
    --card-border: rgba(255, 255, 255, 0.06);
    --card-hover-border: rgba(56, 189, 248, 0.2);
    --text-main: #e2e8f0;
    --text-muted: #64748b;
    --text-bright: #f8fafc;
    --accent: #38bdf8;
    --accent-purple: #8b5cf6;
    --accent-glow: rgba(56, 189, 248, 0.3);
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --bar-cpu: linear-gradient(90deg, #06b6d4, #8b5cf6);
    --bar-ram: linear-gradient(90deg, #34d399, #059669);
    --bar-swap: linear-gradient(90deg, #fbbf24, #f59e0b);
    --bar-disk: linear-gradient(90deg, #f472b6, #ec4899);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

.background-mesh {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background:
        radial-gradient(ellipse at 10% 20%, rgba(56, 189, 248, 0.08), transparent 40%),
        radial-gradient(ellipse at 90% 80%, rgba(139, 92, 246, 0.08), transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(52, 211, 153, 0.03), transparent 60%);
    z-index: -1;
    animation: pulseBg 15s ease-in-out infinite alternate;
}

@keyframes pulseBg {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.15); opacity: 1; }
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 2rem 1.5rem 1rem;
}

/* === HEADER === */
header { text-align: center; margin-bottom: 2rem; animation: fadeInDown 0.6s ease-out; }

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: -1.5px;
}

h1 span {
    background: linear-gradient(135deg, var(--accent), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 12px var(--accent-glow));
}

.header-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 400;
    margin-bottom: 0.75rem;
}

.header-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.4);
    padding: 0.4rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--card-border);
    font-size: 0.85rem;
    font-weight: 500;
}

.dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.3s;
}

.dot.active {
    background: var(--success);
    box-shadow: 0 0 8px var(--success), 0 0 20px rgba(52, 211, 153, 0.3);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--success); }
    50% { opacity: 0.5; box-shadow: 0 0 16px var(--success); }
}

/* === NODES === */
.nodes-container {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.node-section {
    flex: 1 1 0;
    min-width: 340px;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.node-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.75rem;
    margin-bottom: 0.25rem;
}

.node-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-bright);
}

.node-hostname {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-family: monospace;
}

/* === MAIN GRID (2x2 for CPU/RAM/Swap/Disk) === */
.grid-main {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

/* === INFO GRID (4 columns for Net/Docker/Procs/Uptime) === */
.grid-info {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

/* === CARDS === */
.card {
    padding: 1.25rem;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    animation: fadeInUp 0.5s ease-out backwards;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border-color: var(--card-hover-border);
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
}

.card-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.card-icon {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    flex-shrink: 0;
}

.card-icon-sm {
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    flex-shrink: 0;
}

.card h3 {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.3rem;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-bottom: 0.8rem;
    font-weight: 400;
}

/* === PROGRESS BARS === */
.progress-bar-bg {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-cpu  { background: var(--bar-cpu); }
.bar-ram  { background: var(--bar-ram); }
.bar-swap { background: var(--bar-swap); }
.bar-disk { background: var(--bar-disk); }

/* === SMALL CARDS === */
.card-sm {
    padding: 0.9rem;
}

.card-sm h3 {
    font-size: 0.6rem;
    letter-spacing: 0.8px;
}

.info-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-bright);
    line-height: 1.2;
}

.info-value-sm {
    font-size: 0.9rem;
    font-weight: 600;
}

.info-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === NETWORK STATS === */
.net-stats {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.15rem;
}

.net-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.net-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.net-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-bright);
    font-family: 'Inter', monospace;
}

/* === WIDE CARD (Top Processes) === */
.card-wide {
    padding: 0.9rem 1.25rem;
}

.top-procs {
    font-size: 0.8rem;
    color: var(--text-main);
    font-family: 'Inter', monospace;
    font-weight: 500;
    letter-spacing: 0.2px;
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow-x: auto;
}

/* === FOOTER === */
footer {
    text-align: center;
    padding: 1.5rem 0 0.5rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    opacity: 0.5;
}

/* === ANIMATIONS === */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Animation delay cascading */
.node-section:nth-child(1) .card:nth-child(1) { animation-delay: 0.05s; }
.node-section:nth-child(1) .card:nth-child(2) { animation-delay: 0.1s; }
.node-section:nth-child(1) .card:nth-child(3) { animation-delay: 0.15s; }
.node-section:nth-child(1) .card:nth-child(4) { animation-delay: 0.2s; }
.node-section:nth-child(2) .card:nth-child(1) { animation-delay: 0.1s; }
.node-section:nth-child(2) .card:nth-child(2) { animation-delay: 0.15s; }
.node-section:nth-child(2) .card:nth-child(3) { animation-delay: 0.2s; }
.node-section:nth-child(2) .card:nth-child(4) { animation-delay: 0.25s; }

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .nodes-container { flex-direction: column; align-items: center; }
    .node-section { max-width: 100%; }
}

@media (max-width: 600px) {
    .container { padding: 1rem 0.75rem; }
    h1 { font-size: 1.8rem; }
    .grid-main { grid-template-columns: 1fr; }
    .grid-info { grid-template-columns: repeat(2, 1fr); }
    .value { font-size: 1.6rem; }
    .header-top { flex-direction: column; gap: 0.75rem; }
}
