
body {
  margin: 0;
  font-family: Arial, sans-serif;
  padding: 1rem;
  box-sizing: border-box;
  font-size: 12px;
  background-color: #f9f9f9;
}

h1 {
  text-align: center;
  font-size: 1.5rem;
  margin-top: 0;
}

/* Filtros superiores */
#filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: flex-start;
  margin-bottom: 1rem;

  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #fff;
  padding: 1rem 0.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#filtros label {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 4px;
}

#filtros select,
#filtros input {
  padding: 6px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  width: 100%;
}

#filtros > div {
  display: flex;
  flex-direction: column;
  min-width: 180px;
  max-width: 250px;
}

/* Contenedor con scroll solo para la tabla */
#tabla-container {
  max-height: 70vh;
  overflow-y: auto;
  border-top: 1px solid #ccc;
}

/* Tabla y cabecera sticky */
#tablaViviendas {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background-color: white;
  font-size: 10px;
}

#tablaViviendas thead {
  background-color: #007bff;
  color: white;
}

#tablaViviendas thead th {
  position: sticky;
  top: 0;
  background-color: #007bff;
  color: white;
  z-index: 5;
}

#tablaViviendas th,
#tablaViviendas td {
  border: 1px solid #ccc;
  padding: 5px;
  text-align: left;
  word-break: break-word;
}

/* Columnas con más espacio: ID, Fecha, IPS, Categoría */
#tablaViviendas th:nth-child(1),
#tablaViviendas th:nth-child(2),
#tablaViviendas th:nth-child(3),
#tablaViviendas th:nth-child(4),
#tablaViviendas td:nth-child(1),
#tablaViviendas td:nth-child(2),
#tablaViviendas td:nth-child(3),
#tablaViviendas td:nth-child(4) {
  min-width: 160px;
}

/* Columnas numéricas más angostas */
#tablaViviendas th:nth-child(n+5):nth-child(-n+19),
#tablaViviendas td:nth-child(n+5):nth-child(-n+19) {
  width: 90px;
  text-align: center;
}

#tablaViviendas tbody tr:nth-child(even) {
  background-color: #f2f2f2;
}

#contadorViviendas {
  text-align: center;
  margin: 0.5rem 0;
  font-size: 1rem;
}

footer {
  text-align: center;
  font-size: 0.85rem;
  color: #555;
  margin-top: 1rem;
}

@media only screen and (max-width: 600px) {
  body {
    font-size: 14px;
  }

  #filtros {
    flex-direction: column;
    align-items: stretch;
  }

  #filtros > div {
    width: 100%;
  }

  #tablaViviendas {
    font-size: 12px;
  }
}
