/* Existing CSS */
body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, sans-serif;
}

.container {
  display: flex;
  height: 100%;
  flex-direction: row; /* Mantém a direção da linha para desktops */
}

.sidebar {
  width: 300px;
  background: #fff;
  padding: 20px;
  box-shadow: 2px 0 5px rgba(0,0,0,0.1);
  z-index: 1000;
  overflow-y: auto; /* Adiciona scroll na sidebar se o conteúdo for muito grande */
}

#map {
  flex: 1;
  height: 100%;
}

h1 {
  margin: 0 0 20px 0;
  font-size: 24px;
  color: #333;
}

.search-container {
  margin-bottom: 20px;
}

input[type="text"] {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}

button {
  background: #85040f;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
}

button:hover {
  background: #db303f;
}

.current-location {
  padding: 15px;
  background: #f5f5f5;
  border-radius: 4px;
  margin-bottom: 15px;
}

.current-location h2 {
  margin: 0 0 10px 0;
  font-size: 18px;
}

#coordinates, #address {
  margin: 5px 0;
  font-size: 14px;
  word-wrap: break-word;
}

.ip-info {
  padding: 15px;
  background: #a3a3a3;
  border-radius: 4px;
}

.ip-info h2 {
  margin: 0 0 10px 0;
  font-size: 18px;
}

#ip-address, #ip-location {
  margin: 5px 0;
  font-size: 14px;
  word-wrap: break-word;
}

.leaflet-container {
  height: 100%;
  width: 100%;
}

.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
}

.modal-content {
  background-color: #fefefe;
  margin: 15% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 500px;
  border-radius: 8px;
  text-align: center;
}

.modal-content h2 {
  margin-top: 0;
  color: #333;
}

.modal-content p {
  margin: 15px 0;
  color: #666;
}

.modal-content button {
  background-color: #85040f;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  margin-top: 10px;
}

.modal-content button:hover {
  background-color: #db303f;
}

.modal-content button.secondary {
  background-color: #888;
  margin-left: 10px;
}

.modal-content button.secondary:hover {
  background-color: #777;
}

/* Media Queries para dispositivos móveis */
@media (max-width: 768px) {
  .container {
    flex-direction: column; /* Altera a direção para coluna em telas menores */
  }

  .sidebar {
    width: 100%; /* Sidebar ocupa a largura total */
    height: auto; /* Altura automática para o conteúdo */
    max-height: 50vh; /* Limita a altura da sidebar para não ocupar a tela inteira */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative; /* Ajusta o posicionamento para o fluxo normal do documento */
    order: 2; /* Move a sidebar para baixo do mapa */
  }
  
  #map {
    height: 100vh; /* Mapa ocupa a altura total da viewport */
    order: 1; /* Move o mapa para cima da sidebar */
  }
}