/* Save Area Button im Stil des Close-Buttons, aber grün */
.grading-btn {
    display: block; 
    opacity: 0.8;
    min-width: 30px; 
    padding: 2px; 
    height: 40px; 
    border-radius: 5px;
}
.grading-btn:hover {
    opacity: 1;
}
.closeModal {
    position:fixed;
    top:10px;
    right:10px;
    padding:5px;
}
#addRouteTitle.area-name {
    width: 80%;
    background-color: var(--color-secondary, rgba(93,128,164,0.8));
    border-radius: 10px;
    padding: 8px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    color: #333;
    transition: transform 0.2s, background-color 0.2s;
    margin-bottom: 8px;
}
#addRouteTitle.area-name:hover {
    transform: scale(1.01);
    background-color: #e3f2fd;
}
.routeNameTitle.area-name {
    width: 80%;
    font-size: small;
    font-weight: normal;
    background-color: #f0f0f0;
    border-radius: 10px;
    padding: 2px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    color: #333;
    transition: transarea 0.2s, background-color 0.2s;
    margin-bottom: 2px;
}
.routeNameTitle.area-name:hover {
    transform: scale(1.01);
    font-weight:bold;
    background-color: var(--color-secondary, rgba(93,128,164,0.8));
}


/* === 1. Globales Reset & Grundlayout === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    height: 100vh;
    background-color: black;
    touch-action: manipulation !important; /* WICHTIG! */
    -webkit-tap-highlight-color: transparent !important;
    overscroll-behavior: none !important;
}
#main-container {
    height: 100%;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    touch-action: pan-x pan-y !important;
    z-index: 1 !important;
}
#top-container {
    height: 70%;
    transition: height 0.3s ease;
    flex-shrink: 0;
    position: relative;
    z-index: 2 !important;
}
#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2 !important;
}
#content-container {
    height: 30%;
    touch-action: auto !important;
    background-color: #f8f9fa;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    flex-shrink: 0;
    border-top: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    transition: height 0.3s ease;
    z-index: 3 !important;
}
.content {
    width: 100%;
    padding: 20px;
    font-size: 16px;
    line-height: 1.6;
}
.contentForm {
    width: 95%;
    top: 5px;
    left: 50%;
    background-color: #d9dbd9;
    padding: 10px;
    border: #6c757d;
    border-radius: 5px;
    overflow-y: auto;
    overflow-x: hidden;
    position: absolute;
    transform: translateX(-50%);
    transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
}
.content-name {
    width: 80%;
    background-color: #c8c8c8;
    border-radius: 10px;
    padding: 8px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

.content-desc{
    width: 100%;
    background-color: #c8c8c8;
    border-radius: 10px;
    padding: 8px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}
.content-empty {
    color: #9aa0a6;
    font-style: italic;
}
.editor-click {
    cursor: pointer !important;
    touch-action: manipulation !important; /* WICHTIG! */
    z-index: 200 !important;
}
.editor-click:hover {
    background-color: var(--color-secondary, rgba(93,128,164,0.8));
}

.coords-info {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #6c757d;
}
.button-group {
    display: flex;
    gap: 10px;
}
.btn {
    flex: 1;
    padding: 8px 15px;
    margin: 2px;;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-primary {
    background-color: #4a9eff;
    color: white;
}
.btn-primary:hover {
    background-color: #3a8eef;
}
.btn-secondary {
    margin-top: 5px;
    background-color: #6c757d;
    color: white;
}
.btn-secondary:hover {
    background-color: #5a6268;
}
.btn-danger {
    background-color: #ff4757;
    color: white;
}
.btn-danger:hover {
    background-color: #ff3742;
}
.btn-success {
    background-color: #28a745;
    color: white;
    border: none;
}
.btn-success:hover {
    background-color: #218838;
}
.btn_closeForm {
    background: var(--color-secondary, rgba(93,128,164,0.8));
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    position: absolute;
    top: 15px;
    left: 92%;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 160ms ease, background-color 120ms ease;
    white-space: nowrap;
}
.close-btn:hover {
    background-color: #5c8296;
    transform: scale(1.01) translateY(-3px);
}
.save-btn {
    background: #28a745;
    color: #fff;
    left: calc(92% - 40px);
    top: 15px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    display:flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    font-size: 24px;
    cursor: pointer;
    transition: transform 160ms ease, background-color 120ms ease;
    z-index: 2;
    white-space: nowrap;
}
.save-btn:hover {
    background-color: #218838;
    transform: scale(1.01) translateY(-3px);
}
.save-btn-changed {
    background-color: #882130;
}

.btn btn-danger {
display: none; 
position: relative; 
right: 10px; 
bottom: 10px;
}
.bottom-editor {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    transform: translateY(110%);
    transition: transform 320ms ease;
    z-index: 9999;
    display: flex;
    justify-content: center;
    pointer-events: none;
}
.bottom-editor.open {
    transform: translateY(0);
    pointer-events: auto;
}
.bottom-editor-inner {
    width: 100%;
    max-width: 900px;
    background: #ffffff;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.12);
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: center;
}
.bottom-editor-inner textarea {
    flex: 1;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    resize: none;
    min-height: 48px;
}
.bottom-editor-inner textarea.single-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 48px;
}
.bottom-editor-actions {
    display: flex;
    gap: 8px;
}

/* === 3. Routen & Sektoren === */
#contentRoutes {
    margin-top: 5px;
}
#routesContainer {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.area_routeslist {
    width: 100%;
    height: 30px;
    font-size: small;
    font-weight: normal;
    background-color: #f0f0f0;
    border-radius: 10px;
    padding-left: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    color: #333;
    transition: transform 0.2s, background-color 0.2s;
    margin: 5px;
}
.area_routeslist:hover {
    transform: scale(1.01);
    font-weight:bold;
    background-color: var(--color-secondary, rgba(93,128,164,0.8));
}
.area_sectorlist {
    width: 100%;
    font-size: medium;
    font-weight: normal;
    background-color: #a9bbc5;
    border-radius: 10px;
    padding: 2px 10px;
    padding-top: 5px;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    color: #333;
    transition: transform 0.2s, background-color 0.2s;
}
.area_sectorlist:hover {
    transform: scale(1.01);
    font-weight:bold;
    background-color: var(--color-secondary, rgba(93,128,164,0.8));
}
.sector-dropdown {
    width: 80%;
    left: 0%;
    max-width: 350px;
    padding: 10px 15px;
    display: block;
    border: 2px solid #4a90e2;
    border-radius: 8px;
    background-color: white;
    font-size: 15px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(74, 144, 226, 0.1);
}

