/* ================================================================
   UDOT LIDAR Download — Styles
   ================================================================ */

/* --- Reset & base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Avenir Next', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #323232;
  background: #f4f4f4;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* --- Header --- */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 60px;
  background: #ffffff;
  color: #183078;
  flex-shrink: 0;
  border-bottom: 3px solid #D86018;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo {
  height: 40px;
  width: auto;
}

#header h1 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.header-meta {
  font-size: 13px;
  opacity: 0.85;
}

/* --- Main layout --- */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* --- Map panel --- */
#map-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

#map-view {
  flex: 1;
}

#map-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  flex-wrap: wrap;
}

/* --- Click-mode floating widget (on map) --- */
.map-widget-group {
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  border-radius: 4px;
  overflow: hidden;
}

.map-widget-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #fff;
  color: #6e6e6e;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}

.map-widget-btn + .map-widget-btn {
  border-top: 1px solid #e0e0e0;
}

.map-widget-btn.active {
  background: #183078;
  color: #fff;
}

.map-widget-btn:hover:not(.active) {
  background: #f0f0f0;
}

.map-widget-btn svg {
  pointer-events: none;
}

.badge {
  font-size: 12px;
  color: #2e7d32;
  font-weight: 600;
  padding: 2px 8px;
  background: #e8f5e9;
  border-radius: 10px;
}

/* --- Sidebar --- */
#sidebar {
  width: 400px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #e0e0e0;
  background: #fff;
  overflow: hidden;
}

/* --- Spatial filter toggles --- */
.filter-section-label {
  font-size: 11px;
  font-weight: 700;
  color: #595959;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.spatial-filter-toggles {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.spatial-toggle-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f4f4f4;
  color: #323232;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.spatial-toggle-btn.active {
  background: #183078;
  color: #fff;
  border-color: #183078;
}

.spatial-toggle-btn:hover:not(.active) {
  background: #e8ecf5;
  border-color: #4878C0;
}

#spatial-filter-panel {
  background: #f8f9fc;
  border: 1px solid #dde3f0;
  border-radius: 5px;
  padding: 10px;
  margin-bottom: 10px;
}

/* --- Autocomplete dropdown --- */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 180px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.autocomplete-item {
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}

.autocomplete-item:hover,
.autocomplete-item.focused {
  background: #e8ecf5;
}

.autocomplete-item strong {
  color: #183078;
}

/* --- Spatial filter status / selected-features bar --- */
.spatial-status {
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
  min-height: 16px;
}

#selected-features-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #dde3f0;
}

#selected-features-count {
  font-size: 12px;
  color: #183078;
  font-weight: 600;
  flex: 1;
}

/* --- Floating layer visibility control --- */
.map-layer-control {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  padding: 8px 10px;
  min-width: 130px;
  font-family: 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
}

.map-layer-control-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #595959;
  margin-bottom: 6px;
}

.map-layer-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #323232;
  cursor: pointer;
  user-select: none;
  padding: 3px 0;
}

.map-layer-row input[type="checkbox"] {
  accent-color: #4878C0;
  width: 13px;
  height: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.map-layer-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

/* --- Filters --- */
#filters {
  padding: 14px;
  border-bottom: 1px solid #e0e0e0;
}

.filter-group {
  margin-bottom: 10px;
}

.filter-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #595959;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="date"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: #4878C0;
  box-shadow: 0 0 0 2px rgba(72, 120, 192, 0.2);
}

.filter-row {
  display: flex;
  gap: 10px;
}

.filter-group.half {
  flex: 1;
}

/* --- Bulk actions --- */
#bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid #e0e0e0;
  font-size: 13px;
}

.meta-text {
  font-size: 12px;
  color: #888;
}

.meta-text.accent {
  margin-left: auto;
  color: #4878C0;
  font-weight: 600;
}

/* --- Results list --- */
#results-list {
  flex: 1;
  overflow-y: auto;
}

#results-list.loading {
  opacity: 0.5;
  pointer-events: none;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.12s ease;
}

.result-item:hover {
  background: #f0f3fb;
}

.result-item.selected {
  background: #e6edf9;
}

.result-item input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #4878C0;
}

.result-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.result-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

.result-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: #888;
}

.chip {
  background: #e6edf9;
  color: #183078;
  border-radius: 8px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 500;
}

.no-results {
  padding: 30px;
  text-align: center;
  color: #aaa;
  font-size: 13px;
}

/* --- Download bar --- */
#download-bar {
  padding: 12px 14px;
  border-top: 1px solid #e0e0e0;
  background: #fafafa;
}

.status-msg {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.status-info    { background: #e3f2fd; color: #1565c0; }
.status-loading { background: #fff3e0; color: #e65100; }
.status-success { background: #e8f5e9; color: #2e7d32; }
.status-error   { background: #ffebee; color: #c62828; }
.status-warning { background: #fff8e1; color: #e65100; }

.download-limit-note {
  margin: 6px 0 0;
  font-size: 11px;
  color: #888;
  text-align: center;
}

#download-chunk-bar {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #ddd;
}

.chunk-progress-text {
  font-size: 12px;
  color: #555;
  margin: 0 0 6px;
  text-align: center;
}

.meta-text.at-limit {
  color: #D86018;
  font-weight: 600;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-primary {
  background: #4878C0;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #183078;
}

.btn-secondary {
  background: #e0e0e0;
  color: #323232;
}

.btn-secondary:hover:not(:disabled) {
  background: #ccc;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-block {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* --- Responsive: stack on narrow screens --- */
@media (max-width: 900px) {
  #main {
    flex-direction: column;
  }
  #map-panel {
    height: 50%;
  }
  #sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid #e0e0e0;
  }
}
