/* --- Dashboard Styles --- */

.dashboard-container {
    padding: 2rem;
    height: 100vh;
    overflow-y: auto;
    background: rgba(5, 9, 20, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.hidden {
    display: none !important;
}

/* Adjust main content when dashboard is active */
#main-content {
    position: relative;
}

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

.dashboard-header h1 {
    font-size: 2rem;
    color: var(--text-main);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.btn-primary {
    background: rgba(0, 240, 255, 0.1);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.btn-primary:hover {
    background: var(--accent-primary);
    color: var(--bg-main);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.6);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--bg-glass);
    padding: 1.8rem;
    border-radius: var(--panel-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 0 1px var(--border-glass);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 240, 255, 0.1), inset 0 0 0 1px rgba(0, 240, 255, 0.3);
}

.kpi-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.kpi-value {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--accent-primary);
    text-shadow: 0 0 15px var(--accent-primary-glow);
    font-family: 'Inter', monospace;
}

.kpi-card.alert .kpi-value {
    color: var(--status-error);
    text-shadow: 0 0 15px rgba(255, 0, 60, 0.6);
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-wrapper {
    background: var(--bg-glass);
    padding: 1.8rem;
    border-radius: var(--panel-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 0 1px var(--border-glass);
    min-height: 350px;
}

.chart-wrapper h3 {
    margin-bottom: 1.5rem;
    color: var(--text-main);
    font-size: 1.2rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 10px;
}

/* Utility to ensure map is hidden */
#map.hidden {
    visibility: hidden;
    height: 0;
    width: 0;
}

/* Fix Chart.js infinite scaling bug inside CSS Grids/Flexboxes */
.canvas-container {
    position: relative;
    width: 100%;
    height: 300px;
    max-height: 100%;
}