:root {
  --color-bg: #0E0F11;
  --color-panel: #1A1B1F;
  --color-primary: #1473E6;
  --color-accent: #2D2E33;
  --color-text: #959595;
  --radius: 12px;
  --font-main: 'Roboto', sans-serif;
  --font-size-base: 1rem;
  --icon-size: 24px;
  --input-height: 44px;
}

/* === GLOBAL === */
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-main);
  display: flex;
  flex-direction: column;
  height: 100vh;
  font-size: var(--font-size-base);
}

*, *::before, *::after {
  font-family: var(--font-main) !important;
  font-weight: 400;
  font-style: normal;
}

/* === TOPBAR === */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-panel);
  border-radius: var(--radius);
  padding: 0 1.25rem;
  margin: 10px;
  height: 70px;
  box-sizing: border-box;
  gap: 1rem;
  position: relative;
  z-index: 2000;
}

/* === SECTIONS === */
.left-side, .right-side {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: nowrap;
}
.left-side { gap: 1rem; flex: 1 1 auto; }
.right-side { gap: 0.75rem; flex: 0 0 auto; }

/* === LOGO === */
.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.logo img {
  margin-top: 5px;
  height: 40px;
}

/* === SUCHFELD === */
.search {
  display: flex;
  align-items: center;
  background: var(--color-accent);
  border-radius: 24px;
  padding: 0 1rem;
  height: var(--input-height);
  gap: 0.5rem;
  flex-shrink: 0;
}
.search input {
  background: none;
  border: none;
  outline: none;
  color: var(--color-text);
  font-size: var(--font-size-base);
  width: 200px;
  min-width: 120px;
}
.search .icon {
  height: var(--icon-size);
  opacity: 0.8;
}

/* === SEARCH AUTOCOMPLETE DROPDOWN === */
.search {
    position: relative; /* Wichtig, damit das Dropdown exakt darunter andockt */
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: var(--color-panel);
    border: 1px solid var(--color-accent);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 2000;
    overflow: hidden;
    display: none; /* Standardmäßig versteckt */
    flex-direction: column;
}

.suggestion-item {
    padding: 10px 14px;
    color: var(--color-text);
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--color-accent);
    color: var(--color-primary);
}

/* === BUTTONS === */
.btn, .btn-flat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 24px;
  padding: 10px 20px;
  font-size: var(--font-size-base);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.btn {
  border: 2px solid var(--color-accent);
  background: transparent;
  color: var(--color-text);
}
.btn:hover { background: var(--color-accent); }
.btn-flat {
  border: none;
  background: transparent;
  color: var(--color-text);
}
.btn-flat:hover {
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}
.btn-flat:active, .btn-flat:focus-visible {
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 0 1px var(--color-primary);
  outline: none;
}
.btn-primary {
  background: var(--color-primary);
  border: none;
  color: #fff;
  
  /* FIX: Einheitliche Größe (44px) für alle primären Haupt-Buttons */
  height: 44px;
  padding: 0 20px;
  border-radius: 24px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary:hover {
  background: #0D5AB7;
  border-color: #0D5AB7;
  transition: background 0.25s ease, border-color 0.25s ease;
}
.btn-icon {
  background: none;
  border: 2px solid var(--color-accent);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.btn-icon img { height: var(--icon-size); }
.btn-icon:hover {
  background: var(--color-accent);
  border-color: var(--color-primary);
}

/* === ICONS === */
.btn img.icon,
.btn-flat img.icon,
.zoom-display .icon {
  height: var(--icon-size);
  filter: brightness(1.2) saturate(1.3);
}
.dropdown .icon.small { height: 18px; }

/* === DROPDOWNS === */
.dropdown { position: relative; }
.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === GENERISCHE DROPDOWNS === */
.dropdown-menu, .layer-menu, .color-menu {
  display: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.dropdown.open > .dropdown-menu,
.dropdown.open > .layer-menu,
.dropdown.open > .color-menu {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

/* === DASHBOARD DROPDOWN === */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--color-panel);
  border-radius: 10px;
  border: 1px solid var(--color-accent);
  min-width: 180px;
  z-index: 1000;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  padding: 8px 0;
}
.dropdown-menu a {
  color: var(--color-text);
  opacity: 0.8;
  padding: 10px 16px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.95rem;
  transition: background 0.2s ease, opacity 0.2s ease;
}
.dropdown-menu a img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: 0 0 auto;
}
.dropdown-menu a:hover { background: var(--color-accent); opacity: 1; }
.dropdown-menu hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin: 6px 0;
}
.dropdown-menu .credits {
  padding: 10px 16px;
  font-size: 0.9rem;
  opacity: 0.7;
  color: var(--color-text);
  cursor: default;
}
.dropdown-menu .credits span {
  color: var(--color-primary);
  font-weight: 500;
}

