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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header h1 {
    font-size: 1.8rem;
    margin: 0;
    flex-shrink: 0;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

#fileInput {
    padding: 0.5rem;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

button {
    padding: 0.5rem 1rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

button:hover:not(:disabled) {
    background-color: #2980b9;
}

button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

#fileName {
    color: #ecf0f1;
    font-style: italic;
}

.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: #34495e;
    color: white;
}

#caseInfo {
    font-weight: bold;
    font-size: 1.1rem;
}

.main-container {
    display: flex;
    height: calc(100vh - 140px);
    gap: 0;
    padding: 1rem 2rem;
}

.left-panel, .right-panel {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.left-panel {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
}

.left-panel .panel-content {
    flex: 1;
    overflow-y: auto;
}

/* Resize Handle */
.resize-handle {
    width: 8px;
    background-color: #bdc3c7;
    cursor: col-resize;
    flex-shrink: 0;
    transition: background-color 0.2s;
    position: relative;
    margin: 0 0.5rem;
}

.resize-handle:hover {
    background-color: #3498db;
}

.resize-handle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 3px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 2px;
}

.right-panel {
    flex: 1;
}

.panel-header {
    background-color: #ecf0f1;
    padding: 1rem;
    border-bottom: 2px solid #bdc3c7;
}

.panel-header h2 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

