body,
html {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  background: #f4f6f8;
}

.container {
  display: flex;
  height: 100vh;
  width: 100%;
  position: relative;
}

#mapContainer {
  display: flex;
  position: relative;
  flex: 2;
  transition: all 0.3s;
}

#mapWrapper {
  flex: 2;
  height: 100%;
  transition: flex 0.3s;
}

#map {
  width: 100%;
  height: 100%;
}

#panel {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 15px;
  box-sizing: border-box;
  background: #fff;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  transition: flex 0.3s, width 0.3s;
}

#currentCityDisplay {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  border: 2px solid #0078d4;
  border-radius: 6px;
  background: #fff;
  padding: 0;
  height: 36px;
  box-sizing: border-box;
}

.city-label {
  color: #0078d4;
  font-weight: bold;
  margin: 0 5px;
  flex: none;
}

#currentCity {
  flex: 1;
  background: #0078d4;
  color: #fff;
  font-weight: bold;
  border-radius: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin: 0;
  line-height: normal;
}

#editCity {
  flex: none;
  cursor: pointer;
  color: #0078d4;
  font-size: 18px;
  padding: 0 6px;
  border-radius: 0px 4px 4px 0px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

#editCity:hover {
  background: #0078d4;
  color: #fff;
}

/* City selector */
.city-selector {
  position: relative;
  margin-bottom: 10px;
}

#citySearch {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

#citySearch:focus {
  outline: none;
  border-color: #0078d4;
  box-shadow: 0 0 5px rgba(0, 120, 212, 0.3);
}

.dropdown {
  position: absolute;
  width: 100%;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid #ddd;
  background: white;
  border-radius: 6px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dropdown-item {
  padding: 8px 10px;
  cursor: pointer;
}

.dropdown-item:hover {
  background: #e5f1fb;
}

/* Reset city button */
.reset-btn {
  display: none;
  width: 100%;
  margin: 10px 0;
  padding: 8px;
  background: #fff;
  color: #00a86b;
  border: 2px solid #00a86b;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.reset-btn:hover {
  background: #00a86b;
  color: #fff;
}

/* List container - now holds DataTable */
#list {
  margin-top: 10px;
  width: 100%;
}

/* Ensure table container is responsive */
#list .dataTables_wrapper {
  width: 100% !important;
}

/* Custom styles for DataTable rows (active highlight) */
#locationsTable tbody tr.active {
  border: 2px solid #2a7fff !important;
  background-color: #f0f6ff !important;
}

/* Custom CSS for wrapping */
.dt-wrap {
  white-space: normal !important;
  word-wrap: break-word;
}

.dt-nowrap {
  white-space: nowrap !important;
}

/* Direction button */
.direction-btn {
  background: #fff;
  color: #0078d4;
  border: 2px solid #0078d4;
  border-radius: 5px;
  padding: 5px 10px;
  cursor: pointer;
  font-weight: normal;
  font-size: 13px;
  flex: 1 1 100%;
  max-width: 150px;
  margin-top: 6px;
  max-width: 120px;
  justify-self: start;
}

.direction-btn:hover {
  background-color: #3367d6 !important;
}

/* Toggle map button */
#mapToggleBtn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 46px;
  background: #0078d4;
  color: #fff;
  border: 2px solid #0078d4;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px 0 0 4px;
  z-index: 1000;
  transition: all 0.3s;
  right: 0;
  left: auto;
}

#mapToggleBtn:hover {
  background: #fff;
  color: #0078d4;
}

/* Responsive */
@media(max-width:900px) {
  .container {
    flex-direction: column;
  }

  #mapWrapper {
    flex: none;
    height: 50vh;
  }

  #panel {
    flex: none;
    max-width: 100%;
    height: 50vh;
    box-shadow: none;
  }

  #mapToggleBtn {
    left: 100%;
    top: auto;
    bottom: 50%;
    transform: translate(-50%, 50%);
    width: 30px;
    height: 20px;
    border-radius: 4px 4px 0 0;
  }

  /* DataTables responsive handles mobile stacking via child rows */
  #list {
    overflow-x: auto;
  }
}

@media (max-width: 500px) {
  .direction-btn {
    width: 100% !important;
    margin-top: 6px;
  }
}