:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --background-color: #f5f6fa;
    --chart-background: #ffffff;
    --text-color: #2c3e50;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
}

.dashboard-container {
    padding: 20px;
    max-width: 1800px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.dashboard-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dashboard-title img {
    height: 35px;
    width: auto;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-export-button {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.header-export-button.csv {
    background-color: #27ae60;
    color: white;
}

.header-export-button.csv:hover {
    background-color: #219a52;
    transform: translateY(-1px);
}

.header-export-button.excel {
    background-color: #2ecc71;
    color: white;
}

.header-export-button.excel:hover {
    background-color: #27ae60;
    transform: translateY(-1px);
}

.logout-btn {
    background-color: var(--secondary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.3s;
    font-size: 0.9em;
    font-weight: 500;
}

.logout-btn:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.charts-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Container für zwei zusammengehörige Charts */
.chart-pair {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
    background-color: rgba(44, 62, 80, 0.05);
    border-radius: 15px;
}

/* Größerer vertikaler Abstand für Chart-Gruppen mit mehreren Zeilen (z.B. Beatmung/Isolation) */
.chart-pair.chart-pair-multi {
    row-gap: 30px; /* vertikaler Abstand zwischen den Chart-Reihen */
}

/* Anpassung der Chart-Section */
.chart-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0;
}

/* Trennlinien können entfernt werden, da wir jetzt Rahmen haben */
.charts-grid::after,
.charts-grid::before {
    display: none;
}

/* Optional: Hover-Effekt für bessere Interaktivität */
.chart-pair:hover {
    box-shadow: 0 0 15px rgba(44, 62, 80, 0.1);
    transition: box-shadow 0.3s ease;
}

.chart-container {
    background-color: var(--chart-background);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: 400px;
    position: relative;
}

.chart-container canvas {
    position: absolute;
    top: 65px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: calc(100% - 65px) !important;
    cursor: default;
    user-select: none;
}

/* Chart Scrollbalken */
.chart-scrollbar-container {
    position: absolute;
    /* Scrollbalken direkt an den unteren Rand des Chart-Containers setzen,
       damit alle Charts einer Zeile exakt auf einer horizontalen Linie liegen */
    bottom: 0;
    left: 50px;
    right: 20px;
    height: 20px;
    padding: 0;
    display: block;
    z-index: 10;
}

.chart-scrollbar {
    width: 100%;
    height: 10px;
    -webkit-appearance: none;
    appearance: none;
    background: #f0f0f0;
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    outline: none;
    opacity: 0.9;
    transition: opacity 0.2s;
    cursor: pointer;
}

.chart-scrollbar:hover {
    opacity: 1;
    background: #e8e8e8;
}

/* Chrome, Safari, Edge */
.chart-scrollbar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: calc(var(--scrollbar-width, 20%) * 1);
    min-width: 50px;
    max-width: 100%;
    height: 18px;
    background: #ffffff;
    border: 1px solid #999999;
    border-radius: 2px;
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.chart-scrollbar::-webkit-slider-thumb:hover {
    background: #f8f8f8;
    border-color: #777777;
}

.chart-scrollbar::-webkit-slider-thumb:active {
    cursor: grabbing;
    background: #eeeeee;
    border-color: #666666;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Firefox */
.chart-scrollbar::-moz-range-thumb {
    width: calc(var(--scrollbar-width, 20%) * 1);
    min-width: 50px;
    max-width: 100%;
    height: 18px;
    background: #ffffff;
    border: 1px solid #999999;
    border-radius: 2px;
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.chart-scrollbar::-moz-range-thumb:hover {
    background: #f8f8f8;
    border-color: #777777;
}

.chart-scrollbar::-moz-range-thumb:active {
    cursor: grabbing;
    background: #eeeeee;
    border-color: #666666;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.chart-container h2 {
    color: var(--text-color);
    font-size: 1.2rem;
    margin: 0 0 25px 0;
    text-align: center;
    position: relative;
}

.chart-total {
    font-size: 0.75em;
    color: #666;
    display: block;
    margin-top: 5px;
    text-align: center;
}

/* Login page styles */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 30px;
    background-color: var(--chart-background);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.login-container h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 30px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-form input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.login-form button {
    background-color: var(--secondary-color);
    color: white;
    padding: 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-form button:hover {
    background-color: #2980b9;
}

/* Neuer Filter-Bereich */
.dashboard-filters {
    background-color: var(--chart-background);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    align-items: center;
    justify-content: space-between;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    flex-shrink: 0;
}

.filter-group select {
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

/* Dropdown-Legende Styles */
.chart-legend-dropdown {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.legend-button {
    background-color: var(--secondary-color);
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.legend-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: white;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    min-width: 200px;
}

.legend-content.show {
    display: block;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px;
}

.legend-item input[type="checkbox"] {
    margin: 0;
}


.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header img {
    height: 50px;
    width: auto;
    margin-bottom: 15px;
}

/* Anpassung für Dashboard-Titel */
.dashboard-title h1 {
    font-family: Verdana, Arial, sans-serif;
    font-weight: bold;
    color: #666666;  /* Mittleres Grau statt Blau */
    margin: 0;
    font-size: 24px;
}

/* Anpassung für Login-Titel */
.login-header h1 {
    font-family: Verdana, Arial, sans-serif;
    font-weight: bold;
    color: #666666;  /* Mittleres Grau statt Blau */
    margin: 0;
    font-size: 24px;
}


/* Spezielle Anpassungen für die neuen Charts 9-13 */
/* Begrenze die Breite der Chart-Container für konsistente Darstellung */
.chart-container {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Spezifische Anpassungen für Charts mit langen Labels */
#chart9, #chart10, #chart11, #chart12, #chart13 {
    font-size: 0.9em; /* Kleinere Schrift für bessere Platzausnutzung */
}

/* Filter-Bereiche für neue Charts optimieren */
.dashboard-filters {
    flex-wrap: wrap;
    max-width: 100%;
    min-height: 60px; /* Mindesthöhe für konsistente Darstellung */
}

.dashboard-filters .filter-group {
    min-width: 180px;
    max-width: 250px;
    margin-bottom: 10px; /* Zusätzlicher Abstand bei Umbruch */
}

.dashboard-filters .filter-group select {
    max-width: 100%;
    min-width: 120px;
    font-size: 0.9em;
}

.dashboard-filters .filter-group label {
    white-space: nowrap; /* Verhindert Zeilenumbruch bei Labels */
    margin-right: 8px;
}

/* Reset-Button für individuelle Charts */
.filter-reset-btn {
    background-color: #95a5a6;
    color: white;
    border: none;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    min-width: 28px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
    margin-left: auto;
}

.filter-reset-btn:hover {
    background-color: #7f8c8d;
    transform: rotate(90deg);
}

.filter-reset-btn:active {
    background-color: #6c7b7d;
}

/* Chart-Titel für neue Charts anpassen */
.chart-container h2 {
    word-wrap: break-word;
    hyphens: auto;
    line-height: 1.2;
    max-width: 100%;
}

/* Donut-Chart spezielle Anpassungen */
#chartAssignmentTypes {
    max-width: 100%;
}

/* Responsive Anpassungen für kleinere Bildschirme */
@media (max-width: 1400px) {
    .chart-pair {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .chart-container {
        height: 350px;
    }
}

@media (max-width: 1200px) {
    .dashboard-filters {
        gap: 15px;
        padding: 12px;
    }
    
    .filter-group {
        min-width: 140px;
        max-width: 200px;
    }
}

@media (max-width: 768px) {
    .dashboard-filters {
        gap: 10px;
        padding: 10px;
    }
    
    .filter-group {
        min-width: 120px;
        max-width: 100%;
        width: 100%;
    }
    
    .filter-group select {
        min-width: 100px;
    }
    
    .filter-reset-btn {
        font-size: 0.9em;
        min-width: 24px;
        height: 24px;
        padding: 4px 6px;
        margin-top: 10px;
        margin-left: auto;
        align-self: flex-end;
        border-radius: 3px;
    }
}


@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .header-actions {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .header-export-button {
        padding: 6px 10px;
        font-size: 0.8em;
    }
    
    .logout-btn {
        padding: 8px 16px;
        font-size: 0.85em;
    }
}

/* Chart-Header und Export-Buttons für einzelne Charts */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.chart-header h2 {
    margin: 0;
    padding-top: 2px; /* minimale Verschiebung nach unten für optische Ausrichtung */
    font-size: 1.2em;
    color: var(--primary-color);
    flex: 1;
}

.chart-export-buttons {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
    margin-left: 15px;
}

.chart-export-btn {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
    color: #495057;
}

.chart-export-btn:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chart-export-btn.csv:hover {
    background-color: #d4edda;
    border-color: #27ae60;
    color: #155724;
}

.chart-export-btn.excel:hover {
    background-color: #cce5ff;
    border-color: #3498db;
    color: #004085;
}

.chart-export-btn:active {
    transform: translateY(0);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

/* Responsive Anpassungen für Chart-Export-Buttons */
@media (max-width: 768px) {
    .chart-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .chart-export-buttons {
        align-self: flex-end;
        margin-left: 0;
    }
    
    .chart-export-btn {
        width: 24px;
        height: 24px;
        font-size: 0.8em;
    }
}

/* === INTERAKTIVE ZEITLEISTE STYLES === */

.timeline-container {
    background-color: var(--chart-background);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    gap: 20px;
}

.timeline-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.2em;
    font-weight: 600;
    flex-shrink: 0;
    line-height: 1.4;
    margin-top: 8px;
}

.timeline-date-inputs {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    flex-wrap: wrap;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
}

.date-input-group label {
    font-size: 0.85em;
    font-weight: 500;
    color: var(--primary-color);
}

.date-time-wrapper {
    display: flex;
    gap: 6px;
    align-items: center;
}

.timeline-date-input {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9em;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
    flex: 1;
    min-width: 130px;
}

.timeline-time-input {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9em;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
    width: 100px;
}

.timeline-date-input:focus,
.timeline-time-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.weekday-filter-group {
    flex: 1;
    min-width: 300px;
}

.weekday-checkboxes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.weekday-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    user-select: none;
}

.weekday-checkbox:hover {
    background-color: #f0f0f0;
}

.weekday-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.weekday-checkbox span {
    font-size: 0.9em;
    font-weight: 500;
}

.weekday-checkbox input[type="checkbox"]:checked + span {
    color: var(--secondary-color);
    font-weight: 600;
}

.timeline-quick-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 2px;
}

.timeline-apply-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 7px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.timeline-apply-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.timeline-reset-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 7px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.timeline-reset-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.timeline-info-bar {
    text-align: center;
    margin-bottom: 10px;
    padding: 8px 15px;
    background: #f8f9fa;
    border-radius: 20px;
    border: 1px solid #e9ecef;
}

.timeline-info-bar span {
    font-size: 0.9em;
    color: var(--primary-color);
    font-weight: 500;
}

.timeline-content {
    position: relative;
    padding: 20px 0;
    margin: 20px 0;
}

.timeline-track {
    position: relative;
    height: 40px;
    margin: 10px 20px;
    cursor: grab;
}

.timeline-track:active {
    cursor: grabbing;
}

.timeline-background {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(90deg, #e9ecef 0%, #dee2e6 50%, #e9ecef 100%);
    border-radius: 4px;
    transform: translateY(-50%);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.timeline-selected-range {
    position: absolute;
    top: 50%;
    height: 8px;
    background: linear-gradient(90deg, var(--secondary-color) 0%, #2980b9 100%);
    border-radius: 4px;
    transform: translateY(-50%);
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.timeline-handles {
    position: relative;
    height: 100%;
}

.timeline-handle {
    position: absolute;
    top: 50%;
    width: 20px;
    height: 20px;
    background: var(--secondary-color);
    border: 3px solid white;
    border-radius: 50%;
    cursor: grab;
    transform: translate(-50%, -50%);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4);
    z-index: 10;
}

.timeline-handle:hover {
    transform: translate(-50%, -50%) scale(1.2);
    background: #2980b9;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.6);
}

.timeline-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.1);
}

.timeline-handle-left {
    z-index: 11;
}

.timeline-handle-right {
    z-index: 11;
}

.timeline-handle-tooltip {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 20;
}

.timeline-handle-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
}

.timeline-handle:hover .timeline-handle-tooltip {
    opacity: 1;
    bottom: 35px;
}

.timeline-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
}

.timeline-marker {
    position: absolute;
    top: 50%;
    width: 2px;
    height: 12px;
    background: #adb5bd;
    transform: translate(-50%, -50%);
}

.timeline-marker.major {
    height: 18px;
    background: #6c757d;
    width: 3px;
}

.timeline-marker-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7em;
    color: #6c757d;
    white-space: nowrap;
    margin-top: 5px;
}

.timeline-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.timeline-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.timeline-btn-reset {
    background-color: #6c757d;
    color: white;
}

.timeline-btn-reset:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.timeline-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.timeline-preset-btn {
    padding: 6px 12px;
    border: 1px solid var(--secondary-color);
    background: white;
    color: var(--secondary-color);
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s ease;
    font-weight: 500;
}

.timeline-preset-btn:hover {
    background: var(--secondary-color);
    color: white;
    transform: translateY(-1px);
}

.timeline-preset-btn.active {
    background: var(--secondary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

/* Responsive Design für Timeline */
@media (max-width: 1200px) {
    .timeline-controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .timeline-presets {
        justify-content: center;
    }
}

@media (max-width: 1000px) {
    .timeline-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .timeline-header h3 {
        text-align: center;
        margin-top: 0;
    }
    
    .timeline-date-inputs {
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .timeline-container {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .timeline-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .timeline-date-inputs {
        justify-content: space-between;
        gap: 8px;
    }
    
    .date-input-group {
        min-width: 100px;
        flex: 1;
    }
    
    .weekday-filter-group {
        min-width: 100%;
        flex: 100%;
    }
    
    .weekday-checkboxes {
        gap: 6px;
        justify-content: center;
    }
    
    .weekday-checkbox {
        padding: 3px 6px;
    }
    
    .weekday-checkbox span {
        font-size: 0.85em;
    }
    
    .date-time-wrapper {
        flex-direction: column;
        gap: 4px;
    }
    
    .timeline-date-input,
    .timeline-time-input {
        font-size: 0.85em;
        padding: 5px 6px;
        width: 100%;
        min-width: 100%;
    }
    
    .timeline-quick-actions {
        justify-content: center;
        margin-top: 8px;
        flex: 100%;
    }
    
    .timeline-apply-btn,
    .timeline-reset-btn {
        padding: 8px 16px;
        font-size: 0.8em;
    }
    
    .timeline-info-bar {
        padding: 6px 10px;
        font-size: 0.85em;
    }
    
    .timeline-track {
        margin: 10px 10px;
    }
    
    .timeline-preset-btn {
        padding: 8px 10px;
        font-size: 0.8em;
    }
    
    .timeline-handle {
        width: 18px;
        height: 18px;
    }
    
    .timeline-handle:hover {
        transform: translate(-50%, -50%) scale(1.15);
    }
}

/* Timeline Animation */
@keyframes timelineHighlight {
    0% { box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3); }
    50% { box-shadow: 0 4px 12px rgba(52, 152, 219, 0.6); }
    100% { box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3); }
}

.timeline-selected-range.updating {
    animation: timelineHighlight 0.6s ease-in-out;
}

/* Zeitleiste Loading State */
.timeline-container.loading {
    opacity: 0.7;
    pointer-events: none;
}

.timeline-container.loading .timeline-track {
    cursor: not-allowed;
}

/* Accessibility */
.timeline-handle:focus {
    outline: 3px solid rgba(52, 152, 219, 0.5);
    outline-offset: 2px;
}

.timeline-preset-btn:focus,
.timeline-btn:focus {
    outline: 2px solid rgba(52, 152, 219, 0.5);
    outline-offset: 1px;
}

/* Globale Filter Styles */
.global-filters-container {
    background: var(--chart-background);
    border-radius: 12px;
    padding: 20px;
    margin: 30px 0 20px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e0e6ed;
    position: sticky;
    top: 10px;
    z-index: 100;
    transition: all 0.3s ease;
}

.global-filters-container.scrolled {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--secondary-color);
}

.global-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f3f4;
}

.global-filters-header h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.2em;
    font-weight: 600;
}

.filters-reset-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filters-reset-btn:hover {
    background-color: #c0392b;
    transform: translateY(-1px);
}

.global-filters-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.global-filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.global-filter-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95em;
}

.global-filter-select {
    padding: 10px 12px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    background: white;
    font-size: 0.9em;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    /* Multi-Select spezifische Stile */
    min-height: 80px;
    max-height: 120px;
    overflow-y: auto;
    min-width: 180px;
}

.global-filter-select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.global-filter-select:hover {
    border-color: #bdc3c7;
}

/* Hilfetext für Multi-Select */
.filter-help {
    color: #7f8c8d;
    font-size: 0.75em;
    margin-top: 2px;
    display: block;
    font-style: italic;
}

/* Multi-Select Optionen */
.global-filter-select option {
    padding: 4px 6px;
    font-size: 0.9em;
}

.global-filter-select option:checked {
    background-color: var(--secondary-color) !important;
    color: white !important;
    font-weight: 500;
}

.global-filter-select option:hover {
    background-color: #ecf0f1 !important;
}

/* Dediziertes Suchfeld */
.search-section {
    margin-bottom: 20px;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.global-search-input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    background: white;
    font-size: 1em;
    color: var(--text-color);
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.global-search-input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

.global-search-input::placeholder {
    color: #bdc3c7;
    font-style: italic;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e0e6ed;
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-suggestions.active {
    display: block;
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
}

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

.suggestion-item:hover,
.suggestion-item.highlighted {
    background-color: #f8f9fa;
}

.suggestion-category {
    background-color: var(--secondary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 500;
    text-transform: uppercase;
}

.suggestion-text {
    flex: 1;
    font-size: 0.9em;
}

.suggestion-meta {
    font-size: 0.8em;
    color: #7f8c8d;
}

/* Filter-Dropdowns */
.filter-dropdowns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
    width: 100%;
}

.filter-dropdown-container {
    position: relative;
    min-width: 300px;
    width: 100%;
    pointer-events: auto !important;
}

.filter-dropdown-btn {
    background: white;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-size: 0.9em;
    transition: all 0.3s ease;
    min-height: 44px;
    pointer-events: auto !important;
    z-index: 10;
    position: relative;
}

.filter-dropdown-btn:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.1);
}

.filter-dropdown-btn.active {
    border-color: var(--secondary-color);
    background-color: rgba(52, 152, 219, 0.05);
}

.filter-label {
    font-weight: 600;
    color: var(--text-color);
}

.filter-count {
    color: #7f8c8d;
    font-size: 0.85em;
    margin: 0 8px;
    flex: 1;
    text-align: left;
    margin-left: 12px;
}

.filter-count.has-selection {
    color: var(--secondary-color);
    font-weight: 600;
}

.dropdown-arrow {
    color: #bdc3c7;
    transition: transform 0.3s ease;
    font-size: 0.8em;
}

.filter-dropdown-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

.filter-dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e0e6ed;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 300px;
    width: 100%;
}

.filter-dropdown-content.active {
    display: block;
}

.dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f3f4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f8f9fa;
}

