* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #a1c4fd, #c2e9fb);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background 0.3s, color 0.3s;
}
body.dark {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #ecf0f1;
}
header {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
body.dark header {
    background: rgba(44, 62, 80, 0.9);
}
header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
}
body.dark header h1 { color: #ecf0f1; }
header h1 i {
    margin-right: 0.5rem;
    color: #3498db;
}
#theme-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #3498db;
}
body.dark #theme-toggle { color: #f1c40f; }
main {
    flex: 1;
    padding: 2rem;
}
.controls {
    text-align: center;
    margin-bottom: 2rem;
}
#refresh-btn {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}
#refresh-btn:hover { background: #2980b9; }
#last-update {
    font-style: italic;
    color: #7f8c8d;
}
body.dark #last-update { color: #bdc3c7; }
.data-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}
.card {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}
body.dark .card {
    background: #34495e;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.card:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}
.card i {
    font-size: 2rem;
    color: #3498db;
    margin-bottom: 0.5rem;
}
.card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}
body.dark .card h3 { color: #ecf0f1; }
.card p {
    font-size: 1.5rem;
    font-weight: 600;
}
.status-card .bueno { color: #27ae60; }
.status-card .moderado { color: #e67e22; }
.status-card .malo { color: #c0392b; }
.status-card .desconocido { color: #7f8c8d; }
.charts-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
body.dark .charts-section {
    background: rgba(44, 62, 80, 0.95);
}
.charts-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}
body.dark .charts-section h2 { color: #ecf0f1; }
.chart-container {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
}
body.dark .chart-container { background: #2c3e50; }
.alert {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #c0392b;
    color: #fff;
    padding: 1rem;
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 1rem;
}
.alert.hidden { display: none; }
.alert button {
    background: #fff;
    color: #c0392b;
    border: none;
    padding: 0.5rem;
    border-radius: 5px;
    cursor: pointer;
}
footer {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    color: #7f8c8d;
}
body.dark footer {
    background: rgba(44, 62, 80, 0.9);
    color: #bdc3c7;
}
@media (max-width: 768px) {
    header h1 { font-size: 2rem; }
    main { padding: 1rem; }
    .data-section { grid-template-columns: 1fr; }
    .card { padding: 1rem; }
    .card p { font-size: 1.3rem; }
    .charts-section { padding: 1rem; }
    .charts-section h2 { font-size: 1.5rem; }
}
@media (max-width: 480px) {
    header h1 { font-size: 1.5rem; }
    .card i { font-size: 1.5rem; }
    .card h3 { font-size: 1rem; }
    .card p { font-size: 1.2rem; }
}
.ubicacion-sensor {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}
body.dark .ubicacion-sensor {
    color: #ecf0f1;
}
.ubicacion-sensor i {
    color: #e74c3c;
}
