@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #0a0c10;
    --card-bg: rgba(20, 24, 33, 0.8);
    --card-border: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: #8a8f98;
    --status-online: #00d084;
    --status-slow: #f1c40f;
    --status-critical: #e67e22;
    --status-offline: #ff4d4d;
    --status-checking: #f39c12;
    --accent-color: #3498db;
    --glass-blur: blur(10px);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Gradient Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(52, 152, 219, 0.05) 0%, transparent 50%);
    z-index: -1;
}

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

header {
    text-align: center;
    margin-bottom: 50px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 10px;
}

header .stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.stat-value.online { color: var(--status-online); }
.stat-value.total { color: var(--text-primary); }

/* Global Status Pill */
.global-status-container {
    display: flex;
    justify-content: center;
    margin: 20px 0 30px;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 25px;
    background: rgba(0, 208, 132, 0.1);
    border: 1px solid rgba(0, 208, 132, 0.2);
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 500;
}

.status-pill.status-offline {
    background: rgba(255, 77, 77, 0.1);
    border-color: rgba(255, 77, 77, 0.2);
    color: var(--status-offline);
}

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

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    padding: 10px; /* Added padding to prevent tooltips from hitting screen edges */
}

/* Server Card */
.server-card {
    background: var(--card-bg);
    /* backdrop-filter: var(--glass-blur); removed to prevent clipping pseudo-elements like tooltips */
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
    transition: transform 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: visible; /* Explicitly set to visible */
}

/* Add blur back using a separate element if needed, but for now let's prioritize visibility */
.server-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: var(--glass-blur);
    border-radius: 16px;
    z-index: -1;
}

.server-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.1);
    z-index: 100; /* Bring hovered card to front so tooltips aren't covered by neighbors */
}

.card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.server-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.server-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.server-info .timestamp {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
}

.status-online { color: var(--status-online); }
.status-offline { color: var(--status-offline); }
.status-analyzing { color: var(--status-checking); }

/* History Sections */
.history-section {
    margin-top: 15px;
}

.history-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
}

.history-bars {
    display: flex;
    gap: 4px;
    height: 40px;
    margin-bottom: 15px;
    margin-top: 25px; /* Added space for tooltips */
}

.bar {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    transition: background 0.3s ease;
}

.bar.up { background: var(--status-online); }
.bar.slow { background: var(--status-slow); }
.bar.critical { background: var(--status-critical); }
.bar.down { background: var(--status-offline); }

.history-minutes {
    display: flex;
    gap: 2px;
    height: 15px;
    align-items: flex-end;
    margin-top: 25px; /* Added space for tooltips */
}

.tick {
    flex: 1;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1px;
    position: relative;
}

.tick.up { background: var(--status-online); opacity: 0.8; }
.tick.slow { background: var(--status-slow); opacity: 0.8; }
.tick.critical { background: var(--status-critical); opacity: 0.8; }
.tick.down { background: var(--status-offline); opacity: 0.8; }

/* Tooltip */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: pre;
    text-align: center;
    width: auto;
    min-width: max-content;
    z-index: 9999;
    pointer-events: none;
    margin-bottom: 12px;
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow: 0 8px 24px rgba(0,0,0,0.8);
    display: block;
}

.history-range {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Footer */
footer {
    margin-top: 50px;
    padding-bottom: 30px;
    text-align: center;
}

.last-update {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.footer-brand {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Admin Styles */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-danger {
    background: var(--status-offline);
    color: white;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: white;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s;
}

.modal.active {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background: var(--bg-color);
    padding: 30px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--card-border);
}