.dropdown-title {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-color);
}

.clear-filter-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1.2em;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.clear-filter-btn:hover {
    background-color: #e74c3c;
    color: white;
}

.dropdown-options {
    max-height: 320px;
    overflow-y: auto;
    padding: 4px 0;
}

.dropdown-option {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    cursor: pointer !important;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
    user-select: none;
    min-height: 44px;
    gap: 10px;
}

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

.dropdown-option:hover {
    background-color: #f1f3f4;
}

.dropdown-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer !important;
    margin: 0;
    accent-color: var(--secondary-color);
}

.option-text {
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-color);
    flex: 1;
    cursor: pointer !important;
}

.dropdown-option input[type="checkbox"] {
    margin: 0;
    margin-right: 10px;
    cursor: pointer;
}

.option-text {
    flex: 1;
    font-size: 0.9em;
    color: var(--text-color);
}

.dropdown-option input[type="checkbox"]:checked + .option-text {
    color: var(--secondary-color);
    font-weight: 500;
}

/* Scroll-Styling für Dropdowns */
.filter-dropdown-content::-webkit-scrollbar,
.dropdown-options::-webkit-scrollbar,
.search-suggestions::-webkit-scrollbar {
    width: 6px;
}

.filter-dropdown-content::-webkit-scrollbar-track,
.dropdown-options::-webkit-scrollbar-track,
.search-suggestions::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.filter-dropdown-content::-webkit-scrollbar-thumb,
.dropdown-options::-webkit-scrollbar-thumb,
.search-suggestions::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.filter-dropdown-content::-webkit-scrollbar-thumb:hover,
.dropdown-options::-webkit-scrollbar-thumb:hover,
.search-suggestions::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.active-filters {
    padding-top: 15px;
    border-top: 1px solid #f1f3f4;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.active-filters-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95em;
}

