/* ==========================================
   GTFS Animation - Modern UI Stylesheet
   ========================================== */

:root {
    /* Farben */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --accent: #10b981;
    --accent-dark: #059669;
    --accent-light: #34d399;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Light Theme - Neutrals */
    --bg-body: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-solid: #ffffff;
    --bg-subtle: rgba(248, 250, 252, 0.8);
    --bg-hover: rgba(241, 245, 249, 0.9);
    --border: rgba(226, 232, 240, 0.8);
    --border-light: rgba(241, 245, 249, 0.6);

    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* Map Elements */
    --stop-color: #475569;
    --inactive-route-color: #cbd5e1;

    /* Effekte */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    /* Radien */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme */
[data-theme="dark"] {
    /* Dark Theme - Neutrals */
    --bg-body: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.95);
    --bg-card-solid: #1e293b;
    --bg-subtle: rgba(51, 65, 85, 0.7);
    --bg-hover: rgba(71, 85, 105, 0.8);
    --border: rgba(100, 116, 139, 0.5);
    --border-light: rgba(71, 85, 105, 0.3);

    /* Text - maximale Kontraste für beste Lesbarkeit */
    --text-primary: #ffffff;
    --text-secondary: #f1f5f9;
    --text-muted: #e2e8f0;
    --text-inverse: #0f172a;

    /* Map Elements - Dark Theme */
    --stop-color: #64748b;
    --inactive-route-color: #334155;

    /* Effekte - stärkere Schatten für Dark Mode */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

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

/* Smooth transitions für Theme-Wechsel */
html {
    transition: background-color var(--transition-base);
}

html * {
    transition: background-color var(--transition-base),
                border-color var(--transition-base),
                color var(--transition-fast);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-body);
    transition: background var(--transition-base);
}

#map {
    height: 100vh;
    width: 100%;
}

/* ==========================================
   Controls Panel - Glassmorphism
   ========================================== */

.controls {
    position: absolute;
    top: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 1000;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    width: 380px;
    overflow-y: auto;
    font-size: 13px;
    transition: transform var(--transition-slow), opacity var(--transition-slow);
}

.controls.collapsed {
    transform: translateX(420px);
    opacity: 0;
}

/* ==========================================
   Control Sections
   ========================================== */

.control-section {
    margin-bottom: 12px;
    padding: 14px;
    background: var(--bg-subtle);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
}

.control-section:hover {
    border-color: var(--border);
}

.control-section:last-child {
    margin-bottom: 0;
}

.control-section h4 {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Disabled Section */
.control-section.disabled {
    opacity: 0.4;
    pointer-events: none;
    position: relative;
}

.control-section.disabled::after {
    content: 'Im anderen Modus aktiv';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card-solid);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
}

/* ==========================================
   Collapsible Sections
   ========================================== */

.collapsible .section-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    padding: 2px 0;
    margin: -2px 0;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.collapsible .section-header:hover {
    background: var(--bg-hover);
}

.collapsible .collapse-icon {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform var(--transition-base);
}

.collapsible.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapsible .section-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.collapsible.collapsed .section-content {
    max-height: 0;
    padding: 0;
}

/* ==========================================
   Input Groups
   ========================================== */

.input-group {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-group label {
    min-width: 50px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-group input,
.input-group select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 12px;
    background: var(--bg-card-solid);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

/* Zeitfelder sollten nicht zu breit sein */
.input-group input[type="text"],
.input-group input[type="time"] {
    max-width: 100px;
    flex: 0 1 100px;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .input-group input:focus,
[data-theme="dark"] .input-group select:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2), 0 0 10px rgba(99, 102, 241, 0.1);
}

.input-group button {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-card-solid);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.input-group button:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.input-group button:active {
    transform: translateY(0);
}

.input-group button:disabled {
    background: var(--bg-subtle);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==========================================
   Toggle Buttons
   ========================================== */

.toggle-group {
    display: flex;
    gap: 6px;
    margin: 10px 0;
}

.toggle-btn {
    flex: 1;
    padding: 10px 8px;
    border: 1px solid var(--border);
    background: var(--bg-card-solid);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.toggle-btn:hover:not(.active) {
    background: var(--bg-hover);
    border-color: var(--primary-light);
    color: var(--primary);
}

.toggle-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-inverse);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

[data-theme="dark"] .toggle-btn.active {
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.6), 0 0 20px rgba(99, 102, 241, 0.2);
}

/* ==========================================
   Time Slider
   ========================================== */

.time-slider-container {
    margin: 12px 0;
    padding: 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(16, 185, 129, 0.05));
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.time-slider-container label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.time-slider {
    width: 100%;
    height: 6px;
    appearance: none;
    -webkit-appearance: none;
    background: linear-gradient(90deg, var(--border), var(--border));
    border-radius: 3px;
    outline: none;
}

.time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
    transition: transform var(--transition-fast);
}

