:root {
    --primary-color: #4a90e2;
    --background-light: #f4f4f4;
    --text-color: #333;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: sans-serif;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5em 1em;
    background-color: var(--background-light);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.app-header h1 {
    display: flex;
    align-items: center;
    font-size: 1.2em;
    color: var(--primary-color);
}

.app-header h1 svg {
    margin-right: 0.5em;
    width: 1.5em;
    height: 1.5em;
}


a {
  display: inline-block;
  padding-left: .5em;
  text-decoration: none;  
}
.formbox {
    position: absolute;
    top: 1em;
    right: 1em;
    z-index: 1000;
    background: var(--background-light);
    padding: 1em;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    max-width: 300px;
    transition: all 0.3s ease;
}

.formbox-content {
    display: block;
}

.formbox.minimized {
    width: 40px;
    height: 40px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.formbox.minimized.with-labels {
    width: auto;
    height: auto;
    padding: 6px;
    overflow: visible;
    min-width: 100px; /* je nach Textinhalt anpassen */
}

.formbox-minimized-content {
    display: none;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 4px;
    gap: 0.5em;
}

.formbox-labels {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.formbox-label {
    font-size: 0.85em;
    color: var(--text-color, #333);
}

.formbox-icon {
    font-size: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.formbox.minimized .formbox-content {
    display: none;
}

.formbox.minimized .formbox-minimized-content {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  height: 100%;
  gap: 0.5em;
}

/* Labels nur anzeigen, wenn auch with-labels gesetzt ist */
.formbox.minimized:not(.with-labels) .formbox-labels {
  display: none;
}

/* Nur Icon? Dann zentrier Icon vollständig */
.formbox.minimized:not(.with-labels) .formbox-minimized-content {
  justify-content: center;
}


/*
.formbox-icon {
    font-size: 1.5em;
    pointer-events: none; Damit Klicks auf das Icon trotzdem das DIV treffen 
}

.formbox:not(.minimized) .formbox-icon {
    display: none;
}
*/
.icon-car {
    color: red;
    animation: wiggleRight 4.0s ease-in-out infinite;
}

.icon-arrow {
    color: blue;
    animation: none; /* sicherheitshalber überschreiben */
}

.formbox label {
    display: block;
    margin-bottom: 0.5em;
}

.formbox input[type="text"] {
    width: 100%;
    max-width: 300px;
    padding: 0.3em;
    box-sizing: border-box;
}

.error-text {
    color: red;
    font-size: 0.9em;
    display: block;
    margin-bottom: 0.5em;
}

#autoSearchContainer input[type="checkbox"] {
  transform: scale(0.9);
}

@keyframes wiggleRight {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(3px); }
  50%  { transform: translateX(0); }
  75%  { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

button.navigating .car-icon {
  display: inline-block;
  animation: wiggleRight 4.0s ease-in-out infinite;
}

#ueberMap {
    position: relative; /* Erforderlich für z-index */
    z-index: 4000; /* Höher als die Map (nur einmal definieren) */
    padding: 0.5em 1em;
    background: var(--background-light);
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: visible; /* Einzige overflow-Deklaration (ohne !important, falls nicht nötig) */
}

/* Nur wenn nötig: Ausnahmefall für versteckten Zustand */
#ueberMap.hidden {
    overflow: hidden; /* Erst hier overflow überschreiben */
    max-height: 0;
    opacity: 0;
    padding: 0;
    pointer-events: none;
}

legend { /* der Rahmen um die Kategorien */
    font-weight: bold;
    font-size: 0.9em;
    color: var(--primary-color);
    padding: 0 0.5em;
}

.categories-container {
    display: flex;
    align-items: center;
    gap: 1em;
    width: 100%;
}

fieldset {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.5em;
    flex: 1;
    min-width: 0;
}

.close-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: #888;
}

.close-button:hover {
    color: #000;
}

.info.legend {
  background: rgba(255, 255, 255, 0.8); /* Weißer Hintergrund mit 80% Transparenz */
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

#dropdownToggle {
    width: 100%;
    background-color: white;
    border: 1px solid #ddd;
    padding: 0.5em;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5em;
}

#dropdownToggle .arrow {
  margin-left: auto;
  font-size: 0.9em;
  color: #555;
  transition: transform 0.2s ease;
}


.dropdown-menu {
    position: absolute;
    z-index: 5000; /* Höher als alle anderen Elemente */
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #ddd;
    max-height: 440px;
    overflow-y: auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.dropdown-menu label {
    display: block;
    padding: 0.5em;
    cursor: pointer;
}

.dropdown-menu label:hover {
    background-color: #f0f0f0;
}

#map {
    position: relative; /* wichtig für absolute Kinderpositionierung */
    z-index: 1; /* Niedriger als die ueberMap */
    width: 100%;
    flex-grow: 1;
    min-height: 0;
}

.control-buttons {
    display: flex;
    gap: 0.5em;
}

.control-buttons button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    color: var(--primary-color);
}

