body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f8f9fa;
  color: #212529;
}

h1 {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 2rem;
  font-weight: 600;
  color: #343a40;
  background-color: #ffffff;
  border-bottom: 1px solid #dee2e6;
  margin: 0 0 1.5rem 0;
}

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin: 1.5rem auto;
  padding: 1rem;
  max-width: 900px;
}

.controls label {
  font-weight: 500;
  color: #495057;
}

.controls select,
.controls input {
  padding: 0.5rem 1rem;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  font-size: 1rem;
  min-width: 200px;
  background-color: #fff;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.controls select:focus,
.controls input:focus {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

#locationBtn {
  padding: 0.5rem 1rem;
  border: 1px solid #0d6efd;
  border-radius: 0.375rem;
  font-size: 1rem;
  background-color: #0d6efd;
  color: white;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out;
}

#locationBtn:hover {
  background-color: #0b5ed7;
}

#locationBtn:hover, #favoritesBtn:hover, #addHouseBtn:hover {
  opacity: 0.85;
}

#favoritesBtn, #addHouseBtn {
    padding: 0.5rem 1rem;
    border: 1px solid #6c757d;
    border-radius: 0.375rem;
    font-size: 1rem;
    background-color: #6c757d;
    color: white;
    cursor: pointer;
    transition: opacity 0.15s ease-in-out;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  background-color: #ffffff;
  border-bottom: 1px solid #dee2e6;
}

.app-header h1 {
    margin: 0;
    padding: 1.5rem 0;
    border-bottom: none;
}

.theme-switcher {
  position: relative;
}

.theme-toggle-input {
  display: none;
}

.theme-toggle-label {
  cursor: pointer;
  font-size: 1.5rem;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination-controls button {
  padding: 0.5rem 1rem;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  background-color: #fff;
  cursor: pointer;
  min-width: 44px; /* Minimum touch target size */
  font-size: 0.9rem;
}

.pagination-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.pagination-controls button.active {
  background-color: #0d6efd;
  color: white;
  border-color: #0d6efd;
}

.app-footer {
  text-align: center;
  padding: 2rem 1rem;
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
  margin-top: 2rem;
  font-size: 0.875rem;
  color: #6c757d;
}

.house-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.card-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
}

.card-btn.favorite-btn.is-favorite {
    color: #ffc107;
}

/* Dark Mode Styles */
body.dark-mode {
  background-color: #121212;
  color: #e0e0e0;
}

body.dark-mode .app-header,
body.dark-mode h1 {
  background-color: #1e1e1e;
  border-color: #333;
  color: #f5f5f5;
}

body.dark-mode .controls select,
body.dark-mode .controls input {
  background-color: #2c2c2c;
  border-color: #444;
  color: #f5f5f5;
}

body.dark-mode #searchBox:disabled {
  background-color: #222;
  color: #777;
}

body.dark-mode .house-card {
  background-color: #1e1e1e;
  border-color: #333;
}

body.dark-mode .house-card-title {
  color: #f5f5f5;
}

body.dark-mode .house-card-location,
body.dark-mode .house-card-address {
  color: #aaa;
}

body.dark-mode .status-message {
    background-color: #2c2c2c;
    color: #ccc;
}

body.dark-mode .pagination-controls button {
    background-color: #2c2c2c;
    border-color: #444;
    color: #f5f5f5;
}

body.dark-mode .pagination-controls button:disabled {
    opacity: 0.3;
}

body.dark-mode .pagination-controls button.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

body.dark-mode .app-footer {
    background-color: #1e1e1e;
    border-color: #333;
    color: #aaa;
}

body.dark-mode .leaflet-tile {
    filter: brightness(0.6) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7);
}

/* Media Queries for Mobile Responsiveness */
@media (max-width: 768px) {
  h1 {
    font-size: 1.5rem;
    padding: 1rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin: 1rem;
    padding: 0;
  }

  .controls select,
  .controls input,
  #locationBtn, #favoritesBtn, #addHouseBtn {
    width: 100%;
    box-sizing: border-box;
  }

  #map {
    height: 300px;
  }

  .search-results {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
    max-height: 500px;
  }
  
  .house-card {
    padding: 0.75rem;
  }
  
  .house-card-content {
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
  }
  
  .house-card-info {
    text-align: center;
    width: 100%;
  }
  
  .house-card-map {
    width: 100%;
    max-width: 200px;
    height: 120px;
  }
  
  .house-card-title {
    font-size: 1rem;
  }
  
  .house-card-location,
  .house-card-address {
    font-size: 0.9rem;
  }
  
  .house-card-actions {
    justify-content: center;
    margin-top: 0.75rem;
    gap: 1rem;
  }
  
  .card-btn {
    font-size: 1.3rem;
    padding: 0.5rem;
  }
  
  .pagination-controls {
    padding: 0.75rem;
    gap: 0.25rem;
  }
  
  .pagination-controls button {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    min-width: 44px;
  }
  
  .app-footer {
    padding: 1.5rem 1rem;
    font-size: 0.8rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .search-results {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .search-results {
    padding: 0.5rem;
  }
  
  .house-card {
    padding: 0.5rem;
  }
  
  .house-card-map {
    height: 100px;
  }
  
  .controls {
    margin: 0.5rem;
  }
  
  .app-header {
    padding: 0 1rem;
  }
  
  .app-header h1 {
    font-size: 1.25rem;
  }
}


#map {
  height: 500px;
  margin: 10px;
  border: 2px solid #ccc;
  border-radius: 8px;
}

#houseList {
  list-style: none;
  padding: 0;
  margin: 10px;
  max-height: 200px;
  overflow-y: auto;
}

#houseList li {
  padding: 5px;
  cursor: pointer;
  border-bottom: 1px solid #ddd;
}

#houseList li:hover {
  background-color: #f0f0f0;
}

.status-message {
  text-align: center;
  padding: 10px;
  margin: 10px;
  background-color: #f8f9fa;
  border-radius: 4px;
  font-size: 14px;
  color: #666;
}

#searchBox:disabled {
  background-color: #e9ecef;
  color: #6c757d;
  cursor: not-allowed;
}

.house-results {
  margin: 10px;
}

.search-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  padding: 1rem;
  overflow-y: auto;
  max-height: 600px;
}

.house-card {
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
}

.house-card-content {
  display: flex;
  gap: 1rem;
}

.house-card-info {
  flex: 1;
}

.house-card-map {
  width: 80px;
  height: 80px;
  border-radius: 4px;
  border: 1px solid #ccc;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.house-card:hover {
  background-color: #f8f9fa;
  border-color: #007bff;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.house-card-title {
  font-weight: bold;
  font-size: 16px;
  color: #333;
  margin-bottom: 5px;
}

.house-card-location {
  color: #666;
  font-size: 14px;
  margin-bottom: 5px;
}

.house-card-address {
  color: #888;
  font-size: 12px;
}

.results-header {
  font-weight: bold;
  margin-bottom: 15px;
  padding: 10px;
  background-color: #e9ecef;
  border-radius: 4px;
  color: #495057;
}

.no-selection-message {
  text-align: center;
  padding: 20px;
  color: #6c757d;
  font-style: italic;
}
