/* ===== Allgemein ===== */
html,
body {
  height: 100%;
  margin: 0;
  font-family: system-ui, sans-serif;
}

h3 {
  display: block;
  font-size: 1.17em;
  margin-block-start: 0em;
  margin-block-end: 0em;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
  font-weight: bold;
  unicode-bidi: isolate;
}

.leaflet-routing-container-hide .leaflet-routing-collapse-btn {
  position: relative;
  left: 1px;
  top: -1px;
  display: block;
  width: 26px;
  height: 23px;
}

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

/* ===== Toasts ===== */
#toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: rgba(255, 255, 255, 0.95);
  color: #222;
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(6px);
  animation: fadein 0.3s ease, fadeout 0.6s ease 4s forwards;
  pointer-events: auto;
  position: relative;
  z-index: 5000;
}

@keyframes fadein {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeout {
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ===== Leaflet Controls ===== */
.leaflet-control {
  z-index: 500;
}

.leaflet-control-geocoder {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.leaflet-control-geocoder input {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  width: 160px;
}

.leaflet-control-layers {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  font-size: 13px;
  margin-top: 180px;
}

/* ===== POI Icons ===== */
.poi-icon {
  text-align: center;
  line-height: 24px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.poi-bubble {
  background: #fff;
  border: 2px solid #0078ff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.poi-bubble:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.poi-symbol {
  font-size: 22px;
  user-select: none;
}

/* ===== Button Zustand Aktiv ===== */
button.active {
  background-color: #0074D9 !important;
  color: #fff !important;
  border: 1px solid #005fa3 !important;
}

button.active:hover {
  background-color: #005fa3 !important;
}

/* ===== Floating Undo/Redo Buttons ===== */
.floating-buttons {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: row;
  gap: 10px;
  z-index: 1200;
}

.floating-buttons button {
  background: #ffffffee;
  color: #222;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 20px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: all 0.2s ease;
}

.floating-buttons button:hover {
  background: #0074D9;
  color: #fff;
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.floating-buttons button:active {
  transform: scale(0.95);
}

/* ===== Route Info oben links ===== */
#routeInfo {
  position: fixed;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  padding: 8px 12px;
  z-index: 1100;
  font-size: 14px;
  backdrop-filter: blur(6px);
}

#routeInfo .speed-control {
  margin-top: 4px;
}

/* =========================================================
   === INTEGRIERTE SIDEBAR-DESIGNS MIT EINGEBAUTEM TOGGLE ===
   ========================================================= */

#menuSidebar {
  position: fixed;
  right: 0;
  top: 20%;
  width: 280px;
  max-height: 70vh;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 16px 0 0 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transform: translateX(100%);
  transition: transform 0.35s ease, opacity 0.35s ease;
  z-index: 1050;
  overflow-y: auto;
  padding: 14px;
  opacity: 0;
  pointer-events: none;
}

#menuSidebar.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

#menuSidebarToggle {
  position: fixed;
  right: 20px;
  top: 40%;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease, opacity 0.3s ease;
  z-index: 1060;
}

#menuSidebarToggle:hover {
  background: rgba(0, 120, 255, 0.9);
  color: #fff;
  transform: scale(1.1);
}

#menuSidebar.open~#menuSidebarToggle {
  opacity: 0;
  pointer-events: none;
}

#poiSidebar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 100%);
  width: 90%;
  max-width: 480px;
  max-height: 60vh;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.35s ease, opacity 0.35s ease;
  z-index: 1050;
  overflow-y: auto;
  padding: 14px;
  opacity: 0;
  pointer-events: none;
}

#poiSidebar.open {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

/* === Integrierte Sidebar-Toggle Buttons === */
.sidebar-toggle {
  position: absolute;
  background: #fff;
  color: #222;
  border: none;
  padding: 5px 8px;
  cursor: pointer;
  font-size: 24px;
  transition: all 0.3s ease;
  z-index: 10;
  border-radius: 8px 0 0 8px;
}

/* Buttons rechts außen platzieren */
#menuSidebar .sidebar-toggle {
  top: 80%;
  left: -40px;
  transform: translateY(-50%);
}

#poiSidebarToggle {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  color: #222;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease, opacity 0.3s ease;
  z-index: 1060;
}

#poiSidebarToggle:hover {
  background: rgba(0, 120, 255, 0.9);
  color: #fff;
  transform: translateX(-50%) scale(1.1);
}

