:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-success: #10b981;
    --accent-error: #ef4444;
    --accent-glow: rgba(16, 185, 129, 0.5);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-image: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 100%);
}

.container {
    width: 100%;
    max-width: 800px;
    /* Increased for better graph view */
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
}

header a {
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px dotted var(--text-secondary);
    transition: color 0.3s;
}

header a:hover {
    color: var(--text-primary);
}

.status-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.indicator-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.status-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    z-index: 2;
    transition: background-color 0.5s ease;
}

.status-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--text-secondary);
    opacity: 0.3;
    z-index: 1;
    animation: none;
    transition: background-color 0.5s ease;
}

.status-card.online .status-indicator {
    background-color: var(--accent-success);
    box-shadow: 0 0 20px var(--accent-success);
}

.status-card.online .status-ripple {
    background-color: var(--accent-success);
    animation: pulse 2s infinite;
}

.status-card.online h2 {
    color: var(--accent-success);
}

.status-card.offline .status-indicator {
    background-color: var(--accent-error);
    box-shadow: 0 0 20px var(--accent-error);
}

.status-card.offline .status-ripple {
    background-color: var(--accent-error);
    animation: pulse 2s infinite;
}

.status-card.offline h2 {
    color: var(--accent-error);
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0.5;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    transition: color 0.3s;
}

.metrics {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid var(--glass-border);
    padding-top: 20px;
}

.metric {
    display: flex;
    flex-direction: column;
}

.metric .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric .value {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Sections */
section {
    margin-top: 30px;
}

section h3 {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.heartbeat-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    min-width: 150px;
    text-align: right;
}

/* Heartbeat Bar */
.heartbeat-container {
    display: flex;
    gap: 4px;
    height: 40px;
    padding: 5px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    align-items: flex-end;
    /* Align bars to bottom */
    overflow-x: auto;
}

.beat-bar {
    flex: 1;
    min-width: 6px;
    background-color: var(--text-secondary);
    border-radius: 3px;
    opacity: 0.8;
    transition: all 0.2s;
    height: 100%;
    position: relative;
    cursor: pointer;
}

.beat-bar:hover {
    opacity: 1;
    transform: scaleY(1.1);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.beat-bar.online {
    background-color: var(--accent-success);
}

.beat-bar.offline {
    background-color: var(--accent-error);
}

/* Chart */
.chart-container {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 15px;
    height: 250px;
    position: relative;
}

/* History List */
.history-list {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--glass-border);
    transition: background-color 0.2s;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.history-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.online {
    background-color: var(--accent-success);
}

.dot.offline {
    background-color: var(--accent-error);
}

.history-time {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.history-latency {
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
}

footer {
    text-align: center;
    margin-top: 40px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    opacity: 0.6;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Heatmap Styles */
/* Heatmap (30 Day) */
.heatmap-container {
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping if small screen, but ideally single row or grid */
    gap: 4px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
    justify-content: center;
    /* Center the grid */
}

.day-square {
    width: 20px;
    /* Github style small squares */
    height: 20px;
    border-radius: 3px;
    background-color: rgba(255, 255, 255, 0.05);
    /* Default/Empty */
    position: relative;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}

.day-square:hover {
    transform: scale(1.3);
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Colors */
.day-square.empty {
    background-color: rgba(255, 255, 255, 0.05);
}

.day-square.low {
    background-color: #ef4444;
}

/* < 20% - Red */
.day-square.mid {
    background-color: #3b82f6;
}

/* 20% - 80% - Blue */
.day-square.high {
    background-color: #10b981;
}

/* > 80% - Green */

/* Tooltip for squares */
.day-square::after {
    content: attr(data-title);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.day-square:hover::after {
    opacity: 1;
}

/* Legend */
.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

.legend-scale {
    display: flex;
    gap: 3px;
}