/* === LAYER DROPDOWN (optimiert, alle Thumbnails sichtbar) === */
/* === LAYER DROPDOWN KORRIGIERT === */
.layer-menu {
  position: absolute;
  top: calc(100% + 8px);
  
  /* WECHSEL: Rechtsbündig am Button ausrichten */
  right: 0; 
  left: auto; 

  background: var(--color-panel);
  border-radius: 12px;
  border: 1px solid var(--color-accent);
  padding: 10px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  
  /* Flexibilität */
  width: max-content;
  min-width: 420px;
  max-width: 90vw; /* Verhindert Überlaufen auf kleinen Bildschirmen */
  overflow: hidden;
}

.tile-set-strip {
  position: absolute;
  left: 14px;
  bottom: 10px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.tile-set-collapse {
  width: 30px;
  height: 70px;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
}

.tile-set-collapse img {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.tile-set-strip.collapsed .tile-set-collapse,
.tile-set-strip.collapsed .layer-option:not(.active) {
  display: none;
}

.tile-set-strip.collapsed .layer-option.active {
  border: 2px solid transparent;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.layer-option {
  width: 70px;
  height: 70px;
  box-sizing: border-box;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
  border: 2px solid transparent;
  background: var(--color-accent);
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.layer-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 8px;
}

.layer-option span {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  padding: 3px 4px;
  border-radius: 4px;
  background: rgba(20, 21, 24, 0.72);
  color: #ffffff;
  font-size: 12px;
  line-height: 1;
  text-align: center;
  pointer-events: none;
}

/* Hover- und Active-Effekte bleiben wie gewünscht erhalten */
.layer-option:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 2px var(--color-primary);
}

.layer-option.active {
  border: 3px solid #1473e6;
  box-shadow: inset 0 0 0 1px rgba(20,115,230,0.35);
}

/* === MAP === */
.map-wrapper {
  flex: 1;
  margin: 0 10px 10px 10px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-bg);
  box-sizing: border-box;
}
#map {
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
}

#map.map-generating {
  background: #0e0f11;
  pointer-events: none;
}

#map.map-generating .maplibregl-canvas,
#map.map-generating .maplibregl-marker,
#map.map-generating .maplibregl-control-container {
  opacity: 0;
}

/* === ZOOM-LEVEL ANZEIGE === */
.zoom-display {
  margin-right: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--color-text);
  font-size: 1rem;
  
  /* FIX: Feste Höhe exakt wie die Buttons (44px) */
  height: 44px;
  padding: 0 18px; /* Nur noch horizontales Padding */
  box-sizing: border-box;
  
  border-radius: 24px;
  border: 2px solid var(--color-accent);
  background: transparent;
  user-select: none;
  opacity: 0.95;
}

/* === NAVIGATION LINKS === */
.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-left .divider {
  color: var(--color-accent);
  font-weight: 300;
  font-size: 2.2em;
}




/* === MODAL SYSTEM === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999 !important;
  backdrop-filter: blur(2px);
}
.modal.show { display: flex; }

.modal-content {
  background: #1A1B1F;
  border-radius: 14px;
  border: 1px solid #2D2E33;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
  padding: 10px;
  width: 400px;
  max-width: 94vw;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 {
  font-size: 1.4rem;
  font-weight: 400;
  color: #48494c;
  margin: 0 0 0 10px;
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.modal-close img {
  height: 24px;
  transition: opacity 0.2s ease;
}
.modal-close:hover img { opacity: 1; }
.modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* === INPUT ELEMENTE === */
.input-row { display: flex; align-items: center; gap: 10px; }
.input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0E0F11;
  border-radius: 24px;
  padding: 0 12px;
  height: 44px;
  width: 270px;
}
.input-bar .icon {
  height: var(--icon-size);
  width: var(--icon-size);
  flex-shrink: 0;
}
.input-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text);
  font-size: 0.95rem;
}
.input-bar input::placeholder {
  color: #ccc;
  opacity: 0.7;
}

