body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  text-align: center;
  background: #fff;
  /* Let content adapt to screen height */
  min-height: 100vh;
  min-height: 100dvh;
  /* Allow vertical scroll if overlays don't fit */
  overflow-x: hidden;
  overflow-y: auto;
  /* Support for iPhone safe areas */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Hide Leaflet zoom controls */
.leaflet-control-zoom {
  display: none !important;
}

#map {
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile */
  width: 100%;
}

.toolbar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  padding: 4px 6px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
  max-width: calc(100vw - 40px);
}
.toolbar-top {
  top: max(10px, calc(env(safe-area-inset-top, 0px) + 10px));
}

/* Route Info Display */
.route-info {
  position: absolute;
  top: max(75px, calc(env(safe-area-inset-top, 20px) + 55px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 12px;
  background: rgba(74, 144, 226, 0.95);
  padding: 8px 16px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
  color: white;
  font-size: 14px;
  transition: all 0.3s ease;
  opacity: 1;
}
.route-info.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
  pointer-events: none;
}
.route-info span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.route-info strong {
  font-weight: 600;
}

/* Points Collector Display */
.points-collector {
  position: absolute;
  bottom: max(60px, calc(env(safe-area-inset-bottom, 0px) + 60px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.95);
  padding: 6px 12px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e0e0e0;
  backdrop-filter: blur(8px);
}
.points-icon {
  font-size: 16px;
}
.points-count {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  min-width: 20px;
  text-align: center;
}
.points-label {
  font-size: 12px;
  font-weight: 500;
  color: #666;
}

.toolbar-bottom {
  bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) + 10px));
  padding-bottom: max(4px, env(safe-area-inset-bottom, 4px));
}
.toolbar button {
  border: 1px solid #d3d3d3;
  background: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 11px;
  transition: all 0.2s ease;
  white-space: normal;
  word-wrap: break-word;
  /* Better touch targets for mobile */
  min-height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}
.toolbar button.primary {
  background: #f4f0ec;
  border-color: #c9c1b8;
}
.toolbar button:hover {
  filter: brightness(0.97);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}
.toolbar button:active {
  transform: translateY(0);
}

/* Filtripaneel */
#filterPanel {
  position: absolute;
  bottom: max(80px, calc(env(safe-area-inset-bottom, 0px) + 80px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  width: min(280px, calc(100vw - 24px));
  max-height: 60vh;
  overflow: auto;
  background: rgba(255,255,255,0.96);
  border: 1px solid #e6e1da;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  text-align: left;
  transition: all 0.3s ease;
  opacity: 1;
}
#filterPanel.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}
.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 6px;
}
#toggleAllBtn {
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid #d3d3d3;
  background: #faf9f7;
  border-radius: 8px;
  cursor: pointer;
}
.filters label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px;
  border-radius: 8px;
  cursor: pointer;
}
.filters label:hover { background: #faf7f3; }
.filters small {
  opacity: 0.7;
  margin-left: auto;
}
.badge {
  display: inline-block;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid #e0d9d0;
  font-size: 11px;
  margin-left: 6px;
}
button.lang {
  background: #fff;
  border: 1px solid #ccc;
  font-weight: 600;
  min-width: 36px;
  font-size: 11px;
}
button.toggle-btn {
  background: #fff;
  border: 1px solid #d3d3d3;
  font-weight: 500;
}
button.toggle-btn.active {
  background: #e8f5e9;
  border-color: #81c784;
  box-shadow: 0 0 0 2px rgba(129, 199, 132, 0.2);
}

/* Leaflet Routing Machine - Position fix */
.leaflet-routing-container {
  position: relative;
  top: 70px !important;
  margin-top: 0 !important;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Custom POI icons */
.custom-poi-icon {
  background: white;
  border: 2px solid #4a90e2;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}
.custom-poi-icon:hover {
  transform: scale(1.15);
  z-index: 1000;
}

/* Corridor filter controls */
.corridor {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e8e2da;
}
.corridor label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 0;
}
.corridor-range {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
#corridorKm {
  width: 160px;
  cursor: pointer;
}
#corridorKmValue {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  min-width: 40px;
}
