/* === DARK THEME REDESIGN === */

/* === Color Variables === */
:root {
    --bg-primary: #0f0f23;
    --bg-secondary: #0087a266;
    --bg-tertiary: #16213e;
    --bg-card: rgba(26, 32, 46, 1);
    --bg-card-hover: rgba(36, 42, 56, 0.95);
    
    --accent-primary: #443648;
    --accent-secondary: #7c3aed;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-opposite: #32323f;
    
    --border-color: rgba(100, 116, 139, 0.2);
    --border-hover: #00d5ff66;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);
}

/* === 1. Ortungs-Button === */
.locate-btn {
    position: absolute;
    bottom: 20px;
    right: 10px;
    width: 30px;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, var(--bg-primary) 100%, var(--bg-secondary) 10%);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    backdrop-filter: blur(10px);
}

.locate-btn:hover {
    background: linear-gradient(135deg, var(--bg-primary) 90%, var(--bg-tertiary) 10%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.locate-btn:active {
    transform: translateY(0) scale(0.95);
}

.locate-btn.locating {
    animation: pulse 1s infinite;
}

.locate-btn.located {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.2) 100%);
    border-color: var(--accent-success);
}

.locate-btn.located svg circle,
.locate-btn.located svg path {
    fill: var(--accent-success);
    stroke: var(--accent-success);
}

.locate-btn.tracking-active {
    background: linear-gradient(135deg, rgba(239, 71, 87, 0.3) 0%, rgba(220, 38, 38, 0.3) 100%);
    border-color: #ff4757;
    animation: pulse-tracking 2s infinite;
}

.locate-btn.tracking-active svg circle,
.locate-btn.tracking-active svg path {
    fill: #ff4757;
    stroke: #1d0b0c;
}

@keyframes pulse-tracking {
    0%, 100% { 
        opacity: 1; 
        box-shadow: 0 0 0 0 rgba(239, 71, 87, 0.7);
    }
    50% { 
        opacity: 0.9; 
        box-shadow: 0 0 0 10px rgba(239, 71, 87, 0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: var(--shadow-md); }
    50% { opacity: 0.7; box-shadow: var(--shadow-glow); }
}

/* === 2. Grading & Modal Buttons === */
.grading-btn {
    display: block; 
    opacity: 0.9;
    min-width: 30px; 
    padding: 8px 12px; 
    height: 35px; 
    border-radius: 12px;
    border: 1px solid var(--border-color);
    color: var(--text-opposite);
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    z-index: 10;
}

.grading-btn[data-bgcolor] {
    background: var(--bg-tertiary) !important;
    color: #222 !important;
}

.grading-btn:hover {
    opacity: 1;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.grading-btn:active {
    transform: translateY(0);
}

.closeModal {
    position: fixed;
    top: 15px;
    right: 15px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}
.closeModal:hover {
    transform: translateY(-2px);
}

/* === 3. Title Elements === */
#addRouteTitle.area-name {
    width: 80%;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(124, 58, 237, 0.15) 100%);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 10px 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    color: var(--text-primary);
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 10px;
    backdrop-filter: blur(8px);
}

#addRouteTitle.area-name:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.25) 0%, rgba(124, 58, 237, 0.25) 100%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.routeNameTitle.area-name {
    width: 80%;
    font-size: 14px;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 6px 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    margin-bottom: 4px;
    backdrop-filter: blur(8px);
}

.routeNameTitle.area-name:hover {
    transform: translateY(-1px);
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}


/* === 4. Globales Reset & Grundlayout === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    overflow: hidden;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    background: var(--bg-primary);
    color: var(--text-primary);
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    overscroll-behavior: none !important;
    position: fixed;
    width: 100%;
}

#main-container {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    touch-action: pan-x pan-y !important;
    z-index: 1 !important;
    overflow: hidden;
}

#top-container {
    height: 100%;
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    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;
    filter: brightness(0.85) contrast(1.1);
}

/* Wrapper für alle Content-Container (wird von containerup bewegt) */
#content-container {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 0%;
    display: flex;
    flex-direction: column;
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3 !important;
}