/* === BUTTON RUND === */
.btn-round {
  background: #1473E6;
  border: none;
  border-radius: 24px;
  height: 44px;
  padding: 0 18px;
  font-size: 0.9rem;
  color: #fff;
  cursor: pointer;
  transition: background 0.25s ease;
}
.btn-round:hover { background: #0D5AB7; }

/* === MOBILE DESKTOP NOTICE === */
.mobile-desktop-notice-content {
  width: 360px;
  max-width: calc(100vw - 32px);
  padding: 24px;
}

.mobile-desktop-notice-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.mobile-desktop-notice-body h2 {
  color: #fff;
  font-size: 1.45rem;
  line-height: 1.2;
  margin: 0;
}

.mobile-desktop-notice-body p {
  color: var(--color-text);
  font-size: 0.95rem;
  line-height: 1.45;
  margin: 0;
}

.mobile-desktop-notice-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.mobile-desktop-notice-actions .btn-round {
  min-width: 128px;
  background: #2D2E33;
  border: 1px solid #48494c;
  color: #fff;
  font-size: 0.95rem;
}

.mobile-desktop-notice-actions .btn-round:hover {
  background: #3A3B40;
}

.mobile-desktop-notice-actions .mobile-desktop-continue {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.mobile-desktop-notice-actions .mobile-desktop-continue:hover {
  background: #0D5AB7;
  border-color: #0D5AB7;
}

@media (max-width: 420px) {
  .mobile-desktop-notice-actions {
    flex-direction: column;
  }

  .mobile-desktop-notice-actions .btn-round {
    width: 100%;
  }
}

/* === MODAL BLOCKS === */
.modal-block {
  background: #2D2E33;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 4px;
}
.tag {
  background: #2D2E33;
  border: 1px solid #0E0F11;
  border-radius: 24px;
  padding: 8px 16px;
  font-size: 0.9rem;
  color: var(--color-text);
  opacity: 0.9;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.1s ease;
}
.tag:hover { background: #1473E6; transform: scale(1.05); }

/* === GPS IMPORT MODAL === */
#gpsImportModal .modal-content {
  width: 380px;
  max-width: 94vw;
}
#gpsImportModal .input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}
#gpsImportModal .input-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0E0F11;
  border-radius: 24px;
  padding: 0 12px;
  height: 44px;
  width: 100%;
}
#gpsImportModal .input-bar .icon {
  height: var(--icon-size);
  width: var(--icon-size);
  flex-shrink: 0;
  opacity: 0.9;
}
#gpsImportModal .input-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text);
  font-size: 0.95rem;
}
#gpsImportModal .input-bar input[readonly] {
  cursor: default;
  font-size: 0.9rem;
}
#browseTrack { flex-shrink: 0; }
#gpsImportModal .option-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
}
#gpsImportModal .dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  height: 44px;
  border-radius: 24px;
  background: transparent;
  border: 1px solid #0E0F11;
  color: var(--color-text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s ease;
}
#gpsImportModal .dropdown-toggle:hover {
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}

/* === SLIDER === */
input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: #2b2c30;
  outline: none;
  transition: background 0.2s ease;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 18px;
  border-radius: 9px;
  background: #1A1B1F;
}
input[type="range"]::-moz-range-track {
  height: 18px;
  border-radius: 9px;
  background: #1A1B1F;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1473E6;
  transition: transform 0.15s ease, background 0.2s ease;
  margin-top: -4px;
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1473E6;
  border: none;
}
input[type="range"]:hover::-webkit-slider-thumb {
  background: #1b83ff;
  transform: scale(1.15);
}
input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.2);
}
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.slider-row label,
.slider-row span {
  color: #969699;
  font-size: 0.9rem;
}
.slider-row label { min-width: 70px; white-space: nowrap; }
.slider-row span { min-width: 40px; text-align: right; }