.time-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.time-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 8px;
    padding: 0 2px;
}

/* ==========================================
   ZIP Upload
   ========================================== */

.zip-upload {
    margin-bottom: 14px;
}

.zip-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    background: var(--bg-card-solid);
    transition: all var(--transition-base);
}

.zip-upload-label:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.zip-upload-label.loaded {
    border-color: var(--accent);
    background: rgba(16, 185, 129, 0.05);
    border-style: solid;
}

.upload-icon {
    font-size: 32px;
    margin-bottom: 8px;
    filter: grayscale(0.2);
}

.upload-text {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.upload-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Status Messages */
.zip-status {
    font-size: 12px;
    font-weight: 500;
    padding: 10px 14px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    border-left: 3px solid var(--border);
}

.zip-status.success {
    background: rgba(16, 185, 129, 0.1);
    border-left-color: var(--accent);
    color: var(--accent-dark);
}

.zip-status.warning {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: var(--warning);
    color: #b45309;
}

.zip-status.error {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: var(--error);
    color: #dc2626;
}

.zip-status.info {
    background: rgba(99, 102, 241, 0.1);
    border-left-color: var(--primary);
    color: var(--primary-dark);
}

/* File List */
.file-list {
    margin-bottom: 10px;
    max-height: 140px;
    overflow-y: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    font-size: 11px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-card-solid);
}

.file-item:last-child {
    border-bottom: none;
}

.file-status {
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-status.required {
    background: var(--accent);
    color: white;
}

.file-status.optional {
    background: var(--primary);
    color: white;
}

.file-status.missing {
    background: var(--error);
    color: white;
}

.file-status.generated {
    background: var(--warning);
    color: white;
}

/* ==========================================
   Single Files Fallback
   ========================================== */

.single-files-fallback {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}

.single-files-fallback summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
    transition: color var(--transition-fast);
}

.single-files-fallback summary:hover {
    color: var(--primary);
}

.single-file-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.single-file-inputs input[type="file"] {
    display: none;
}

.single-file-inputs label {
    padding: 8px 10px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    transition: all var(--transition-fast);
}

.single-file-inputs label:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.single-file-inputs label.loaded {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--accent);
    color: var(--accent-dark);
}

#loadSingleFilesBtn {
    margin-top: 10px;
    width: 100%;
}

/* ==========================================
   Service Info & Stats
   ========================================== */

.service-info {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 12px;
    margin-top: 8px;
    font-weight: 500;
}

.service-weekday {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--accent-dark);
}

.service-weekend {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #b45309;
}

.service-exception {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #dc2626;
}

.vehicle-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 8px 0;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(16, 185, 129, 0.08));
    border-radius: var(--radius-md);
}

.service-stats {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ==========================================
   Range Presets
   ========================================== */

.range-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.preset-btn {
    padding: 8px 6px;
    border: 1px solid var(--border);
    background: var(--bg-card-solid);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.preset-btn:hover {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ==========================================
   Progress Bar
   ========================================== */

.animation-progress {
    margin: 12px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    width: 0%;
    transition: width var(--transition-base);
    border-radius: 4px;
}

.progress-text {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 6px;
}

/* ==========================================
   Export & Load Buttons
   ========================================== */

.export-group {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}

.export-group strong {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

#loadGTFSBtn {
    width: 100%;
    padding: 12px;
    font-weight: 600;
    font-size: 13px;
    margin-top: 10px;
    border-radius: var(--radius-md);
}

#loadGTFSBtn:enabled {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

#loadGTFSBtn:enabled:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5);
}

#loadGTFSBtn:enabled:active {
    transform: translateY(0);
}

[data-theme="dark"] #loadGTFSBtn:enabled {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4), 0 0 20px rgba(16, 185, 129, 0.15);
}

[data-theme="dark"] #loadGTFSBtn:enabled:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.6), 0 0 30px rgba(16, 185, 129, 0.25);
}

.load-status {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    margin-top: 6px;
}

/* ==========================================
   Vehicle Markers
   ========================================== */

.vehicle-marker {
    background: transparent !important;
    border: none !important;
}

.vehicle-label {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 24px;
    letter-spacing: 0.3px;
}

/* ==========================================
   Cluster Styles
   ========================================== */

.marker-cluster {
    background-clip: padding-box;
    border-radius: 50%;
}

.marker-cluster div {
    width: 34px;
    height: 34px;
    margin-left: 3px;
    margin-top: 3px;
    text-align: center;
    border-radius: 50%;
    font: 12px 'Inter', -apple-system, sans-serif;
    font-weight: 700;
}

.marker-cluster span {
    line-height: 34px;
    color: white;
}

.marker-cluster-small {
    background-color: rgba(16, 185, 129, 0.5);
}