/* Individuelle Content-Container (Kinder des Wrappers) */
.content-container {
    height: 100%;
    width: 100%;
    left: 0;
    top: 0;
    transform: translateX(0);
    touch-action: auto !important;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    overflow: auto;
    position: absolute;
    flex-shrink: 0;
    border-top: 2px solid var(--border-color);
    display: none;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.5);
}

/* Drag-Indikator für Content-Container */
.content-container::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 20%;
    height: 4px;
    background: rgba(148, 163, 184, 0.5);
    border-radius: 2px;
    z-index: 10;
    pointer-events: none;
}

.content-container.active {
    display: flex;
}

#mapcontent-container {
    /* Inherits all styles from .content-container */
    overflow-y: auto;
    overflow-x: hidden;
}

.content {
    width: 100%;
    padding: 15px;
    font-size: 15px;
    line-height: 1.6;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
}

.contentForm {
    width: calc(100% - 20px);
    margin: 10px auto;
    top: 5px;
    left: 50%;
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(22, 33, 62, 0.9) 100%);
    backdrop-filter: blur(16px);
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    overflow-y: visible;
    overflow-x: hidden;
    position: absolute;
    transform: translateX(-50%);
    transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
    will-change: transform;
    -webkit-overflow-scrolling: touch;
}

.content-name {
    width: calc(100% - 90px);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, rgba(124, 58, 237, 0.1) 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 18px;
    transition: all 0.3s ease;
    margin-top: -5px;
}

.title-marker-circle {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
    transform: translate(-50%, -50%);
    z-index: 20;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 11px;
}

.area-title-marker-circle {
    background-color: #ff4757;
}

.sector-title-marker-circle {
    background-color: #ff9800;
}

.parking-title-marker-circle {
    background-color: #4a9eff;
}


.content-desc {
    width: 100%;
    background: rgba(26, 32, 46, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    color: var(--text-secondary);
    min-height: 48px;
    line-height: 1.5;
}

.content-empty {
    color: var(--text-tertiary);
    font-style: italic;
}

/* Markierte Route im Edit-Modus (orange) */
.route-marked-for-edit {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.3) 0%, rgba(251, 140, 0, 0.3) 100%) !important;
    border: 2px solid #ff9800 !important;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.5) !important;
    transform: scale(1.02);
    transition: all 0.3s ease;
}

/* Route markiert für Löschung (rot + halbtransparent) */
.route-marked-for-deletion {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.4) 0%, rgba(185, 28, 28, 0.4) 100%) !important;
    border: 2px solid #dc3545 !important;
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.6) !important;
    opacity: 0.6;
    transform: scale(1.02);
    transition: all 0.3s ease;
}

.editor-click {
    transition: all 0.3s ease;
}

/* Editor-Click nur im Edit-Mode aktiv */
.contentForm[data-edit-mode="true"] .editor-click {
    cursor: pointer !important;
    touch-action: manipulation !important;
    z-index: 200 !important;
}