/* === DROPDOWNS: COLOR + SIZE === */
.color-menu, .size-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--color-panel);
  border-radius: 10px;
  border: 1px solid var(--color-accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  z-index: 1500;
}
.color-menu {
  padding: 10px;
  flex-direction: column;
  gap: 8px;
  width: 155px;
}
.color-option {
  width: 100%;
  height: 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.color-option:hover {
  transform: scale(1.1);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}
[data-color-target] .icon {
  height: var(--icon-size);
  width: var(--icon-size);
  flex-shrink: 0;
  color: #F1C40F;
  stroke: currentColor;
  transition: color 0.25s ease;
}
.size-menu {
  padding: 8px;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}
.dropdown.open > .color-menu,
.dropdown.open > .size-menu { display: flex; }
.size-option {
  color: #ccc;
  font-size: 0.9rem;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  transition: background 0.15s ease, color 0.15s ease;
}
.size-option span { opacity: 0.7; font-size: 0.85rem; }
.size-option:hover {
  background: rgba(255,255,255,0.08);
  color: var(--color-text);
}
.size-option.active {
  color: var(--color-primary);
  font-weight: 500;
}

/* === LAPTOP (Zwischenstufe: 1171px - 1450px) === */
@media (max-width: 1450px) and (min-width: 1171px) {
  .topbar {
    padding: 0 10px;
  }
  .left-side { gap: 10px; }
  .right-side { gap: 8px; }
  
  .search input {
    width: 120px;
    min-width: 100px;
  }
  
  .btn, .btn-flat {
    padding: 0 12px !important;
    font-size: 0.85rem !important;
    gap: 6px !important;
  }
  
  #openProjectsLink.btn-flat,
  .btn-green,
  .btn-primary {
    padding: 0 14px !important;
    font-size: 0.85rem !important;
  }

  .btn img.icon, .btn-flat img.icon, .zoom-display .icon {
    height: 20px !important;
  }

  .nav-left .divider {
    margin: 0 4px !important;
  }
  
  .zoom-display {
    padding: 0 10px;
    margin-right: 0px;
    font-size: 0.9rem;
  }
}

/* === RESPONSIVE (Tablet & Mobile ab 1170px) === */
@media (max-width: 1170px) {
  .topbar {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: auto;
    padding: 0.75rem;
    gap: 0.75rem;
  }
  .logo, #fullscreenToggle { display: none; }
  .left-side, .right-side {
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 10px;
  }
  .search {
    width: 92%;
    max-width: 480px;
    justify-content: center;
  }
  .search input { width: 100%; text-align: center; }
  .nav-left {
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
  }
  .nav-left .divider { display: none; }
  .btn, .btn-flat {
    padding: 8px 14px;
    font-size: 0.95rem;
  }
  .btn img.icon, .btn-flat img.icon { height: 18px; }

  /* Layer Dropdown mobile */
  .layer-menu {
    position: fixed !important;
    top: 70px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: var(--color-panel);
    border-radius: 10px;
    border: 1px solid var(--color-accent);
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 8px;
    flex-wrap: nowrap;
    width: max-content;
    max-width: 95vw;
    overflow: hidden;
    z-index: 1200;
  }
  .layer-menu .layer-option {
    width: 52px;
    height: 52px;
    border-radius: 8px;
  }
  .layer-menu .layer-option img { border-radius: 6px; }

  /* Dashboard Dropdown: volle Breite */
  .dropdown-menu {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 0;
    border: none;
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
    background: var(--color-panel);
    z-index: 1200;
  }
  .map-wrapper { margin: 0 5px 5px 5px; }
  .zoom-display { display: none !important; }
}

/* === CUSTOM LEAFLET TOOLBAR === */
.map-wrapper {
  position: relative; /* Sehr wichtig, damit die Toolbar nicht aus dem Bildschirm fliegt */
}

.custom-map-toolbar {
  position: absolute;
  top: 50%;
  left: 20px;
  transform: translateY(-50%); /* Exakt vertikal zentriert */
  background: var(--color-panel);
  border: 1px solid var(--color-accent);
  border-radius: 30px; /* Erzeugt die Pille-Form */
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  width: 50px; /* Feste Breite für das Menü */
}

.custom-map-toolbar .toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  align-items: center;
}

