/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
    min-height: 100vh;
    color: #333;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.dashboard-header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.dashboard-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, #949393, #767575);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.connection-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.status-indicator {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.status-indicator.online {
    background: #4CAF50;
    color: white;
}

.status-indicator.offline {
    background: #f44336;
    color: white;
}

#lastUpdate {
    font-size: 0.8rem;
    color: #666;
}

/* Alert Banner */
.alert-banner {
    background: #ff5722;
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 5px 15px rgba(255, 87, 34, 0.3);
    animation: slideDown 0.3s ease;
}

.alert-banner.hidden {
    display: none;
}

.alert-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.alert-dismiss {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 10px;
}

/* Main Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    flex: 1;
}

/* Sensor Cards */
.sensor-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sensor-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.sensor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sensor-header h2 {
    font-size: 1.5rem;
    color: #333;
}

.sensor-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.normal {
    background: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.status-dot.warning {
    background: #FF9800;
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
    animation: pulse 2s infinite;
}

.status-dot.critical {
    background: #f44336;
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.5);
    animation: pulse 1s infinite;
}

.status-text {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Sensor Readings */
.sensor-readings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.reading-item {
    text-align: center;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.reading-item:hover {
    border-color: rgba(102, 126, 234, 0.3);
}

.reading-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.reading-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.reading-threshold {
    font-size: 0.8rem;
    color: #888;
}

.sensor-location {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 0.9rem;
}

.location-icon {
    font-size: 1.2rem;
}

/* Chart Section */
.chart-section {
    grid-column: 1 / -1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.chart-header h2 {
    font-size: 1.5rem;
    color: #333;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: transparent;
    color: #667eea;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.chart-btn:hover {
    background: #667eea;
    color: white;
}

.chart-btn.active {
    background: #667eea;
    color: white;
}

.time-select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 20px;
    background: white;
    color: #333;
    font-weight: 500;
    cursor: pointer;
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

/* Map Section */
.map-section {
    grid-column: 1 / -1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.map-header h2 {
    font-size: 1.5rem;
    color: #333;
}

.map-legend {
    display: flex;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.map-container {
    height: 400px;
    border-radius: 10px;
    overflow: hidden;
}

/* Info Panel */
.info-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.info-panel h2 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
}

.info-label {
    font-weight: 500;
    color: #666;
}

.info-value {
    font-weight: 700;
    color: #333;
    font-size: 1.1rem;
}

/* Alerts Panel */
.alerts-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.alerts-panel h2 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
}

.alert-history {
    max-height: 300px;
    overflow-y: auto;
}

.no-alerts {
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 20px;
}

.alert-item {
    padding: 15px;
    border-left: 4px solid #ff5722;
    background: rgba(255, 87, 34, 0.1);
    margin-bottom: 10px;
    border-radius: 0 10px 10px 0;
}

.alert-time {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
}

.alert-message {
    font-weight: 500;
    color: #333;
}

/* Footer */
.dashboard-footer {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    text-align: center;
    color: #666;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 10px;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .dashboard-header h1 {
        font-size: 2rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .sensor-readings {
        grid-template-columns: 1fr;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .chart-controls {
        justify-content: center;
    }
    
    .map-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .map-legend {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .chart-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .map-legend {
        flex-direction: column;
        gap: 10px;
    }
}