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

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-card: #151515;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent-red: #ff0000;
    --accent-red-dark: #cc0000;
    --accent-red-glow: rgba(255, 0, 0, 0.3);
    --status-up: #00ff00;
    --status-down: #ff0000;
    --status-unknown: #ffaa00;
    --border: #2a2a2a;
    --progress-bg: #2a2a2a;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(255, 0, 0, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(255, 0, 0, 0.08) 0%, transparent 50%);
    animation: bgPulse 10s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes bgPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.last-update {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

#last-update-time {
    color: var(--accent-red);
    font-weight: 600;
}

.error-message {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid var(--accent-red);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.error-icon {
    font-size: 1.5rem;
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.card h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-weight: 600;
    border-bottom: 2px solid var(--accent-red);
    padding-bottom: 0.5rem;
}

.uptime-display {
    text-align: center;
}

.uptime-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-red);
    margin-bottom: 1.5rem;
}

.load-averages {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
}

.load-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.load-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.load-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.resource-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.resource-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.resource-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resource-name {
    font-weight: 600;
    color: var(--text-primary);
}

.resource-value {
    font-weight: 700;
    color: var(--accent-red);
}

.progress-bar {
    height: 8px;
    background: var(--progress-bg);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-red-dark), var(--accent-red));
    border-radius: 4px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px var(--accent-red-glow);
}

.resource-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.service-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.service-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    transition: background 0.2s ease;
}

.service-item:hover {
    background: #202020;
}

.service-name {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 500;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.active {
    background: var(--status-up);
    box-shadow: 0 0 10px var(--status-up);
}

.status-indicator.running {
    background: var(--status-up);
    box-shadow: 0 0 10px var(--status-up);
}

.status-indicator.inactive {
    background: var(--status-down);
    box-shadow: 0 0 10px var(--status-down);
}

.status-indicator.exited {
    background: var(--status-down);
    box-shadow: 0 0 10px var(--status-down);
}

.status-indicator.unknown {
    background: var(--status-unknown);
    box-shadow: 0 0 10px var(--status-unknown);
}

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

.service-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 1rem;
}

footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .dashboard {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .card {
        padding: 1.5rem;
    }

    .uptime-value {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .card h2 {
        font-size: 1.1rem;
    }

    .uptime-value {
        font-size: 1.5rem;
    }

    .load-averages {
        flex-direction: column;
        gap: 0.5rem;
    }
}