.custom-map-toolbar button {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%; /* Runde Hover-Effekte */
  transition: background 0.2s ease;
  padding: 0;
}

.custom-map-toolbar button:hover {
  background: var(--color-accent);
}

.custom-map-toolbar button.active,
.custom-map-toolbar button[aria-expanded="true"] {
  background: var(--color-accent);
}

.custom-map-toolbar button img {
  width: var(--icon-size, 24px);
  height: var(--icon-size, 24px);
  filter: brightness(1.2) saturate(1.3);
  opacity: 0.7;
  transition: opacity 0.2s ease, transform 0.1s ease;
}

.custom-map-toolbar button:hover img {
  opacity: 1;
  transform: scale(1.05);
}

.shape-tool {
  position: relative;
  width: 40px;
  height: 40px;
}

.shape-tool-main {
  position: relative;
}

.custom-map-toolbar button .shape-tool-flyout-cue {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 9px;
  height: 9px;
  opacity: 0.9;
  filter: brightness(1.45);
  pointer-events: none;
  transform: none;
}

.custom-map-toolbar button:hover .shape-tool-flyout-cue {
  opacity: 1;
  transform: none;
}

.shape-tool-flyout {
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  transform: translateY(-50%) scaleX(0.92);
  transform-origin: left center;
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 5px;
  background: var(--color-panel);
  border: 1px solid var(--color-accent);
  border-radius: 24px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.shape-tool.open .shape-tool-flyout,
.shape-tool:focus-within .shape-tool-flyout {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scaleX(1);
}

.custom-map-toolbar .shape-tool-flyout button {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
}

.custom-map-toolbar .shape-tool-flyout button img {
  width: 22px;
  height: 22px;
}

.custom-map-toolbar .toolbar-divider {
  width: 60%;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 10px 0;
}


#countrySuggestions {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background: #1A1B1F;
    border: 1px solid #2D2E33;
    border-radius: 8px;
    z-index: 11000; /* Höher als das Modal-Inhalt */
    display: none;
    flex-direction: column;
}

/* === CUSTOM RADIO BUTTONS (COUNTRY SHAPE MODAL) === */
.resolution-selector {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
  padding: 5px 10px;
}

.custom-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.custom-radio:hover {
  color: #fff; /* Leichter Highlight-Effekt auf dem Text beim Hovern */
}

/* Originalen Radio-Button verstecken */
.custom-radio input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

/* Der dunkle Kreis (passend zur Searchbar) */
.radio-mark {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #0E0F11; 
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05); /* Ganz leichte Kontur */
  transition: box-shadow 0.2s ease;
}

/* Der blaue Punkt in der Mitte (standardmäßig unsichtbar) */
.radio-mark::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-primary); /* Dein schönes Blau */
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Wenn Radio ausgewählt ist -> blauen Punkt anzeigen */
.custom-radio input:checked ~ .radio-mark::after {
  opacity: 1;
  transform: scale(1);
}

.custom-radio input:checked ~ .radio-mark {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); /* Kontur etwas heller machen */
}

/* ==========================================
   PROJECTS SIDEBAR (My Maps)
   ========================================== */
/* Update den existierenden .map-wrapper, damit er ein Flex-Layout wird */
.map-wrapper {
    flex: 1;
    position: relative;
    display: flex; /* Zwingt Map und Sidebar nebeneinander */
    margin: 0 10px 10px 10px;
    border-radius: var(--radius);
    overflow: hidden;
    gap: 10px; /* Abstand zwischen Karte und Projekt-Sidebar */
}

/* Update die #map, damit sie flexibel schrumpft, wenn das Panel öffnet */
#map {
    flex: 1; 
    height: 100%;
    background: #111;
    z-index: 1;
    border-radius: var(--radius);
}