/* === Wenn Sidebar offen, Button oberhalb platzieren === */
#poiSidebar.open~#poiSidebarToggle {
  opacity: 0;
  pointer-events: none;
}

/* === POI List === */
#poiList {
  list-style: none;
  margin: 0;
  padding: 0;
}

#poiList li {
  padding: 8px 6px;
  border-bottom: 1px solid #ddd;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s ease;
}

#poiList li:hover {
  background: rgba(0, 120, 255, 0.1);
}

#poiSidebar::-webkit-scrollbar {
  width: 6px;
}

#poiSidebar::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

#poiSidebar button {
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
}

#poiSidebar button:disabled {
  opacity: 0.5;
  cursor: default;
}

#poiPagination {
  background: #f9f9f9;
}

.leaflet-marker-icon {
  transition: opacity 0.25s ease;
}

/* === General Button Redesign === */
button {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(6px);
}

button:hover {
  background: rgba(0, 120, 255, 0.9);
  color: white;
  border-color: rgba(0, 120, 255, 0.6);
  box-shadow: 0 2px 6px rgba(0, 120, 255, 0.3);
  transform: translateY(-1px);
}

button:active {
  transform: scale(0.97);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* === Sidebar Buttons (innerhalb der Panels) === */
#menuSidebar button,
#poiSidebar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 500;
  margin: 4px 3px;
}

#menuSidebar button:hover,
#poiSidebar button:hover {
  background: rgba(0, 120, 255, 0.9);
  color: #fff;
}

/* === Sidebar Titles === */
#menuSidebar h3,
#poiSidebar h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #0078ff;
}

/* === Input Fields === */
#menuSidebar input[type="text"],
#menuSidebar select {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 14px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.8);
}

#menuSidebar input[type="text"]{
  width: 262px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 14px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.8);
}

#menuSidebar input[type="text"]:focus,
#menuSidebar select:focus {
  outline: none;
  border-color: #0078ff;
  box-shadow: 0 0 0 2px rgba(0, 120, 255, 0.2);
}

/* === Floating Buttons (Undo/Redo, Sidebar Toggles) === */
.floating-buttons button,
.sidebar-toggle {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  border: none;
  font-size: 20px;
  transition: all 0.2s ease;
}

.floating-buttons button:hover,
.sidebar-toggle:hover {
  background: rgba(0, 120, 255, 0.9);
  color: #fff;
  transform: scale(1.1);
}

/* === POI List Improvements === */
#poiList li {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.7);
  margin-bottom: 4px;
  border-radius: 8px;
  transition: background 0.2s ease;
}

#poiList li:hover {
  background: rgba(0, 120, 255, 0.1);
}

/* === Pagination === */
#poiPagination {
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding: 8px 10px;
  border-radius: 0 0 12px 12px;
}

/* === Standort-Fokus-Button === */
#locateButton {
  background: rgba(255, 255, 255, 0.9);
  color: #0078ff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 20px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
}

#locateButton:hover {
  background: #0078ff;
  color: #fff;
  transform: scale(1.05);
}

/* === Mobile UI-Optimierung (unter 768px) === */
@media (max-width: 768px) {

  /* Sidebar Höhe begrenzen */
  #poiSidebar {
    width: 94vw !important;
    max-height: 70vh !important;
    padding: 10px !important;
  }

  #menuSidebar {
    width: 80vw !important;
    max-height: 80vh !important;
    padding: 10px !important;
  }

  #menuSidebarToggle {
    right: 6px;
  }


  #poiSidebarToggle {
    bottom: 6px;
  }


  
  /* Beschreibungen ausblenden */
  #poiList li small {
    display: none !important;
  }

  /* Etwas kompaktere Darstellung */
  #poiList li {
    padding: 10px 8px;
    border-bottom: 1px solid #ddd;
  }

  /* Schriftgrößen leicht reduzieren */
  #poiList li strong {
    font-size: 15px;
  }

  /* --- Buttons allgemein --- */
  button {
    font-size: 13px !important;
    padding: 4px 6px !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  }

  /* Sidebar Buttons */
  #menuSidebar button,
  #poiSidebar button {
    margin: 2px;
    gap: 4px;
  }

  /* --- Inputs & Selects --- */
  #menuSidebar input[type="text"],
  #menuSidebar select {
    font-size: 13px;
    padding: 4px 6px;
    border-radius: 6px;
  }

  /* --- Sidebar Container --- */
  #menuSidebar,
  #poiSidebar {
    width: 220px;
    padding: 10px;
  }

  /* --- Floating Buttons (Undo/Redo, Toggles) --- */
  .floating-buttons button,
  .sidebar-toggle {
    width: 38px !important;
    height: 38px !important;
    font-size: 18px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  }

  /* --- Sidebar Titel --- */
  #menuSidebar h3,
  #poiSidebar h3 {
    font-size: 15px;
    margin-bottom: 6px;
  }

  /* --- POI Liste kompakter --- */
  #poiList li {
    padding: 6px 5px;
    font-size: 13px;
  }

  #poiList li strong {
    font-size: 14px;
  }

  /* --- Pagination Buttons --- */
  #poiPagination button {
    font-size: 12px;
    padding: 4px 6px;
  }

  /* --- Geschwindigkeit & Route-Info --- */
  #routeInfo {
    width: 55%;
    font-size: 13px;
    padding: 2px 4px;
  }

  /* --- Toasts kompakter --- */
  .toast {
    font-size: 12px;
    padding: 8px 12px;
  }

  #locateButton {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .floating-buttons {
    top: 12px;
    right: 12px;
    gap: 8px;
  }
}

