#loader {
    display: none;
    /* horizontale Anordnung */
    align-items: center;
    /* vertikale Zentrierung */
    justify-content: center;
    /* optional: horizontal zentrieren */
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(33, 33, 33, 0.85);
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 1000;
    font-weight: 500;
    color: #fff;
    font-family: 'Segoe UI', sans-serif;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease-in-out;
    vertical-align: middle;
}

.loader-spinner {
    width: 16px;
    height: 16px;
    border: 3px solid #fff;
    border-top: 3px solid transparent;
    border-radius: 50%;
    display: inline-block;
    margin-right: 10px;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
}

/* Modern Sidebar */
#sidebar {
    width: 260px;
    background: #f9f9f9;
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-right: 1px solid #ddd;
    height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
}


#sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    /* nur dieser Teil scrollt */
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-x: hidden;
}

#sidebar h2 {
    margin-top: 0;
    font-size: 18px;
    color: #333;
}

#sidebar label {
    font-size: 14px;
    color: #444;
}

#sidebar input[type="number"] {
    padding: 8px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
}

#sidebar button {
    padding: 10px;
    font-size: 14px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

#sidebar button:hover:not([disabled]) {
    background-color: #45a049;
}

#sidebar button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#measureInfo {
    position: absolute;
    top: 10px;
    left: 200px;
    /* rechts neben Sidebar */
    background: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-family: sans-serif;
    z-index: 1000;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    display: none;
    /* versteckt, wenn Messung nicht aktiv */
}

#map {
    flex: 1;
    height: 100vh;
}

#sidebar button.active {
    background-color: #2196F3;
    color: white;
}

#map.select-cursor {
    cursor: crosshair;
}

#subtitle {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #2e7d32;
    /* dunkleres GrÃ¼n */
    margin-top: 4px;
    user-select: none;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

#logoImage {
    width: 210px;
    height: auto;
    margin-bottom: 30px;
}

.switch-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    color: #444;
    margin-bottom: 10px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #4CAF50;
}

input:checked+.slider:before {
    transform: translateX(24px);
}

.switch-label-text {
    font-size: 13px;
    color: #333;
    margin-top: 4px;
    user-select: none;
}

.numbered-button {
    display: flex;
    align-items: center;
    margin-bottom: 0px;
}

.button-number {
    width: 20px;
    font-weight: bold;
    margin-right: 8px;
    text-align: right;
}

.sidebar-button {
    flex: 1;
    padding: 8px 12px;
    width: 100%;
    min-width: unset;
    box-sizing: border-box;
}

.number-label {
    background-color: #007bff;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
    font-weight: bold;
}


/* Fehler-Toast (oben, zentriert) */
#error-toast {
    display: none;
    position: absolute;
    top: 70px;
    /* etwas unterhalb des Loaders */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(220, 53, 69, 0.9);
    /* Bootstrap Danger-Rot */
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 1100;
    /* höher als Loader */
    font-weight: 500;
    font-family: 'Segoe UI', sans-serif;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease-in-out;
    max-width: 80%;
    text-align: center;
}

#error-toast.hide {
    animation: fadeOut 0.3s ease-in-out;
    opacity: 0;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) scale(0.95);
    }
}

/* Warning-Toast */
#warning-toast {
    display: none;
    position: absolute;
    top: 70px;
    /* knapp unter dem Loader */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 193, 7, 0.9);
    /* gelb/orange für Warnung */
    color: #000;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 1100;
    font-weight: 500;
    font-family: 'Segoe UI', sans-serif;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease-in-out;
    max-width: 80%;
    text-align: center;
}

#warning-toast.hide {
    animation: fadeOut 0.3s ease-in-out;
    opacity: 0;
}