/* monitoring.css - Ultra Mobile Optimized (page-scoped variables, relies on core.css) */
.monitoring-body {
    /* Map core tokens into page-local variables */
    --primary: var(--primary-color);
    --secondary: var(--gray-color);
    --success: var(--success-color);
    --warning: var(--warning-color);
    --danger: var(--danger-color);
    --light: #f8f9fa;
    --dark: var(--dark-color);
    --white: #ffffff;

    /* Node palette - page specific (sesuai core.css) */
    --node1: var(--primary-color, #1e40af);
    --node2: var(--success-color, #16a085);
    --node3: var(--warning-color, #f39c12);
    --node4: var(--danger-color, #e74c3c);

    /* Status colors derived */
    --status-normal: var(--success);
    --status-warning: var(--warning);
    --status-danger: var(--danger);

    /* Effects & spacing */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 2px 5px rgba(0,0,0,0.15);
    --transition-fast: 0.1s ease;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-pill: 50px;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.25rem;
}

/* Base Reset for Mobile Performance */
.monitoring-body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-light, #f8fafc);
    color: var(--dark-color, #2c3e50);
    line-height: 1.6;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* Dashboard title/subtitle aesthetics */
.dashboard-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--dark-color, #2c3e50);
    text-shadow: none;
}

.dashboard-subtitle {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--gray-color, #7f8c8d);
}

/* Typography Optimized for Small Screens */
.dashboard-title {
    font-size: 1.8rem;
    text-align: center;
    color: var(--dark-color, #2c3e50);
    margin: var(--space-md) var(--space-sm) var(--space-sm);
    padding: 0 var(--space-sm);
    font-weight: 800;
    line-height: 1.3;
}

.dashboard-subtitle {
    font-size: 0.95rem;
    text-align: center;
    color: var(--gray-color, #7f8c8d);
    margin-bottom: var(--space-lg);
    padding: 0 var(--space-sm);
    font-weight: 400;
}

/* Status Badge Improvements */
.status-badge {
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.status-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Alert Banner - Sticky and Visible */
#alert-banner {
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 0;
    padding: var(--space-sm);
    font-size: 0.8rem;
    width: 100%;
    box-sizing: border-box;
}

/* Status Indicators - Clear and Concise */
.status-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    white-space: nowrap;
}

.status-normal { background-color: var(--status-normal); color: white; }
.status-warning { background-color: var(--status-warning); color: var(--dark); }
.status-danger { background-color: var(--status-danger); color: white; }

/* Cards - Optimized for Touch */
.card {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background-color: var(--white);
    margin-bottom: var(--space-md);
    overflow: hidden;
    transition: transform var(--transition-fast);
}

.card:active {
    transform: scale(0.98);
}

.card-header {
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    font-weight: 600;
    padding: var(--space-sm);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-size: 0.9rem;
}

.card-body {
    padding: var(--space-sm);
}

/* Slim progress variant */
.progress-thin { height: 6px; border-radius: 3px; }

/* Node Cards - Single Column Layout */
.nodes-section {
    padding: 0 var(--space-sm);
    margin-bottom: var(--space-lg);
}

.nodes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-sm);
}

.node-card {
    position: relative;
    border-left: 4px solid var(--node1);
    transition: all 0.3s ease;
    background: white;
    border-radius: 12px;
}

.node-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.node-card.node1 { border-left-color: var(--node1); }
.node-card.node2 { border-left-color: var(--node2); }
.node-card.node3 { border-left-color: var(--node3); }
.node-card.node4 { border-left-color: var(--node4); }

.node-header {
    display: flex;
    align-items: center;
    padding: var(--space-sm);
}

.node-icon {
    font-size: 1.25rem;
    margin-right: var(--space-sm);
    min-width: 24px;
    text-align: center;
}

.node-card.node1 .node-icon { color: var(--node1); }
.node-card.node2 .node-icon { color: var(--node2); }
.node-card.node3 .node-icon { color: var(--node3); }
.node-card.node4 .node-icon { color: var(--node4); }

.node-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.node-id {
    font-weight: 600;
    margin: 0;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-location {
    font-size: 0.7rem;
    color: var(--secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm);
    font-size: 0.8rem;
}

/* Charts - Simplified for Mobile */
.charts-section {
    padding: 0 var(--space-sm);
    margin-bottom: var(--space-lg);
}

.chart-container {
    position: relative;
    height: 100%;
    width: 100%;
    background: var(--white);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    margin-bottom: var(--space-md);
    overflow: hidden;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xs);
}

.chart-title {
    font-weight: 600;
    margin: 0;
    font-size: 0.85rem;
}

.chart {
    height: 180px;
    width: 100%;
    min-width: 0;
}

/* Progress Bars - Mobile Friendly */
.progress-container {
    margin: var(--space-xs) 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.1rem;
    font-size: 0.7rem;
}

.progress {
    height: 5px;
    border-radius: var(--radius-pill);
    background-color: #f0f0f0;
}

.progress-bar {
    background-color: var(--primary);
    transition: width var(--transition-fast) ease;
}

.node-card.node1 .progress-bar { background-color: var(--node1); }
.node-card.node2 .progress-bar { background-color: var(--node2); }
.node-card.node3 .progress-bar { background-color: var(--node3); }
.node-card.node4 .progress-bar { background-color: var(--node4); }

/* Map Container - Full Width */
#sensor-map {
    height: 450px;
    border-radius: 15px;
    overflow: hidden;
    margin: 0;
    width: 100%;
    border: none;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

/* Map container wrapper (card-like) */
.map-container { 
    height: 450px; 
    width: 100%; 
    border-radius: 15px; 
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

.map-full-height {
    height: 500px;
}

/* Touch Targets - Accessibility */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive Adjustments */
@media (min-width: 400px) {
    .chart {
        height: 200px;
    }
}

@media (min-width: 576px) {
    :root {
        --space-md: 1rem;
        --space-lg: 1.25rem;
        --space-xl: 1.5rem;
    }
    
    .dashboard-title {
        font-size: 1.75rem;
    }
    
    .nodes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart {
        height: 220px;
    }
    
    #sensor-map {
        height: 320px;
    }
}

@media (min-width: 768px) {
    .dashboard-title {
        font-size: 2rem;
    }
    
    .nodes-grid {
        gap: var(--space-md);
    }
    
    .card-body {
        padding: var(--space-md);
    }
}

/* Performance Optimizations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Print Styles - Basic Support */
@media print {
    .monitoring-body {
        background-color: white;
        color: black;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .nodes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #alert-banner {
        display: none;
    }
}

/* Alert banner tweaks & animation */
#alert-banner { position: sticky; top: 0; z-index: 1000; border-radius: 0; }
@keyframes slideDown { from { transform: translateY(-100%);} to { transform: translateY(0);} }

/* Real-time blink for timestamp */
.real-time-blink { animation: blinker 2s linear infinite; }
@keyframes blinker { 50% { opacity: 0.7; } }

/* Tsunami alert panel */
.tsunami-alert-panel { background: linear-gradient(135deg, var(--danger), var(--warning)); color: #fff; border-radius: 8px; padding: 15px; margin-bottom: 20px; }

/* Simple data grid for node cards */
.data-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 
    gap: 24px; 
    margin-bottom: 30px;
}

/* Node badge used in filter */
.node-badge { width: 12px; height: 12px; display: inline-block; border-radius: 50%; }
.node-badge.node1 { background-color: var(--node1); }
.node-badge.node2 { background-color: var(--node2); }
.node-badge.node3 { background-color: var(--node3); }
.node-badge.node4 { background-color: var(--node4); }