#searchStatus {
    flex: 1;
    font-style: italic;
    color: #555;
    text-align: right;
}

/* Modal and loader styles remain the same as in previous CSS */

.modal {
    display: none;
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
}

.modal-content {
    position: relative;
    background-color: #ffffff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    font-family: 'Segoe UI', sans-serif;
    color: #333;
    line-height: 1.5;
}

.modal-content h2, .modal-content h3 {
    margin-top: 0;
    font-weight: 600;
}


.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-content label {
    display: block;
    margin: 10px 0;
    cursor: pointer;
}

.modal-content select {
    padding: 6px;
    margin-top: 6px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 1rem;
}

.close-modal {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s ease-in-out;
}

.close-modal:hover {
    color: #333;
}

.header-controls {
    display: flex;
    gap: 0.5em;
}
     
.header-controls button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    color: var(--primary-color);
}

.loader-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 5px solid lightgray;
    border-top: 5px solid blue;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.poi-status {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    font-size: 14px;
    z-index: 5000;
}

.hidden { 
    display: none !important; 
}

#abort-search {
  font-size: 16px;
  line-height: 1;
  color: #666;
  transition: color 0.2s;
}

#abort-search:hover {
  color: #d33;
}

.fullscreen-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.fullscreen-button:hover {
    background: rgba(0, 0, 0, 0.7);
}


/* TODO: geht nicht */
/* Benutzerdefiniertes CSS, um die Symbole in den Zoom-Buttons zu zentrieren */
.leaflet-control-zoom-in, .leaflet-control-zoom-out {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-header h1 {
        font-size: 1em;
    }

    .app-header svg {
        width: 1.2em;
        height: 1.2em;
    }

    .categories-container {
        flex-direction: column;
        gap: 0.5em;
    }

    fieldset {
        width: 100%;
    }

    #searchStatus {
        text-align: center;
        margin-top: 0.5em;
    }
}

/* Landscape mode on mobile */
@media screen and (orientation: landscape) and (max-width: 768px) {
    .info.legend {
        display: none !important;
    }
}

/* alles auswählen nichts auswählen bei den Kategorien */
.select-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.select-buttons button {
  padding: 0.4rem 0.8rem;
  background-color: #0077cc;
  color: white;
  border: none;
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.select-buttons button:hover {
  background-color: #005fa3;
}

.select-buttons button:active {
  transform: scale(0.97);
}

#customAlert {
    display: none;
    position: fixed;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #f44336;
    color: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    z-index: 4000;
}

/* kreis um icon zur darstellung ob wakelock */
/* Standardmäßig unsichtbar */
.rticon-circle {
    display: none;
}

/* Sichtbar machen mit zusätzlicher Klasse */
.rticon.with-circle .rticon-circle {
    display: inline;
}

/* debug toggle button und bereich */

#logToggle {
  position: fixed;
  bottom: 1em;
  left: 50%;
  transform: translateX(-50%);
  /* right: 1em; */
  background: #333;
  color: white;
  padding: 0.4em 0.6em;
  border-radius: 0.4em;
  font-size: 1.5em;
  cursor: pointer;
  z-index: 9999;
}

#logPanel {
  position: fixed;
  bottom: 3.5em;
  right: 1em;
  width: 90vw;
  max-height: 50vh;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-family: monospace;
  font-size: 0.9em;
  padding: 0.5em;
  overflow-y: auto;
  z-index: 9998;
  border-radius: 0.5em;
  white-space: pre-wrap;
  box-shadow: 0 0 10px #000;
}

.speech-stop-bar {
    position: fixed;
    top: 25px; /* Passe ggf. an deine Header-Höhe an */
    left: 0;
    width: 100%;
    background-color: #ffcccc;
    text-align: center;
    z-index: 9000;
}

.speech-stop-bar button {
    width: 100%;
    padding: 1em;
    font-size: 1.2em;
    background-color: #cc0000;
    color: white;
    border: none;
    cursor: pointer;
}