.contentForm[data-edit-mode="true"] .editor-click:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(124, 58, 237, 0.15) 100%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.coords-info {
    background: rgba(22, 33, 62, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    backdrop-filter: blur(8px);
}

.sun-info {
    background: rgba(22, 33, 62, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    backdrop-filter: blur(8px);
}

.sun-info h4 {
    margin: 0 0 10px 0;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.sun-season {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
    padding: 8px;
    background: rgba(15, 15, 35, 0.4);
    border-radius: 8px;
}

.sun-season-label {
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 65px;
}

.sun-season-times {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.sun-season-times input[type="time"] {
    background: rgba(26, 32, 46, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: 13px;
    min-width: 65px;
    transition: all 0.3s ease;
}

.sun-season-times input[type="time"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

/* Nur im Edit-Mode bearbeitbar */
.contentForm[data-edit-mode="false"] .sun-season-times input[type="time"] {
    pointer-events: none;
    background: transparent;
    border: none;
    padding: 0;
}

.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    flex: 1;
    padding: 12px 18px;
    margin: 2px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #0ea5e9 100%);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0ea5e9 0%, var(--accent-primary) 100%);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.btn-secondary {
    margin-top: 5px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    color: white;
    border-color: var(--accent-danger);
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-success) 0%, #059669 100%);
    color: white;
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

.btn_closeForm {
    background: linear-gradient(135deg, rgba(100, 116, 139, 0.2) 0%, rgba(71, 85, 105, 0.2) 100%);
    border: 1px solid var(--border-color);
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    position: absolute;
    top: 12px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    backdrop-filter: blur(8px);
}

.btn_closeForm:hover {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.3) 0%, rgba(100, 116, 139, 0.3) 100%);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: rotate(90deg) scale(1.05);
    box-shadow: var(--shadow-glow);
}

.save-btn {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: #fff;
    right: 52px;
    top: 12px;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(107, 114, 128, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.save-btn:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 0 20px rgba(107, 114, 128, 0.5);
}

/* Save-Button im Edit-Mode (grün mit Häkchen) */
.contentForm[data-edit-mode="true"] .save-btn {
    background: linear-gradient(135deg, var(--accent-success) 0%, #059669 100%);
    border-color: rgba(16, 185, 129, 0.5);
}

.contentForm[data-edit-mode="true"] .save-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

/* Änderungen vorhanden - Orange Highlight */
.save-btn-changed,
.contentForm[data-edit-mode="true"] .save-btn-changed {
    background: linear-gradient(135deg, var(--accent-warning) 0%, #d97706 100%) !important;
    border-color: rgba(245, 158, 11, 0.5) !important;
    animation: pulse-warning 2s infinite;
}

.save-btn-changed:hover,
.contentForm[data-edit-mode="true"] .save-btn-changed:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.6) !important;
}

@keyframes pulse-warning {
    0%, 100% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 30px rgba(245, 158, 11, 0.6); }
}

@keyframes pulse-recording {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(220, 53, 69, 0.5);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 30px rgba(220, 53, 69, 0.8);
        transform: scale(1.05);
    }
}

/* === 5. Bottom Editor === */
.bottom-editor {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    transform: translateY(110%);
    transition: transform 350ms cubic-bezier(0.4, 0, 0.2, 1);
    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: linear-gradient(135deg, var(--bg-card) 0%, rgba(22, 33, 62, 0.95) 100%);
    backdrop-filter: blur(20px);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-color);
    border-bottom: none;
    padding: 20px;
    display: flex;
    gap: 14px;
    align-items: center;
}

.bottom-editor-inner textarea {
    flex: 1;
    padding: 14px 16px;
    background: rgba(15, 15, 35, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    font-size: 15px;
    color: var(--text-primary);
    resize: none;
    min-height: 52px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.bottom-editor-inner textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    background: rgba(15, 15, 35, 0.8);
}

.bottom-editor-inner textarea::placeholder {
    color: var(--text-tertiary);
}

.bottom-editor-inner textarea.single-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 52px;
}

.bottom-editor-actions {
    display: flex;
    gap: 10px;
}

/* === 6. Routen & Sektoren === */
#contentRoutes {
    margin-top: 8px;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 700;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

#routesContainer {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.area_routeslist {
    width: 100%;
    min-height: 36px;
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(26, 32, 46, 0.6) 0%, rgba(22, 33, 62, 0.6) 100%);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 8px 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 6px 0;
    cursor: pointer;
}

.area_routeslist:hover {
    transform: translateX(4px);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(124, 58, 237, 0.15) 100%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

/* Route Grade and Length Divs */
.area_routeslist .grade-div,
.area_routeslist .length-div,
.area_sectorlist .grade-div,
.area_sectorlist .length-div {
    position: relative;
    min-width: 38px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    font-weight: bold;
    font-size: 13px;
    display: inline-block;
    color: var(--text-opposite);
}

.area_sectorlist {
    width: 100%;
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(36, 42, 56, 0.7) 0%, rgba(26, 32, 46, 0.7) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 16px;
    padding: 12px 16px;
    padding-top: 12px;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    cursor: pointer;
}

.area_sectorlist:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2) 0%, rgba(124, 58, 237, 0.2) 100%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

