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

:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #131b3a;
    --bg-card: #1a2238;
    --text-primary: #e8eaf6;
    --text-secondary: #9fa8da;
    --accent: #7c4dff;
    --accent-hover: #651fff;
    --online: #4caf50;
    --online-glow: rgba(76, 175, 80, 0.3);
    --offline: #f44336;
    --offline-glow: rgba(244, 67, 54, 0.3);
    --border: rgba(255, 255, 255, 0.1);
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-content {
    flex: 1;
    text-align: left;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent) 0%, #b388ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.last-update {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.refresh-btn {
    background: var(--accent);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: var(--accent-hover);
    transform: rotate(180deg);
}

.refresh-btn:active {
    transform: scale(0.95) rotate(180deg);
}

.stats-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
}

.stats-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.status-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.overview-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.overview-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

.overview-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.overview-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.service-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--status-color);
    transition: width 0.3s ease;
}

.service-card:hover::before {
    width: 8px;
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
    border-color: var(--status-color);
}

.service-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.service-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.service-url {
    font-size: 0.85rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.service-url a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

.service-url a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.status-online {
    background: var(--online-glow);
    color: var(--online);
    --status-color: var(--online);
}

.status-online .status-dot {
    background: var(--online);
    box-shadow: 0 0 8px var(--online);
}

.status-unstable {
    background: var(--offline-glow);
    color: var(--offline);
    --status-color: var(--offline);
}

.status-unstable .status-dot {
    background: var(--offline);
    box-shadow: 0 0 8px var(--offline);
}

.status-offline {
    background: var(--offline-glow);
    color: var(--offline);
    --status-color: var(--offline);
}

.status-offline .status-dot {
    background: var(--offline);
    box-shadow: 0 0 8px var(--offline);
}

.service-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.service-metrics {
    display: flex;
    gap: 24px;
    margin-top: 12px;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 700;
}

.uptime-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.uptime-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-note {
    margin-top: 8px;
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-content {
        text-align: center;
    }
    
    .last-update {
        justify-content: center;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
}

/* Skeleton loading animation */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-secondary) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Stats page specific styles */
.stats-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-btn {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.period-select {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.period-select:hover {
    border-color: var(--accent);
}

.period-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.2);
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

.stat-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.stat-content {
    flex: 1;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.chart-container, .chart-container-full {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.chart-container h3, .chart-container-full h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.chart-container-full {
    margin-bottom: 24px;
}

.services-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.service-detail-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service-detail-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

.service-detail-card h3 {
    color: var(--text-primary);
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.service-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .service-detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-nav {
        width: 100%;
        justify-content: space-between;
    }
}

/* Alert notification */
.alert-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(244, 67, 54, 0.4);
    z-index: 9999;
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

.alert-notification strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.alert-notification p {
    margin: 0;
    font-size: 0.95rem;
    opacity: 0.95;
}

.alert-notification.fade-out {
    animation: fadeOut 0.5s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}
