/* --- 1. CSS Variables for Theming --- */
:root {
    --bg-color: #0d1117; /* Main dark background */
    --card-bg: #161b22; /* Slightly lighter background for cards/containers */
    --text-main: #e6edf3; /* Primary text color (off-white) */
    --text-muted: #8b949e; /* Secondary text color (gray) */
    --accent-red: #ff3b30; /* Vibrant red for alerts and counters */
    --accent-dark-red: #3a0d0b; /* Dark red for error message backgrounds */
    --accent-yellow: #d29922; /* Yellow for warnings/informational text */
}

/* --- 2. General Reset & Layout --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 800px; /* Constrains the width on large screens */
    margin-top: 40px;
}

/* --- 3. Header & UI Controls --- */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background-color: var(--card-bg);
    border-radius: 16px;
    border: 1px solid #30363d;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    position: relative; /* Needed to absolutely position the LIVE indicator */
}

/* The blinking "LIVE" badge in the top right */
.live-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-red);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* CSS Animation for the glowing red dot */
.pulse {
    width: 10px;
    height: 10px;
    background-color: var(--accent-red);
    border-radius: 50%;
    animation: pulse-animation 1.5s infinite;
}

@keyframes pulse-animation {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 59, 48, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
    }
}

.header h1 {
    font-size: 1.5rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
}

/* Styling for the time filter dropdown */
.controls {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.time-select {
    background-color: var(--bg-color);
    color: var(--text-main);
    border: 1px solid #30363d;
    padding: 8px 16px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.time-select:hover, .time-select:focus {
    border-color: var(--accent-red);
}

/* The big red number */
.counter {
    font-size: 5rem;
    font-weight: 800;
    color: var(--accent-red);
    line-height: 1;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255, 59, 48, 0.4);
}

.counter-label {
    font-size: 1.1rem;
    font-weight: 600;
}

/* --- 4. Status & Alert List Styling --- */
#status-message {
    text-align: center;
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.error {
    color: var(--accent-red) !important;
    background-color: var(--accent-dark-red);
    padding: 10px 15px;
    border-radius: 8px;
    display: inline-block;
    border: 1px solid rgba(255, 59, 48, 0.3);
}

.warning {
    color: var(--accent-yellow) !important;
}

.alerts-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Individual alert cards */
.alert-item {
    display: flex;
    align-items: center;
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    border-left: 6px solid var(--accent-red);
    transition: transform 0.2s ease;
}

.alert-item:hover {
    transform: translateX(5px); /* Slight nudge effect on hover */
    background-color: #1c2128;
}

.alert-time {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    min-width: 100px;
}

.alert-details {
    display: flex;
    flex-direction: column;
    margin-left: 20px;
    gap: 5px;
}

.alert-location {
    font-size: 1.1rem;
    font-weight: 600;
}

.alert-category {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Shown when there are no alerts */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 40px;
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 1px dashed #30363d;
}

.list-title {
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: var(--text-muted);
    border-bottom: 1px solid #30363d;
    padding-bottom: 10px;
    display: none; /* Hidden by default until data loads */
}

/* --- 5. Mobile Responsiveness --- */
@media (max-width: 600px) {
    .counter {
        font-size: 4rem;
    }

    .alert-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .alert-details {
        margin-left: 0;
    }

    .live-indicator {
        top: 15px;
        right: 15px;
        font-size: 0.7rem;
    }
}