.marker-cluster-small div {
    background-color: rgba(16, 185, 129, 0.9);
}

.marker-cluster-medium {
    background-color: rgba(245, 158, 11, 0.5);
}

.marker-cluster-medium div {
    background-color: rgba(245, 158, 11, 0.9);
}

.marker-cluster-large {
    background-color: rgba(239, 68, 68, 0.5);
}

.marker-cluster-large div {
    background-color: rgba(239, 68, 68, 0.9);
}

/* ==========================================
   Scrollbar
   ========================================== */

.controls::-webkit-scrollbar {
    width: 6px;
}

.controls::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

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

.controls::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

[data-theme="dark"] .controls::-webkit-scrollbar-thumb {
    background: var(--border);
}

[data-theme="dark"] .controls::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ==========================================
   Responsive
   ========================================== */

@media (max-width: 768px) {
    .controls {
        top: 8px;
        right: 8px;
        left: 8px;
        bottom: 76px;
        width: auto;
        max-height: calc(100vh - 84px);
        border-radius: var(--radius-lg);
    }

    .sidebar-toggle {
        display: none;
    }
}

/* ==========================================
   Multi-Select Filter
   ========================================== */

.control-section select[multiple] {
    width: 100%;
    font-size: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card-solid);
}

.control-section select[multiple] option {
    padding: 6px 10px;
}

.control-section select[multiple] option:checked {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-inverse);
}

.control-section select[multiple] option:hover {
    background: var(--bg-hover);
}

.filter-info {
    padding: 8px 12px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    margin: 8px 0;
    border-left: 3px solid var(--primary);
}

.filter-info small {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ==========================================
   Stop Popups
   ========================================== */

.stop-popup-lines {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.stop-line-label {
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    color: white;
}

.consolidated-stop {
    border: 2px solid var(--text-primary);
}

/* Permanente Station-Labels */
.permanent-stop-label {
    background: rgba(0, 0, 0, 0.75) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    white-space: nowrap !important;
    pointer-events: none !important;
}

[data-theme="dark"] .permanent-stop-label {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #0f172a !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
}

/* ==========================================
   Dialogs
   ========================================== */

.load-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card-solid);
    padding: 24px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: 2000;
    max-width: 400px;
    width: 90%;
}

.load-dialog h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.load-dialog p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.load-dialog-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.load-dialog-buttons button {
    flex: 1;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1999;
}

/* ==========================================
   Sidebar Toggle
   ========================================== */

.sidebar-toggle {
    position: absolute;
    top: 50%;
    right: 404px;
    transform: translateY(-50%);
    z-index: 1001;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    padding: 16px 8px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    font-size: 12px;
    color: var(--text-secondary);
    transition: all var(--transition-base);
}

.sidebar-toggle:hover {
    background: var(--bg-card-solid);
    color: var(--primary);
}

.sidebar-toggle.collapsed {
    right: 0;
    border-radius: var(--radius-md);
}

/* ==========================================
   Theme Toggle Button
   ========================================== */

.theme-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1001;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
}

.theme-toggle:hover {
    background: var(--bg-card-solid);
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-xl);
}

.theme-toggle:active {
    transform: translateY(0) scale(1);
}

.theme-icon {
    font-size: 20px;
    transition: transform var(--transition-base);
    display: block;
}

.theme-toggle:hover .theme-icon {
    transform: rotate(20deg) scale(1.1);
}

.theme-toggle:active {
    transform: translateY(0) scale(0.95);
}

@keyframes theme-pulse {
    0%, 100% {
        box-shadow: var(--shadow-lg), 0 0 0 0 rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: var(--shadow-lg), 0 0 0 6px rgba(99, 102, 241, 0);
    }
}

.theme-toggle.theme-changed {
    animation: theme-pulse 0.6s ease-out;
}

@media (max-width: 768px) {
    .theme-toggle {
        width: 44px;
        height: 44px;
        bottom: 16px;
        left: 16px;
    }

    .theme-icon {
        font-size: 18px;
    }
}

/* ==========================================
   Settings Group
   ========================================== */

.settings-group {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.settings-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.settings-group strong {
    display: block;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-group .input-group {
    margin-bottom: 8px;
}

.settings-group .input-group:last-child {
    margin-bottom: 0;
}

.settings-group input[type="range"] {
    flex: 2;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
    border: none;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
}

.settings-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.settings-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.settings-group span {
    min-width: 50px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}

.full-width-btn {
    width: 100%;
    padding: 10px !important;
    font-size: 13px !important;
    font-weight: 600;
}

.small-btn {
    padding: 6px 10px !important;
    font-size: 11px !important;
}

/* ==========================================
   Color Dialog
   ========================================== */

.color-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-dialog-content {
    background: var(--bg-card-solid);
    border-radius: var(--radius-xl);
    padding: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
}

.color-dialog-content h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.color-dialog-info {
    margin-bottom: 14px;
    padding: 12px 14px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary);
}

.color-dialog-info small {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.color-route-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
    max-height: 500px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.color-route-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
    transition: background var(--transition-fast);
}

.color-route-item:last-child {
    border-bottom: none;
}

.color-route-item:hover {
    background: var(--bg-subtle);
}

.color-route-swatch {
    width: 44px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.color-route-swatch:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-md);
}

