/* Estilos generales */
body {
    font-family: Arial, sans-serif;
    background: #f0f4f7;
    margin: 0;
    padding: 0;
    color: #333;
    text-align: center;
}

header {
    background: #1e90ff;
    color: #fff;
    padding: 20px;
    text-align: center;
}

header img {
    height: 40px;
    margin-bottom: 10px;
}

header nav ul {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
    display: flex;
    justify-content: center;
    gap: 15px;
}

header nav ul li {
    display: inline;
}

header nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: bold;
}

header nav ul li a:hover {
    text-decoration: underline;
}

.container {
    max-width: 900px;
    margin: 20px auto;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

/* Títulos y secciones */
h1, h2, h3 {
    margin-top: 0;
    color: #1e90ff;
}

.section-title {
    margin-top: 40px;
    color: #333;
}

/* Info Cards */
.info-box {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    flex-wrap: wrap;
    gap: 20px;
    text-align: center;
}

.info-box .card {
    background: #e7f3ff;
    border: 1px solid #cce5ff;
    border-radius: 8px;
    padding: 10px;
    width: 30%;
    min-width: 200px;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 0.9rem;
}

.info-box .card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.info-box .card:active {
    transform: scale(1.1);
}

.info-box .card h2 {
    margin: 0;
    font-size: 22px;
    color: #1e90ff;
}

.info-box .card p {
    margin: 5px 0 0 0;
    font-size: 16px;
    color: #333;
}

/* Botones */
.buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.buttons button {
    background: #1e90ff;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.buttons button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.buttons button:active {
    transform: scale(1.1);
}

/* Mapa */
#map {
    width: 90%;
    height: 600px; /* Ajusta este valor según la cantidad de información */
    margin-top: 20px;
    border: 1px solid #ccc;
    border-radius: 8px;
    margin: 20px auto 0 auto;
}

/* Login Page */
.login-container {
    width: 100%;
    max-width: 400px;
    margin: 50px auto;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.login-container h1 {
    margin-top: 0;
    color: #1e90ff;
}

.login-container label {
    display: block;
    text-align: left;
    margin: 10px 0 5px 0;
}

.login-container input[type="text"],
.login-container input[type="password"] {
    width: 90%; /* Ajustar ancho al 90% del contenedor */
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    margin-bottom: 15px;
    box-sizing: border-box; /* Incluye padding dentro del ancho */
    text-align: left;
}

.login-container button {
    background: #1e90ff;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 10px;
    width: 100%;
    cursor: pointer;
}

.login-container button:hover {
    background: #187bcd;
}

.recovery {
    margin-top: 15px;
    font-size: 14px;
}

.recovery a {
    color: #1e90ff;
    text-decoration: none;
}

.recovery a:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    text-align: center;
    margin: 40px 0 20px 0;
    color: #666;
    font-size: 14px;
}

footer img {
    margin-bottom: 10px;
}

/* Canvas (gráficos) */
canvas {
    display: block;
    margin: 0 auto;
}

#myChart {
    width: 100%; /* Ancho completo del contenedor */
    height: auto; /* Mantener proporciones */
    max-height: 400px; /* Mantener altura máxima */
    margin: 0 auto; /* Centrar */
}

#indicadores-adicionales .card h2 {
    font-size: 24px;
    margin: 10px 0;
}

#indicadores-adicionales .card p {
    font-size: 16px;
    color: #666;
}

#tendenciaValor {
    font-weight: bold;
    transition: color 0.3s ease; /* Transición suave en cambio de color */
}

#contexto-clima .card {
    background: #f0f8ff;
    border: 1px solid #1e90ff;
    color: #1e90ff;
}

.device-id-tooltip {
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #1e90ff;
    border-radius: 4px;
    color: #1e90ff;
    font-weight: bold;
    padding: 2px 5px;
    font-size: 12px;
    box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.2);
}


.calendario-container {
    display: flex;
    flex-wrap: wrap; /* Las tarjetas se distribuyen en varias filas */
    gap: 5px; /* Espaciado entre tarjetas */
    justify-content: center; /* Ajusta las tarjetas para distribuirlas al centro */
    padding: 5px;
    background: transparent;
    border-radius: 8px;
    box-shadow: none;
}

.calendario-dia {
    flex: 1 1 calc(22% - 10px); /* Cada tarjeta ocupa aproximadamente 22% del contenedor */
    max-width: calc(22% - 10px); /* Limita el tamaño máximo */
    min-width: 120px; /* Tamaño mínimo */
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-align: center;
    padding: 5px;
    font-size: 0.75rem; /* Reduce ligeramente el tamaño del texto */
    color: #333;
}


@media (max-width: 800px) {
    .calendario-dia {
        flex: 1 1 calc(33.333% - 20px); /* En pantallas más pequeñas, 3 tarjetas por fila */
        max-width: calc(33.333% - 20px);
    }
}

@media (max-width: 600px) {
    .calendario-dia {
        flex: 1 1 calc(50% - 20px); /* En pantallas aún más pequeñas, 2 tarjetas por fila */
        max-width: calc(50% - 20px);
    }
}


.calendario-dia:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.calendario-header {
    font-weight: bold;
    margin-bottom: 5px;
}

.calendario-dia-nombre {
    text-transform: uppercase;
    color: #666;
}

.calendario-dia-fecha {
    display: block;
    font-size: 0.85rem;
    color: #999;
}

.calendario-clima {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calendario-temp-min {
    color: #007bff;
    font-size: 0.75rem;
}

.calendario-temp-max {
    color: #ff4500;
    font-size: 0.75rem;
}

.calendario-temp-min.peligro {
    color: blue;
    font-weight: bold;
    font-size: 0.75rem;
}

.calendario-temp-max.peligro {
    color: red;
    font-weight: bold;
    font-size: 0.75rem;
}

.calendario-lluvia {
    font-size: 0.75rem;
}

/* Estilos para la tabla de históricos */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

table thead {
    background-color: #1e90ff;
    color: white;
}

table th, table td {
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

table tr:nth-child(even) {
    background-color: #f9f9f9;
}

table tr:hover {
    background-color: #f1f1f1;
}

table th {
    font-size: 14px;
    font-weight: bold;
}

table td {
    font-size: 13px;
}

/* Paginación */
#paginacion {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    gap: 10px;
}

#paginacion button {
    background-color: #1e90ff;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
}

#paginacion button:disabled {
    background-color: #ddd;
    cursor: not-allowed;
}

#paginacion span {
    font-size: 14px;
    font-weight: bold;
}

/* Filtros */
form#filtros-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: space-between;
    align-items: center;
    background: #e7f3ff;
    padding: 15px;
    border: 1px solid #cce5ff;
    border-radius: 8px;
}

form#filtros-form div {
    display: flex;
    flex-direction: column;
    width: calc(33.333% - 10px); /* Tres elementos por fila */
    min-width: 150px;
}

form#filtros-form label {
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
    font-weight: bold;
}

form#filtros-form input[type="text"],
form#filtros-form input[type="number"],
form#filtros-form input[type="date"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
}

form#filtros-form button {
    background: #1e90ff;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

form#filtros-form button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Botón de descarga */
.buttons button#descargar-excel {
    background-color: #32cd32; /* Verde para diferenciar */
    font-weight: bold;
}

.buttons button#descargar-excel:hover {
    background-color: #28a745;
}
