:root {
    --bg-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;

    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.5);

    --accent-green: #10b981;
    --accent-red: #ef4444;

    --font-main: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    /* Subtle gradient background */
    background-image:
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* --- Glassmorphism Utilities --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* --- Header --- */
header {
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-weight: 800;
    font-size: 2rem;
    letter-spacing: -0.5px;
}

h1 span {
    color: var(--accent-blue);
}

.status-indicators {
    display: flex;
    gap: 1rem;
}

.status-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    cursor: help;
}

.indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.indicator.red {
    background-color: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red);
}

.indicator.green {
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

/* --- Grid Layout --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    grid-template-rows: auto 1fr;
    gap: 1.5rem;
}

.metrics-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

/* --- Metric Cards --- */
.metric-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.metric-card.highlight {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(30, 41, 59, 0.8));
    border-color: rgba(59, 130, 246, 0.3);
}

.metric-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 800;
    white-space: nowrap;
}

.metric-value .unit {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* --- Chart Section --- */
.chart-section {
    padding: 1rem;
    grid-column: 1 / 2;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.pulse-icon {
    width: 12px;
    height: 12px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.chart-container {
    flex-grow: 1;
    position: relative;
    width: 100%;
}

/* --- Controls Section --- */
.controls-section {
    padding: 1.5rem;
    grid-column: 2 / 3;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.controls-section h2 {
    font-size: 1.2rem;
    font-weight: 600;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.interval-display {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-blue);
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

input[type="number"] {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.8rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

input[type="number"]:focus {
    border-color: var(--accent-blue);
}

.action-buttons {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn.primary:hover {
    background: #2563eb;
    box-shadow: 0 4px 12px var(--accent-blue-glow);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn.danger:hover {
    background: var(--accent-red);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Responsive */
@media (max-width: 900px) {
    .app-container {
        padding: 0.5rem;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 100%;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    .metric-card {
        padding: 0.8rem;
    }

    .metric-card h3 {
        font-size: 0.75rem;
    }

    .metric-value {
        font-size: 1.4rem;
    }

    .controls-section {
        grid-column: 1 / -1;
    }
}