/* Custom Dropdown Styles */
.custom-dropdown {
    position: relative;
    width: 80%;
    max-width: 350px;
    user-select: none;
}

.dropdown-selected {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: rgba(22, 33, 62, 0.8);
    backdrop-filter: blur(8px);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-selected::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.3s ease;
}

.dropdown-selected:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

/* Spezielles Dropdown für routeForm - fest positioniert */
#routeFormDropdownOptions {
    position: fixed;
    top: 10px;
    left: 5px;
    right: 5px;
    bottom: auto;
    margin: 0;
    width: auto;
    max-width: calc(100% - 10px);
}

.dropdown-options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(22, 33, 62, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    max-height: 260px;
    overflow-y: auto;
    display: none;
    z-index: 2000;
}

.dropdown-options.dropdown-options--content-top {
    border-radius: 18px;
}

.dropdown-overlay-host {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px;
    z-index: 3500;
    display: none;
    pointer-events: none;
}

.dropdown-overlay-host.active {
    display: block;
}

.dropdown-overlay-host > .dropdown-options {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 65vh;
    pointer-events: auto;
}

.dropdown-option {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(100, 116, 139, 0.1);
}

.dropdown-option:last-child {
    border-bottom: none;
}

.dropdown-option:hover {
    background: rgba(68, 54, 72, 0.5);
}

.dropdown-option:active {
    background: rgba(68, 54, 72, 0.8);
}

@media (max-width: 768px) {
    .custom-dropdown {
        width: 95%;
    }
    
    .dropdown-selected {
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .dropdown-option {
        font-size: 13px;
        padding: 10px 14px;
    }
}

.route-delete {
    background: transparent;
    border: none;
    color: var(--accent-danger);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.route-delete:hover { 
    color: #dc2626;
    transform: scale(1.1);
}

/* === 7. Gebiete-Liste === */
#areasList {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Platzhalter für BottomBar */
.bottom-bar-spacer {
    height: 80px;
    flex-shrink: 0;
}

.list-header {
    flex-shrink: 0;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--accent-primary);
    margin-bottom: 10px;
}

#areasList h3 {
    margin: 20px 0 15px 0;
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 700;
}

.file-actions {
    display: flex;
    gap: 10px;
}