.active-filters-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-badge {
    background: linear-gradient(135deg, var(--secondary-color), #5dade2);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.3s ease;
}

.filter-badge .remove-badge {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.filter-badge .remove-badge:hover {
    opacity: 1;
}

.filter-values {
    position: relative;
    cursor: help;
}

.filter-values[title]:hover {
    text-decoration: underline;
    cursor: help;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design für globale Filter */
@media (max-width: 768px) {
    .global-filters-container {
        margin: 15px 0 10px 0;
        padding: 15px;
        border-radius: 8px;
        top: 5px;
    }
    
    .global-filters-content {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 15px;
    }
    
    .global-filters-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
        margin-bottom: 15px;
    }
    
    .global-filters-header h3 {
        font-size: 1.1em;
        text-align: center;
    }
    
    .filters-reset-btn {
        padding: 10px 16px;
        font-size: 0.85em;
    }
    
    .global-filter-select {
        padding: 12px;
        font-size: 16px; /* Verhindert Zoom auf iOS */
    }
    
    /* Responsive Anpassungen für neues Filter-Interface */
    .search-container {
        max-width: 100%;
    }
    
    .global-search-input {
        font-size: 16px; /* Verhindert Zoom auf iOS */
        padding: 12px 16px;
    }
    
    .filter-dropdowns {
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-dropdown-container {
        min-width: 100%;
    }
    
    .filter-dropdown-btn {
        padding: 14px 16px;
        font-size: 16px;
    }
    
    .search-suggestions {
        max-height: 200px;
    }
    
    .suggestion-item {
        padding: 14px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .suggestion-category {
        font-size: 0.7em;
        padding: 2px 6px;
    }
    
    .suggestion-text {
        font-size: 1em;
        word-break: break-word;
    }
    
    .suggestion-meta {
        font-size: 0.85em;
    }
    
    .active-filters {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding-top: 12px;
    }
    
    .filter-badge {
        font-size: 0.75em;
        padding: 5px 10px;
    }
    
    /* Sticky Anpassung für mobile */
    .global-filters-container.scrolled {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    }
}

/* Sticky Datumsanzeige */
.sticky-date-display {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(52, 152, 219, 0.95);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 1em;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    display: none; /* Initially hidden */
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.sticky-date-display.visible {
    display: flex;
    animation: fadeInDown 0.3s ease;
}

.sticky-date-display:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    background: rgba(52, 152, 219, 1);
}

.date-icon {
    font-size: 1.1em;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@media (max-width: 480px) {
    .sticky-date-display {
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        padding: 8px 14px;
        font-size: 0.85em;
        max-width: calc(100vw - 40px);
    }

    .global-filters-container {
        top: 0;
        margin: 10px 0 5px 0;
        padding: 12px;
    }
    
    .global-filters-content {
        gap: 12px;
    }
    
    .global-filter-group label {
        font-size: 0.9em;
    }
}