.sector-dropdown:hover {
    border-color: #357abd;
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.2);
}

.sector-dropdown:focus {
    outline: none;
    border-color: #2a6496;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.3);
}

.sector-dropdown option {
    padding: 10px;
    font-size: 14px;
}

/* Für kleine Bildschirme */
@media (max-width: 768px) {
    .sector-dropdown {
        width: 95%;
        font-size: 14px;
        padding: 8px 12px;
    }
}

.route-delete {
    background: transparent;
    border: none;
    color: #dc3545;
    font-size: 12px;
    cursor: pointer;
}
.route-delete:hover { color: #c82333; }

/* === 4. Gebiete-Liste === */
#areasList {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.list-header {
    flex-shrink: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #4a9eff;
}
#areasList h3 {
    margin: 20px 0 15px 0;
    color: #333;
}
.areas-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.area-item {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.area-item:hover {
    border-color: #4a9eff;
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.1);
    transform: translateY(-1px);
}
.area-item:active {
    transform: translateY(0);
}
.area-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 16px;
}
.area-coords {
    font-size: 14px;
    color: #6c757d;
    line-height: 1.4;
}
.area-coords small {
    color: #adb5bd;
}
.empty-message {
    text-align: center;
    color: #6c757d;
    padding: 20px;
    font-style: italic;
}
.area-description {
    font-size: 14px;
    color: #6c757d;
    margin: 5px 0;
    line-height: 1.4;
    max-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* === 5. Popups & Marker === */
.custom-marker {
    background: none !important;
    border: none !important;
}
.leaflet-div-icon {
    background: none !important;
    border: none !important;
}
.leaflet-popup-content {
    min-width: 200px;
}
.leaflet-popup-content .area-description-popup {
    margin: 8px 0;
    padding: 8px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    line-height: 1.4;
    color: #666;
}

/* === 6. Responsive & Sonstiges === */
@media (max-width: 768px) {
    .area-desc textarea {
        min-height: 60px;
        padding: 10px;
    }
    .area-description {
        font-size: 13px;
        -webkit-line-clamp: 1;
    }
}