:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --accent: #006bb3;
  --border: #cccccc;
  --muted: #555;
  --overlay-bg: rgba(0, 0, 0, 0.4);
  --overlay-text: #fff;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  background-color: var(--bg);
  color: var(--text);
}

/* Header */
header {
  border-bottom: 2px solid var(--border);
  padding: 10px 15px;
  text-align: center;
  background: #f9f9f9;
}

h1 {
  margin: 8px 0 4px 0;
  font-size: 1.4rem;
}

#info-text {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 4px 0 10px 0;
}

/* Controls */
#controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  margin-bottom: 6px;
}

#controls label {
  font-weight: 500;
  margin-right: 4px;
}

#controls select {
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background-color: #fff;
  font-size: 0.95rem;
}

/* Main area - FIXAT för Leaflet */
main {
  position: relative;
  height: calc(100vh - 160px);
  min-height: 400px;
  padding: 0;
  margin: 0;
}

#view {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* View sections */
.view-section {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.view-section h2 {
  margin: 10px;
  font-size: 1.2rem;
}

.view-section p {
  margin: 0 10px 10px 10px;
  color: var(--muted);
}

/* Map container - KRITISKT för Leaflet */
#map {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 300px;
  background: #f0f0f0;
}

/* Loading overlay - FIXAT z-index */
#loading {
  position: absolute;
  inset: 0;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--overlay-text);
  font-size: 1.1rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#loading.active {
  opacity: 1;
  pointer-events: all;
}

/* Leaflet CSS fixes */
.leaflet-container {
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
}

/* Footer */
footer {
  text-align: center;
  border-top: 1px solid var(--border);
  padding: 12px;
  font-size: 0.9rem;
  color: var(--muted);
  background: #f9f9f9;
}

/* Responsive layout */
@media (max-width: 640px) {
  h1 {
    font-size: 1.1rem;
  }
  
  #controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  #controls select {
    width: 100%;
  }
  
  main {
    height: calc(100vh - 200px);
  }
}