/* ===== Globale POI Layer Auswahl ===== */
#menuSidebar label[for="globalPoiSelect"] {
  display: block;
  font-weight: 600;
  color: #0078ff;
  margin-bottom: 6px;
  margin-top: 10px;
  font-size: 14px;
}

#globalPoiSelect {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.9);
  margin-bottom: 6px;
  transition: all 0.2s ease;
}

#globalPoiSelect:focus {
  outline: none;
  border-color: #0078ff;
  box-shadow: 0 0 0 2px rgba(0, 120, 255, 0.2);
}

#loadGlobalPOIs {
  width: 100%;
  padding: 8px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#loadGlobalPOIs:hover {
  background: rgba(0, 120, 255, 0.9);
  color: #fff;
  border-color: rgba(0, 120, 255, 0.6);
  transform: translateY(-1px);
}

#menuSidebar button {
  pointer-events: auto !important;
}

#routeStats .stats div + div {
  margin-top: 2px;
  font-size: 13px;
  color: #444;
}

#elevationChart {
  position: absolute;
  top: 100px;
  padding: 5px;
  height: 70px;
  display: none;
  background: rgba(255, 255, 255, 1);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 1000;
}

/* === Vollbild-Overlay === */
#routeLoadingOverlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(6px);
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}

/* Container mit Spinner + Text */
#routeLoadingOverlay .overlay-content {
  text-align: center;
}

/* Drehender Kreis */
#routeLoadingOverlay .spinner {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(0, 120, 255, 0.2);
  border-top-color: #0078ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px auto;
}

/* Text */
#routeLoadingOverlay .overlay-text {
  font-size: 18px;
  font-weight: 500;
  color: #333;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.7);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Fahrrad-Emoji fährt hin und her === */
.bike-spinner {
  font-size: 48px;
  animation: bikeMove 2.2s ease-in-out infinite;
  display: inline-block;
}

@keyframes bikeMove {
  0%   { transform: translateX(-60px) scaleX(-1); }
  45%  { transform: translateX(60px)  scaleX(-1); }
  50%  { transform: translateX(60px)  scaleX(1); } /* Wende, Blickrichtung wechseln */
  95%  { transform: translateX(-60px) scaleX(1); }
  100% { transform: translateX(-60px) scaleX(-1); }
}

/* Optional leichtes Auf-und-Ab für mehr Dynamik */
.bike-spinner::after {
  content: "";
  display: block;
  position: absolute;
  width: 0;
  height: 0;
  animation: bikeBounce 1.1s ease-in-out infinite;
}

@keyframes bikeBounce {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-3px); }
}

.mountain-icon {
  font-size: 18px;
  opacity: 1;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5));
  user-select: none;
  pointer-events: none;
}

/* === Berg-Emoji im Kreis === */
.mountain-icon-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 1);
  border: 2px solid rgba(0, 120, 255, 0.7);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  font-size: 14px;
  line-height: 1;
  user-select: none;
  pointer-events: none;
}

#poiLoadingText {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 99999;
  display: none;
  pointer-events: none;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}



.poi-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

#terrainBarWrapper {
  position: absolute;
  top: 180px; /* oder elevationChart.top + 70 + spacing */
  left: 10px;
  width: 300px;
}

#terrainBar {
  height: 14px;
  background: #f0f0f0;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