/* Search Input */
.search-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.search-container {
    padding: 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

.search-container .search-input {
    margin-top: 0;
}

.search-count-badge {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #27ae60;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Panel Notes Section */
.panel-notes {
    padding: 1rem;
    background-color: #f8f9fa;
    border-top: 2px solid #bdc3c7;
}

.panel-notes h3 {
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.panel-notes textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.panel-notes textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* Tab Navigation */
.main-tab-navigation {
    display: flex;
    background-color: #34495e;
    border-bottom: 2px solid #2c3e50;
    overflow-x: auto;
}

.main-tab-button {
    flex: 1;
    padding: 1rem 1.5rem;
    background-color: transparent;
    color: #ecf0f1;
    border: none;
    border-bottom: 4px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.main-tab-button:hover:not(.active) {
    background-color: #2c3e50;
    color: white;
}

.main-tab-button.active {
    color: white;
    border-bottom-color: #3498db;
    background-color: #2c3e50;
}

/* Sub Tab Navigation */
.sub-tab-navigation {
    display: flex;
    background-color: #ecf0f1;
    border-bottom: 2px solid #bdc3c7;
    overflow-x: auto;
    padding: 0.5rem 1rem;
}

.sub-tab-button {
    flex: 0 0 auto;
    padding: 0.6rem 1.2rem;
    background-color: transparent;
    color: #7f8c8d;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    margin-right: 0.5rem;
}

.sub-tab-button:hover:not(.active) {
    background-color: #d5d8dc;
    color: #2c3e50;
}

.sub-tab-button.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background-color: white;
}

/* Main Tab Content */
.main-tab-content {
    display: none;
    flex-direction: column;
    height: 100%;
}

.main-tab-content.active {
    display: flex;
}

/* Sub Tab Content */
.sub-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.sub-tab-content.active {
    display: block;
}

/* Legacy tab styles (if needed) */
.tab-navigation {
    display: flex;
    background-color: #f8f9fa;
    border-bottom: 2px solid #bdc3c7;
    overflow-x: auto;
}

.tab-button {
    flex: 0 0 auto;
    padding: 0.8rem 1.5rem;
    background-color: transparent;
    color: #7f8c8d;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-button:hover:not(.active) {
    background-color: #ecf0f1;
    color: #2c3e50;
}

.tab-button.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background-color: white;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.panel-content > * {
    padding: 1.5rem;
}

.panel-content > .analysis-section,
.panel-content > .search-container {
    padding: 1.5rem;
}

.left-panel .panel-content {
    padding: 1.5rem;
}

.placeholder {
    color: #95a5a6;
    text-align: center;
    padding: 2rem;
    font-style: italic;
}

.analysis-section {
    margin-bottom: 2rem;
}

.analysis-section h3 {
    color: #2c3e50;
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
}

.content-box {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

/* JSON Viewer Styles */
.json-container {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.json-key {
    color: #a71d5d;
    font-weight: bold;
}

.json-string {
    color: #0086b3;
}

.json-number {
    color: #0086b3;
}

.json-boolean {
    color: #0086b3;
}

.json-null {
    color: #999;
}

.json-line {
    padding: 2px 0;
    line-height: 1.8;
}

.json-toggle {
    cursor: pointer;
    user-select: none;
    color: #666;
    font-weight: bold;
    margin-right: 5px;
    display: inline-block;
    width: 15px;
}

.json-toggle:hover {
    color: #000;
}

.json-collapsible {
    margin-left: 20px;
}

.json-collapsed {
    display: none;
}

/* Notes Area */
#notesArea,
.tab-notes {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

#notesArea:focus,
.tab-notes:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.notes-meta {
    margin-top: 0.5rem;
    text-align: right;
}

.notes-meta small {
    color: #27ae60;
    font-style: italic;
}

/* Zusammenfassung specific styling */
#zusammenfassung {
    white-space: pre-wrap;
    line-height: 1.8;
}

/* Search highlight */
.search-highlight {
    background-color: #ffeb3b;
    color: #000;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: bold;
}

/* Content text fallback */
.content-text {
    white-space: pre-wrap;
    line-height: 1.6;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    margin: 0;
}

/* Scrollbar styling */
.panel-content::-webkit-scrollbar {
    width: 8px;
}

.panel-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.panel-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-container {
        flex-direction: column;
        height: auto;
    }
    
    .left-panel, .right-panel {
        flex: none;
        min-height: 400px;
    }
}

/* Timeline Swimlanes Styles */
.timeline-controls {
    display: flex;
    gap: 10px;
    padding: 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
    align-items: center;
    flex-wrap: wrap;
}

.timeline-btn {
    padding: 8px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.timeline-btn:hover {
    background-color: #2980b9;
}

.timeline-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 8px;
}

.timeline-checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.filter-container {
    padding: 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
    max-height: 200px;
    overflow-y: auto;
}

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

.filter-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #2c3e50;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.filter-action-btn {
    padding: 4px 12px;
    background-color: #95a5a6;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s;
}

.filter-action-btn:hover {
    background-color: #7f8c8d;
}

.type-filters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.type-filter-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.type-filter-item:hover {
    background-color: #f0f0f0;
    border-color: #bbb;
}

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

.type-filter-symbol {
    font-size: 1.1rem;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

.type-filter-label {
    font-size: 0.85rem;
    color: #555;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.type-filter-count {
    font-size: 0.75rem;
    color: #999;
    background-color: #f0f0f0;
    padding: 2px 6px;
    border-radius: 10px;
}

.legend-container {
    padding: 15px;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    max-height: 150px;
    overflow-y: auto;
}

.legend-container h4 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #2c3e50;
}

#legendContent {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.legend-symbol {
    font-size: 1.2rem;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

.legend-label {
    color: #555;
}

.timeline-container {
    position: relative;
    overflow: auto;
    background-color: #ffffff;
    height: calc(100vh - 600px);
    min-height: 400px;
    border: 1px solid #ddd;
}

#timelineCanvas {
    display: block;
    cursor: crosshair;
}

.timeline-info {
    padding: 15px;
    background-color: #f8f9fa;
    border-top: 1px solid #ddd;
    font-size: 0.9rem;
    color: #555;
}

.timeline-info p {
    margin: 0;
}

/* Timeline tooltip */
.timeline-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 1000;
    max-width: 350px;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    line-height: 1.5;
}

.timeline-tooltip strong {
    color: #ffeb3b;
    font-size: 0.95rem;
}

.timeline-tooltip em {
    color: #b0bec5;
    font-size: 0.8rem;
}

/* Krankheitsbilder Timeline Styles */
.kb-timeline-container {
    position: relative;
    overflow: auto;
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 600px;
    min-height: 400px;
    margin-bottom: 15px;
}

#krankheitsbilderCanvas {
    display: block;
    cursor: crosshair;
}