.color-route-info {
    flex: 1;
}

.color-route-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.color-route-id {
    font-size: 11px;
    color: var(--text-muted);
}

.color-route-picker {
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

.color-dialog-buttons {
    display: flex;
    gap: 12px;
}

.color-dialog-buttons button {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

#resetColorsBtn {
    background: var(--bg-card-solid);
    color: var(--text-primary);
}

#resetColorsBtn:hover {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

#closeColorDialogBtn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: transparent;
}

#closeColorDialogBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* ==========================================
   Checkbox Styling
   ========================================== */

.input-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.input-group label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.input-group label:has(input[type="checkbox"]):hover {
    color: var(--text-primary);
}

/* ==========================================
   Leaflet Dark Mode Anpassungen
   ========================================== */

[data-theme="dark"] .leaflet-popup-content-wrapper,
[data-theme="dark"] .leaflet-popup-tip {
    background: var(--bg-card-solid);
    color: var(--text-primary);
    box-shadow: var(--shadow-xl);
}

[data-theme="dark"] .leaflet-popup-content {
    color: var(--text-primary);
}

[data-theme="dark"] .leaflet-popup-content h3,
[data-theme="dark"] .leaflet-popup-content h4 {
    color: var(--text-primary);
}

[data-theme="dark"] .leaflet-popup-close-button {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .leaflet-popup-close-button:hover {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .leaflet-bar {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .leaflet-bar a {
    background: var(--bg-card-solid);
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

[data-theme="dark"] .leaflet-bar a:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .leaflet-control-attribution {
    background: var(--bg-card);
    color: var(--text-muted);
}

[data-theme="dark"] .leaflet-control-attribution a {
    color: var(--primary-light);
}

/* ==========================================
   Dark Theme - Spezielle Verbesserungen
   ========================================== */

[data-theme="dark"] body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="text"] {
    color-scheme: dark;
}

[data-theme="dark"] select {
    color-scheme: dark;
}

[data-theme="dark"] .time-slider-container {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(16, 185, 129, 0.1));
}

[data-theme="dark"] #closeColorDialogBtn:hover {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.6), 0 0 20px rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .preset-btn:hover {
    box-shadow: var(--shadow-md), 0 0 15px rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .control-section:hover {
    border-color: var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .sidebar-toggle {
    box-shadow: var(--shadow-xl), 0 0 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .theme-toggle {
    box-shadow: var(--shadow-xl), 0 0 20px rgba(0, 0, 0, 0.3);
}

/* Smooth Color Transitions */
.control-section,
.input-group button,
.toggle-btn,
.preset-btn,
.zip-upload-label {
    transition: all var(--transition-base), transform var(--transition-fast);
}

/* ==========================================
   Map Time Display (in Karten-Ecke)
   ========================================== */

.map-time-display {
    position: absolute;
    bottom: 30px;
    left: 20px;
    z-index: 1000;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    min-width: 150px;
    display: none; /* Standardmäßig ausgeblendet */
    transition: all var(--transition-base);
}

.map-time-display.visible {
    display: block;
}

.map-time-display:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), 0 0 20px rgba(99, 102, 241, 0.15);
}

.map-time-display-time {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.map-time-display-date {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.map-time-display-vehicles {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.map-time-display-vehicles-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.map-time-display-vehicles-icon {
    font-size: 14px;
}

.map-time-display-vehicles-count {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.map-time-display-credit {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    letter-spacing: 0.01em;
    opacity: 0.8;
}

[data-theme="dark"] .map-time-display {
    box-shadow: var(--shadow-xl), 0 0 30px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .map-time-display:hover {
    box-shadow: var(--shadow-xl), 0 0 30px rgba(99, 102, 241, 0.3);
}

@media (max-width: 768px) {
    .map-time-display {
        bottom: 16px;
        left: 16px;
        padding: 12px 16px;
    }

    .map-time-display-time {
        font-size: 24px;
    }

    .map-time-display-date {
        font-size: 11px;
    }

    .map-time-display-vehicles {
        font-size: 10px;
        gap: 6px;
        margin-top: 6px;
        padding-top: 6px;
    }

    .map-time-display-vehicles-icon {
        font-size: 12px;
    }

    .map-time-display-credit {
        font-size: 9px;
        margin-top: 6px;
        padding-top: 6px;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
