:root {
    --primary: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #0f172a;
    --card: #1e293b;
    --text: #f8fafc;
    --text-light: #94a3b8;
    --border: #334155;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--dark);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.header-content h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 15px;
}

.subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 25px;
}

/* Summary Cards */
.status-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.summary-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.summary-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border);
}

.summary-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.summary-icon.online {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.summary-icon.offline {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.summary-icon.total {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary);
}

.summary-icon.history {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

.summary-info h3 {
    font-size: 2.2rem;
    margin-bottom: 5px;
    font-weight: 700;
}

.summary-info p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30px 0;
    padding: 20px;
    background: var(--card);
    border-radius: 15px;
    border: 1px solid var(--border);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: scale(1.05);
}

.btn-history {
    background: #8b5cf6;
    color: white;
}

.btn-history:hover {
    background: #7c3aed;
    transform: scale(1.05);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.auto-refresh {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-light);
    font-size: 0.95rem;
}

#countdown {
    color: var(--primary);
    font-weight: bold;
    font-size: 1.1rem;
}

/* Servers Grid */
.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.server-card {
    background: var(--card);
    border-radius: 18px;
    padding: 25px;
    border-left: 6px solid var(--primary);
    transition: all 0.3s;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.server-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.server-card.offline {
    border-left-color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

.server-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.server-name {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.server-name i {
    color: var(--primary);
    margin-right: 10px;
}

.server-host {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: normal;
    font-family: monospace;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.status-online {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-offline {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: var(--success);
}

.status-dot.offline {
    background: var(--danger);
    animation: none;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Metrics */
.server-metrics {
    margin: 20px 0;
}

.metric {
    margin: 20px 0;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.metric-name {
    color: var(--text-light);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.metric-value {
    font-weight: bold;
    color: var(--text);
    font-size: 1rem;
}

.metric-value.uptime-value {
    color: var(--success);
    font-weight: 700;
    font-size: 1.1rem;
}

.metric-description {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 4px;
    font-style: italic;
}

.progress-bar {
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 8px;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.cpu-progress { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.memory-progress { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.storage-progress { background: linear-gradient(90deg, #10b981, #34d399); }

.progress-fill.low { opacity: 0.9; }
.progress-fill.medium { opacity: 1; }
.progress-fill.high { 
    opacity: 1;
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.metric-info {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Server Offline State */
.server-offline {
    text-align: center;
    padding: 30px 20px;
}

.offline-icon {
    font-size: 3rem;
    color: var(--danger);
    margin-bottom: 15px;
}

.offline-message h3 {
    color: var(--danger);
    margin-bottom: 10px;
}

.offline-message p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.offline-time {
    color: var(--danger);
    font-weight: 600;
}

/* Server Footer */
.server-footer {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
    font-size: 0.85rem;
}

.server-footer i {
    margin-right: 5px;
}

.view-history {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.view-history:hover {
    color: #60a5fa;
    text-decoration: underline;
}

/* Last Updated */
.last-updated {
    text-align: center;
    padding: 20px;
    background: var(--card);
    border-radius: 15px;
    margin-top: 30px;
    color: var(--text-light);
    border: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.separator {
    color: var(--border);
    font-weight: bold;
}

#last-updated-time, #next-update-time, #total-checks {
    color: var(--text);
    font-weight: 600;
}

/* Loading */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    color: var(--text-light);
}

.loading i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--primary);
}

/* Error Message */
.error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 15px;
    border: 1px solid var(--danger);
}

.error-message i {
    font-size: 3rem;
    color: var(--danger);
    margin-bottom: 20px;
}

.error-message h3 {
    margin-bottom: 10px;
    color: var(--danger);
}

.error-message p {
    color: var(--text-light);
    margin-bottom: 20px;
}

/* No Servers */
.no-servers {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 2px dashed var(--border);
}

.no-servers i {
    font-size: 3rem;
    color: var(--warning);
    margin-bottom: 20px;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: var(--text-light);
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
}

.footer-note {
    font-size: 0.8rem;
    margin-top: 10px;
    color: var(--text-light);
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 1200px) {
    .servers-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

@media (max-width: 768px) {
    .servers-grid {
        grid-template-columns: 1fr;
    }
    
    .status-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .last-updated {
        flex-direction: column;
        gap: 10px;
    }
    
    .server-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .status-summary {
        grid-template-columns: 1fr;
    }
    
    body {
        padding: 10px;
    }
    
    header {
        padding: 20px;
    }
}