.btn-icon {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.areas-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.area-item {
    background: linear-gradient(135deg, rgba(26, 32, 46, 0.7) 0%, rgba(22, 33, 62, 0.7) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.area-item:hover {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(124, 58, 237, 0.15) 100%);
    box-shadow: var(--shadow-glow);
    transform: translateY(-3px);
}

.area-item:active {
    transform: translateY(-1px);
}

.area-name {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 17px;
}

.area-coords {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.area-coords small {
    color: var(--text-tertiary);
}

.empty-message {
    text-align: center;
    color: var(--text-tertiary);
    padding: 30px 20px;
    font-style: italic;
    font-size: 14px;
}

.area-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 8px 0;
    line-height: 1.5;
    max-height: 42px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* === 8. Popups & Marker === */
.custom-marker {
    background: none !important;
    border: none !important;
}

.leaflet-div-icon {
    background: none !important;
    border: none !important;
}

.leaflet-popup-content-wrapper {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(22, 33, 62, 0.95) 100%) !important;
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.leaflet-popup-content {
    min-width: 200px;
    color: var(--text-primary);
    margin: 16px;
}

.leaflet-popup-tip {
    background: var(--bg-card) !important;
}

.leaflet-popup-content .area-description-popup {
    margin: 10px 0;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* === 9. Scrollbar Styling === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 15, 35, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 10px;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

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

/* === 11. Stars Rating Container === */
.stars-rating-container {
    display: inline-flex;
    gap: 2px;
    margin-right: 10px;
    align-items: center;
}

.star-rating {
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ccc;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.star-rating:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8));
}

/* === 12. Table Selection Modals === */
.table-modal {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 15, 35, 0.9);
    backdrop-filter: blur(12px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.table-modal > div {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    padding: 28px;
    border-radius: 24px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    max-height: 85vh;
    overflow-y: auto;
    min-width: 320px;
    max-width: 500px;
}

.selection-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
}

.selection-table td,
.selection-table th {
    padding: 12px 16px !important;
    color: var(--text-opposite);
    font-size: 14px;
}

.selection-table th {
    background: var(--bg-tertiary) 0%;
    color: var(--text-primary);
    font-weight: 700;
    text-align: left;
    border-bottom: 2px solid var(--accent-primary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.selection-table tr {
    transition: all 0.2s ease;
    border-radius: 8px;
    opacity: 0.6;
}

.selection-table tr:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
    opacity: 0.8;
}

.selection-table td {
    background: inherit;
    border: 1px solid var(--border-color);
}

.selection-table td:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.selection-table td:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* === 13. NoScript Warning === */
.noscript-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, var(--accent-danger) 0%, #dc2626 100%);
    color: white;
    padding: 30px 40px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    box-shadow: var(--shadow-lg);
    z-index: 99999;
}

/* === 14. Multi-pitch Toggle === */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: transparent;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    border-color: var(--bg-secondary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translate(14px, -50%);
    background-color: var(--bg-secondary);
}

.version-container {
    margin: 20px auto 0;
    padding: 10px 16px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    max-width: 500px;
}

.version-container span {
    letter-spacing: 0.02em;
}
/* ==========================================
   Touch-optimierter Timepicker
   ========================================== */

.timepicker-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timepicker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

.timepicker-container {
    position: relative;
    background-color: var(--bg-primary);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.timepicker-header {
    padding: 16px 20px;
    background-color: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.timepicker-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.timepicker-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.timepicker-close:hover {
    color: var(--text-primary);
}

.timepicker-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.timepicker-display {
    text-align: center;
    font-size: 48px;
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.timepicker-separator {
    margin: 0 4px;
}

.timepicker-selector {
    margin-top: 20px;
}

.timepicker-options {
    display: grid;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px;
}

/* Stunden-Grid: 6 Spalten für 24 Stunden */
#timepickerHours {
    grid-template-columns: repeat(6, 1fr);
}

/* Minuten-Grid: 2 Spalten für 4 Optionen (15min Takt) */
#timepickerMinutes {
    grid-template-columns: repeat(2, 1fr);
    max-height: none;
}

#timepickerMinutes .timepicker-option {
    font-size: 24px;
    min-height: 80px;
}

.timepicker-option {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.timepicker-option:hover {
    background-color: var(--bg-hover);
}

.timepicker-option.selected {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.timepicker-option:active {
    transform: scale(0.95);
}

.timepicker-footer {
    padding: 16px 20px;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.timepicker-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.timepicker-btn-clear {
    background-color: transparent;
    color: var(--text-secondary);
    margin-right: auto;
}

.timepicker-btn-clear:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.timepicker-btn-cancel {
    background-color: transparent;
    color: var(--text-secondary);
}

.timepicker-btn-cancel:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.timepicker-btn:active {
    transform: scale(0.97);
}

/* Scrollbar für Timepicker-Optionen */
.timepicker-options::-webkit-scrollbar {
    width: 6px;
}

.timepicker-options::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 3px;
}

.timepicker-options::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.timepicker-options::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* === Bottom Bar === */
.bottom-bar {
    width: 100%;
    height: 10%;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    box-shadow: var(--shadow-md);
    z-index: 100;
    --active-tab: 0;
}

/* Gleitender Tab-Indikator */
.bottom-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 25%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0;
    transform: translateX(calc(var(--active-tab) * 100%));
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    pointer-events: none;
}

#bottomBarBG {
    position: absolute;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.9) 100%);
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.8);
}

.bottom-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 10px;
    gap: 8px;
    color: var(--text-secondary);
    position: relative;
    z-index: 2;
}

.bottom-bar-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.bottom-bar-item.active {
    color: var(--text-primary);
}

.bottom-bar-icon {
    width: 28px;
    height: 28px;
    color: inherit;
}

.bottom-bar-label {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    color: inherit;
}