/* Die korrigierte Sidebar-Klasse */
.projects-sidebar {
    width: 320px;
    background: var(--color-panel);
    border-radius: var(--radius);
    display: none; /* Standardmäßig ausgeblendet */
    flex-direction: column;
    flex-shrink: 0;
    padding: 15px;
    box-sizing: border-box;
    gap: 15px;
    z-index: 1000;
    
    /* --- SCROLL-FIX: Sidebar darf nicht wachsen --- */
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Wird per JS hinzugefügt, um die Sidebar sauber als Flex-Block einzublenden */
.projects-sidebar.active {
    display: flex;
}

.projects-header h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text);
    font-weight: 400;
}

.projects-filters {
    display: flex;
    background: var(--color-bg);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--color-text);
    border-radius: 6px;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
}

.filter-btn.active {
    background: #3d3e44;
    color: #fff;
}

.projects-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: max-content;
    gap: 12px;
    align-content: flex-start;
    
    /* --- SCROLLBAR OVERLAP FIX --- */
    margin-right: -8px;   /* Schiebt den Scroller weiter nach rechts in den Rand */
    padding-right: 14px;  /* Hält die Bilder auf sicherem Abstand zum Scroller */
    
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* Custom Scrollbar for the grid */
.projects-grid::-webkit-scrollbar { width: 6px; }
.projects-grid::-webkit-scrollbar-track { background: transparent; }
.projects-grid::-webkit-scrollbar-thumb { background: #2b2c30; border-radius: 4px; }

.project-card {
    background: #2D2E33;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    flex-shrink: 0; /* <-- FIX 2: Verbietet Flexbox, die Karte zu stauchen */
}

.project-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.project-card.deleting {
    opacity: 0.55;
    pointer-events: none;
}

.project-thumb {
    width: 100%;
    aspect-ratio: 4/3;
    background: #0E0F11;
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.project-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-purchased-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 42px;
    height: 42px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 42px;
    height: 42px;
    background: rgba(0, 0, 0, 0.5);
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.project-delete-btn:hover,
.project-delete-btn:focus-visible {
    background: #2a2b31;
    outline: none;
}

.project-delete-btn:active {
    transform: scale(0.94);
}

.project-purchased-badge img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.project-delete-btn img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: brightness(1.7);
    opacity: 0.9;
}

.project-info {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.project-name {
    font-size: 0.8rem;
    color: var(--color-primary);
    font-weight: 500;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Maximal 2 Zeilen für lange Namen */
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em; /* Hält die Boxhöhe gleich, auch bei kurzen Namen */
}

.project-date {
    font-size: 0.65rem;
    color: #888;
}


/* ============================================================
 * OPTICAL REFINEMENT FOR "YOUR MAPS" PILL BUTTON
 * ============================================================ */
#openProjectsLink.btn-flat {
    background: transparent !important;                    /* Keinen fetten Hintergrund */
    color: #ffffff !important;                            /* Reinweißer Text */
    border: 2px solid var(--color-accent) !important;     /* Feine graue Kontur aus deiner Farbvariable */
    border-radius: 24px !important;                       /* Perfekt abgerundete Pillenform */
    padding: 10px 20px !important;                        /* Identischer Innenabstand wie der grüne Button */
    height: 44px !important;                              /* Gleiche Standardhöhe wie Download Map */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;                                 /* Abstand zwischen Karten-Icon und Text */
    font-size: var(--font-size-base) !important;
    font-weight: 400 !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    transition: background 0.25s ease, border-color 0.25s ease !important;
}

/* Dezent grauer Background beim Drüberfahren (matcht deine .btn:hover Logik) */
#openProjectsLink.btn-flat:hover {
    background: var(--color-accent) !important;
    color: #ffffff !important;
}

/* Sorgt dafür, dass das Icon im Button sauber weiß bleibt und die richtige Größe hat */
#openProjectsLink.btn-flat img.icon {
    height: var(--icon-size) !important;
    width: var(--icon-size) !important;
    filter: brightness(1) invert(0) !important;           /* Verhindert ungewollte Einfärbungen */
    opacity: 0.9 !important;
}

/* Keep main-menu hover pills stable when responsive padding changes. */
#openAdvSearchBtn.btn-flat,
#openGpsImportBtn.btn-flat,
.topbar .nav-left a > .btn-flat {
    min-height: 44px !important;
    height: 44px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
}
