/**
 * ============================================================
 *  SEPDataForge - SEP Interactive (Simon Erich Plath)
 *  Made with ❤️ for Steffi
 *  Copyright © 2025 - All Rights Reserved
 * ============================================================
 */

/* ===== Grundlegende Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette - Light Mode (Default) */
    --primary: #667eea;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-body: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --shadow-card: 0 4px 6px rgba(0, 0, 0, 0.1);
}

:root.dark-mode {
    /* Color Palette - Dark Mode */
    --primary: #8e9eeb;
    --primary-gradient: linear-gradient(135deg, #1f1c2c 0%, #928dab 100%);
    --bg-body: linear-gradient(135deg, #232526 0%, #414345 100%);
    --bg-card: #2a2a35;
    --bg-input: #3b3b4f;
    --text-main: #e0e0e0;
    --text-muted: #aaaaaa;
    --border-color: #444455;
    --shadow-card: 0 4px 6px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-body);
    min-height: 100vh;
    color: var(--text-main);
}

/* ===== Globale Navigation Bar ===== */
.main-navbar {
    background: transparent;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0;
}

.brand-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.brand-text {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.5px;
}

.navbar-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.navbar-links .nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    text-decoration: none;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.navbar-links .nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.navbar-links .nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.navbar-links .nav-link.admin-link {
    background: rgba(255, 107, 107, 0.3);
    border-color: rgba(255, 107, 107, 0.5);
}

.navbar-links .nav-link.admin-link:hover {
    background: rgba(255, 107, 107, 0.5);
    border-color: rgba(255, 107, 107, 0.7);
}

/* Nutzer-Info im Navbar */
.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.logout-btn:hover {
    background: rgba(255, 77, 77, 0.8);
    transform: scale(1.05);
}



.navbar-links .nav-link.admin-link:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 20px;
}

/* ===== Page Header (nach Navbar) ===== */
/* ===== Page Header (nach Navbar) ===== */
.page-header {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
    text-align: center;
    color: var(--text-main);
}


.page-header h1 {
    font-size: 2.2rem;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
    margin-top: 8px;
}

.header-nav {
    margin-top: 15px;
}

.nav-link {
    display: inline-block;
    padding: 8px 16px;
    background: #2a2a4a;
    color: #4fc3f7;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: #3a3a5a;
    transform: translateY(-2px);
}

/* ===== Collapsible Sections ===== */
.collapsible .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 5px 0;
    margin: -5px 0 15px 0;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.collapsible .section-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.collapsible .section-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.collapse-icon {
    color: #4fc3f7;
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.collapsible.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapsible .section-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.collapsible.collapsed .section-content {
    max-height: 0;
    opacity: 0;
}

.file-count-badge {
    background: #4fc3f7;
    color: #000;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
}

/* ===== Sections ===== */
/* ===== Sections ===== */
section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
    color: var(--text-main);
}

section h2 {
    color: var(--text-main);
    font-size: 1.5rem;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

/* ===== Settings Section ===== */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: center;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 14px;
}

.setting-item input[type="file"] {
    padding: 10px;
    background: #2a2a4a;
    border: 1px dashed #4a4a7a;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
}

.setting-item input[type="file"]:hover {
    border-color: #6a6aba;
    background: #3a3a5a;
}

.status {
    font-size: 0.9rem;
    color: #888;
}

.status.loaded {
    color: #4caf50;
}

.count {
    font-size: 2rem;
    font-weight: bold;
    color: #4fc3f7;
}

.csv-format-hint {
    margin-top: 15px;
    padding: 10px 15px;
    background: #2a2a4a;
    border-left: 3px solid #4fc3f7;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #aaa;
}

/* ===== Upload Section ===== */
.upload-area {
    border: 2px dashed #4a4a7a;
    border-radius: 12px;
    padding: 50px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.upload-area:hover {
    border-color: #6a6aba;
    background: rgba(106, 106, 186, 0.1);
}

.upload-area.dragover {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.upload-area p {
    color: #888;
    font-size: 1.1rem;
}

.upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ===== Results Section ===== */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.results-header .actions {
    display: flex;
    gap: 10px;
}

#fileCount {
    font-size: 1.1rem;
    color: #4fc3f7;
}

.results-list {
    max-height: 500px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: #999;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 8px;
}

/* ===== Result Item ===== */
/* ===== Result Item ===== */
.result-item {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    border: 2px solid transparent;
    color: var(--text-main);
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-color: #667eea;
}

.result-item.success {
    border-left: 4px solid #4caf50;
}

.result-item.warning {
    border-left: 4px solid #ff9800;
}

.result-item.error {
    border-left: 4px solid #f44336;
}

.result-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.result-original {
    font-size: 0.85rem;
    color: #999;
}

.result-new {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    word-break: break-all;
}

.result-details {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.detail-badge {
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 12px;
    background: #f0f0f0;
    color: #333;
    font-weight: 600;
}

.detail-badge.mieternummer {
    background: #1e88e5;
    color: #fff;
}

.detail-badge.mietername {
    background: #43a047;
    color: #fff;
}

.detail-badge.dokumententyp {
    background: #fb8c00;
    color: #fff;
}

.detail-badge.jahr {
    background: #8e24aa;
    color: #fff;
}

.detail-badge.quelle {
    background: #607d8b;
    color: #fff;
    font-size: 0.75rem;
}

.result-actions {
    display: flex;
    gap: 8px;
}

/* ===== Buttons ===== */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
}

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #45a049;
}

.btn-danger {
    background: #ff6b6b;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #ff5252;
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #4a4a7a;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-icon {
    padding: 8px;
    min-width: 36px;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    color: var(--text-main);
    padding: 32px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===== Modal mit PDF-Vorschau ===== */
.modal-content.modal-with-preview {
    display: flex;
    max-width: 1100px;
    width: 95%;
    padding: 0;
    max-height: 90vh;
    overflow: hidden;
}

.modal-form-section {
    flex: 0 0 400px;
    padding: 30px;
    border-right: 1px solid #3a3a5a;
    overflow-y: auto;
}

.modal-preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0d0d1a;
    min-width: 300px;
}

.modal-preview-section .preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: linear-gradient(135deg, #1a1a30, #252545);
    border-bottom: 1px solid #3a3a5a;
    color: #888;
    font-size: 0.9rem;
}

.modal-preview-section .preview-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.modal-preview-section .btn-preview-nav,
.modal-preview-section .btn-preview-zoom {
    background: #2a2a4a;
    border: 1px solid #3a3a5a;
    color: #e0e0e0;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.modal-preview-section .btn-preview-nav:hover,
.modal-preview-section .btn-preview-zoom:hover {
    background: #3a3a5a;
    border-color: #4fc3f7;
}

.modal-preview-section .preview-page-info {
    color: #888;
    font-size: 0.85rem;
    min-width: 45px;
    text-align: center;
}

.modal-preview-section .preview-canvas-container {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    padding: 15px;
    background: #0a0a15;
}

.modal-preview-section #editPreviewCanvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    background: #fff;
}

.modal-preview-section .preview-loading,
.modal-preview-section .preview-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #888;
    font-size: 0.9rem;
    padding: 40px;
    height: 100%;
}

.modal-preview-section .preview-loading .loading-spinner {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.modal-preview-section .preview-error {
    color: #ef5350;
}

.modal-preview-section .preview-error span:first-child {
    font-size: 2rem;
}

/* Responsive für Modal mit Vorschau */
@media (max-width: 900px) {
    .modal-content.modal-with-preview {
        flex-direction: column;
        max-height: 95vh;
    }

    .modal-form-section {
        flex: 0 0 auto;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid #3a3a5a;
    }

    .modal-preview-section {
        flex: 1;
        min-height: 200px;
        max-height: 40vh;
    }
}

.modal-content.modal-large {
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--text-main);
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s;
    background: var(--bg-input);
    color: var(--text-main);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filename-preview {
    display: block;
    padding: 12px;
    background: #2a2a4a;
    border-radius: 8px;
    color: #4fc3f7;
    font-family: monospace;
    word-break: break-all;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

#extractedTextContent {
    background: #2a2a4a;
    padding: 15px;
    border-radius: 8px;
    white-space: pre-wrap;
    font-size: 0.9rem;
    max-height: 400px;
    overflow-y: auto;
    color: #ccc;
}

/* ===== Footer ===== */
footer,
.app-footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.footer-logo {
    height: 117px;
    width: auto;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.footer-logo:hover {
    opacity: 1;
}

footer p,
.app-footer p {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    color: #888;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f0f0f0;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

::-webkit-scrollbar-thumb:hover {
    background: #6a6aba;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .results-header {
        flex-direction: column;
        gap: 15px;
    }

    .result-item {
        grid-template-columns: 1fr;
    }

    .result-actions {
        justify-content: flex-start;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-item {
    animation: fadeIn 0.3s ease;
}

/* ===== Merge Section ===== */
.merge-section {
    border: 2px solid #4a4a7a;
}

.section-description {
    color: #888;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.merge-settings {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.merge-settings .form-group {
    margin-bottom: 0;
}

.merge-area {
    border-color: #ff9800;
    background: rgba(255, 152, 0, 0.05);
}

.merge-area:hover {
    border-color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
}

.merge-files-list {
    margin: 20px 0;
    min-height: 100px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border: 2px dashed #e0e0e0;
}

.merge-file-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: grab;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.merge-file-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.merge-file-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.merge-file-item.drag-over {
    border: 2px dashed #4fc3f7;
    background: rgba(79, 195, 247, 0.1);
}

.merge-file-number {
    width: 30px;
    height: 30px;
    background: #ff9800;
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.merge-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.merge-file-pages {
    color: #888;
    font-size: 0.85rem;
}

.merge-file-remove {
    background: none;
    border: none;
    color: #f44336;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.merge-file-remove:hover {
    opacity: 1;
}

.merge-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #4a4a7a;
}

.merge-preview {
    color: #888;
}

.merge-preview span {
    color: #ff9800;
    font-family: monospace;
    font-size: 1.1rem;
}

.merge-buttons {
    display: flex;
    gap: 10px;
}

/* Responsive für Merge Settings */
@media (max-width: 768px) {
    .merge-settings {
        grid-template-columns: 1fr;
    }

    .merge-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .merge-buttons {
        flex-direction: column;
    }
}

/* ===== Loading Spinner ===== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #4a4a7a;
    border-top-color: #4fc3f7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Order Section (Dokumententyp-Reihenfolge) ===== */
.order-section {
    border: 2px solid #4fc3f7;
    background: rgba(79, 195, 247, 0.05);
}

.order-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.order-list {
    background: #2a2a4a;
    border-radius: 8px;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.order-list.collapsed {
    max-height: 0;
    padding: 0 15px;
    overflow: hidden;
}

.order-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    background: #3a3a5a;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.order-item:hover {
    background: #4a4a7a;
    transform: translateX(3px);
}

.order-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
    background: #5a5a8a;
}

.order-item.drag-over {
    border: 2px dashed #4fc3f7;
    background: rgba(79, 195, 247, 0.2);
}

.order-drag-handle {
    color: #666;
    font-size: 1.1rem;
    cursor: grab;
    padding: 0 5px;
}

.order-drag-handle:hover {
    color: #4fc3f7;
}

.order-number {
    width: 30px;
    height: 30px;
    background: #4fc3f7;
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.order-name {
    flex: 1;
    font-size: 0.95rem;
}

.order-arrows {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-arrow-btn {
    background: #2a2a4a;
    border: 1px solid #4a4a7a;
    color: #aaa;
    padding: 2px 8px;
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.order-arrow-btn:hover:not(:disabled) {
    background: #4fc3f7;
    color: #000;
    border-color: #4fc3f7;
}

.order-arrow-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.order-handle {
    color: #666;
    font-size: 1.2rem;
    cursor: grab;
}

.order-info {
    margin-top: 15px;
    padding: 10px 15px;
    background: #2a2a4a;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #888;
}

/* ===== Auto-Mode Toggle ===== */
.auto-mode-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 15px;
    background: #2a2a4a;
    border-radius: 8px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3a3a5a;
    transition: 0.3s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #4caf50;
}

input:checked+.slider:before {
    transform: translateX(24px);
}

/* ===== Grouped Section ===== */
.grouped-section {
    border: 2px solid #4caf50;
    background: rgba(76, 175, 80, 0.05);
}

.grouped-section.hidden {
    display: none;
}

.grouped-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#groupCount {
    font-size: 1.1rem;
    color: #4caf50;
}

.grouped-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.grouped-item {
    background: #2a2a4a;
    border-radius: 10px;
    overflow: hidden;
    border-left: 4px solid #4caf50;
}

.grouped-header-info {
    padding: 15px 20px;
    background: #3a3a5a;
}

.grouped-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.grouped-icon {
    font-size: 1.5rem;
}

.grouped-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4caf50;
    font-family: monospace;
    word-break: break-all;
}

.grouped-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.meta-badge {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 12px;
    background: #4a4a7a;
    color: #fff;
}

.grouped-files {
    padding: 15px 20px;
    border-top: 1px solid #4a4a7a;
}

.grouped-file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #3a3a5a;
    cursor: grab;
    transition: background 0.2s, transform 0.2s;
}

.grouped-file-item:hover {
    background: rgba(79, 195, 247, 0.1);
}

.grouped-file-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.grouped-file-item:last-child {
    border-bottom: none;
}

.file-drag-handle {
    color: #666;
    cursor: grab;
    padding: 0 5px;
    font-size: 1rem;
}

.file-drag-handle:hover {
    color: #4fc3f7;
}

.file-order {
    width: 25px;
    color: #4caf50;
    font-weight: bold;
}

.file-type-badge {
    padding: 3px 10px;
    background: #fb8c00;
    color: #fff;
    border-radius: 10px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.file-original {
    flex: 1;
    color: #888;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sortier-Buttons innerhalb Gruppe */
.file-order-buttons {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.btn-order {
    padding: 2px 6px;
    font-size: 0.7rem;
    background: transparent;
    border: 1px solid #4a4a7a;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s, background 0.2s, transform 0.1s;
}

.btn-order:hover:not(.disabled) {
    opacity: 1;
    background: #3a3a5a;
    transform: scale(1.1);
}

.btn-order.disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

/* Drag & Drop innerhalb Gruppe */
.grouped-file-item.drag-over-item {
    background: rgba(79, 195, 247, 0.2);
    border: 1px dashed #4fc3f7;
    border-radius: 4px;
}

/* Verschieben Button */
.btn-tiny {
    padding: 2px 8px;
    font-size: 0.75rem;
    background: transparent;
    border: 1px solid #4a4a7a;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, background 0.2s;
}

.btn-tiny:hover {
    opacity: 1;
    background: #3a3a5a;
}

.btn-move {
    margin-left: auto;
}

/* Drag & Drop Zielbereich */
.grouped-files {
    transition: background 0.2s, border 0.2s;
}

.grouped-files.drag-over {
    background: rgba(76, 175, 80, 0.15);
    border: 2px dashed #4caf50;
    border-radius: 8px;
}

/* ===== Move Modal ===== */
.move-modal .modal-actions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #4a4a7a;
    background: #1e1e3a;
}

.move-file-info {
    background: #2a2a4a;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.move-options {
    margin-bottom: 20px;
}

.move-options label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.move-select {
    width: 100%;
    padding: 10px 12px;
    background: #2a2a4a;
    border: 1px solid #4a4a7a;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.95rem;
}

.move-select:focus {
    outline: none;
    border-color: #4fc3f7;
}

.new-group-fields {
    margin-top: 15px;
    padding: 15px;
    background: #1a1a2e;
    border-radius: 8px;
}

.new-group-fields.hidden {
    display: none;
}

.new-group-fields .form-group {
    margin-bottom: 12px;
}

.new-group-fields .form-group:last-child {
    margin-bottom: 0;
}

.new-group-fields label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: #aaa;
}

.new-group-fields input {
    width: 100%;
    padding: 8px 10px;
    background: #2a2a4a;
    border: 1px solid #4a4a7a;
    border-radius: 4px;
    color: #e0e0e0;
}

.move-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: rgba(76, 175, 80, 0.15);
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #81c784;
}

.move-info .info-icon {
    font-size: 1.2rem;
}

/* ===== Gruppen-Bearbeitung ===== */
.btn-edit-group {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s, background 0.2s;
    padding: 4px 8px;
    margin-left: 8px;
}

.btn-edit-group:hover {
    opacity: 1;
    background: rgba(79, 195, 247, 0.2);
    border-color: #4fc3f7;
}

.meta-badge.editable {
    cursor: pointer;
    transition: background 0.2s, border 0.2s;
    border: 1px solid transparent;
}

.meta-badge.editable:hover {
    background: rgba(79, 195, 247, 0.2);
    border-color: #4fc3f7;
}

.edit-group-modal .modal-content {
    max-width: 450px;
}

.edit-group-info {
    background: rgba(79, 195, 247, 0.15);
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #81d4fa;
}

.edit-group-fields {
    margin-bottom: 20px;
}

.edit-group-fields .form-group {
    margin-bottom: 15px;
}

.edit-group-fields .form-group:last-child {
    margin-bottom: 0;
}

.edit-group-fields label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #e0e0e0;
}

.edit-group-fields input {
    width: 100%;
    padding: 10px 12px;
    background: #2a2a4a;
    border: 1px solid #4a4a7a;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.95rem;
}

.edit-group-fields input:focus {
    outline: none;
    border-color: #4fc3f7;
    box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.2);
}

.grouped-actions {
    padding: 15px 20px;
    background: #2a2a4a;
    border-top: 1px solid #4a4a7a;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Button zum Hinzufügen von PDFs zu Gruppen */
.btn-add-pdf {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-add-pdf:hover {
    background: linear-gradient(135deg, #4a7bd5, #3a6bc5) !important;
}

/* ===== Processing Status ===== */
.processing-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: #2a2a4a;
    border-radius: 8px;
    margin-top: 15px;
}

.processing-status.hidden {
    display: none;
}

.processing-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #4a4a7a;
    border-top-color: #4fc3f7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== "PDF für alle Gruppen" Info ===== */
.append-to-all-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #2a3a4a 0%, #1e2a3a 100%);
    border: 1px solid #4fc3f7;
    border-radius: 8px;
    margin-bottom: 15px;
}

.append-to-all-info.hidden {
    display: none;
}

.append-to-all-info .append-icon {
    font-size: 1.3rem;
}

.append-to-all-info .append-filename {
    flex: 1;
    color: #4fc3f7;
    font-weight: 500;
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.append-to-all-info .append-position {
    color: #888;
    font-size: 0.85rem;
    display: none;
}

.append-to-all-info .append-position-select {
    background: #2a2a4a;
    border: 1px solid #4a4a7a;
    border-radius: 6px;
    color: #e0e0e0;
    padding: 6px 10px;
    font-size: 0.85rem;
    cursor: pointer;
}

.append-to-all-info .append-position-select:focus {
    outline: none;
    border-color: #4fc3f7;
}

.btn-append-all {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-append-all:hover {
    background: linear-gradient(135deg, #4a7bd5, #3a6bc5) !important;
}

/* ===== Processing Summary ===== */
.processing-summary {
    margin-top: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #2a4a2a 0%, #1e3a1e 100%);
    border-radius: 10px;
    border-left: 4px solid #4caf50;
    animation: fadeIn 0.3s ease;
}

.processing-summary.hidden {
    display: none;
}

.summary-header {
    font-size: 1.2rem;
    font-weight: 600;
    color: #4caf50;
    margin-bottom: 15px;
}

.summary-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    min-width: 80px;
}

.stat-item.success {
    border-bottom: 3px solid #4caf50;
}

.stat-item.warning {
    border-bottom: 3px solid #ff9800;
}

.stat-item.error {
    border-bottom: 3px solid #f44336;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: bold;
    color: #fff;
}

.stat-label {
    font-size: 0.85rem;
    color: #aaa;
}

.summary-groups {
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #4fc3f7;
    font-size: 1rem;
}

/* ===== Hidden Utility ===== */
.hidden {
    display: none !important;
}

/* ===== Original-Dateien Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay .modal-content {
    background: #1e1e3a;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid #3a3a5a;
    padding: 25px;
}

/* Move Modal - spezifische Anpassungen */
.modal-overlay.move-modal .modal-content {
    max-width: 500px;
}

.modal-content.batch-modal {
    max-width: 700px;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #3a3a5a;
    background: #252545;
}

.modal-header h3 {
    margin: 0;
    color: #4fc3f7;
    font-size: 1.3rem;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #3a3a5a;
    background: #252545;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.success-message {
    color: #81c784;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.warning-box {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.warning-box p {
    margin: 0;
    color: #ffd54f;
}

.warning-box p:first-child {
    margin-bottom: 8px;
}

.original-files-section {
    background: #252545;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.original-files-section>p {
    margin-bottom: 12px;
    color: #b0b0b0;
}

.original-files-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.original-files-list li {
    padding: 8px 12px;
    background: #1a1a2e;
    margin-bottom: 5px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
    color: #e0e0e0;
    word-break: break-all;
}

.original-files-list li:last-child {
    margin-bottom: 0;
}

.original-files-scroll {
    max-height: 200px;
    overflow-y: auto;
    border-radius: 8px;
}

/* Heruntergeladene Dateien Section */
.downloaded-section {
    background: #1a3a2e;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #2a5a4e;
}

.downloaded-section>p {
    margin-bottom: 12px;
    color: #81c784;
}

.downloaded-files-scroll {
    max-height: 150px;
    overflow-y: auto;
    border-radius: 8px;
}

.downloaded-files-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.downloaded-files-list li {
    padding: 8px 12px;
    background: #0d2a1e;
    margin-bottom: 5px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
    color: #a5d6a7;
    word-break: break-all;
    display: flex;
    align-items: center;
    gap: 8px;
}

.downloaded-files-list li:last-child {
    margin-bottom: 0;
}

.downloaded-files-list li.merged-file {
    background: #1a2a3e;
    color: #90caf9;
    border: 1px solid #3a5a7e;
}

.merged-badge {
    font-size: 0.75rem;
    background: #4fc3f7;
    color: #1a1a2e;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
    font-family: 'Segoe UI', sans-serif;
}

.info-text {
    color: #888;
    font-size: 0.95rem;
    margin-top: 15px;
    margin-bottom: 0;
}

/* ===== Responsive Navbar ===== */
@media (max-width: 768px) {
    .main-navbar {
        flex-direction: column;
        padding: 15px;
        gap: 15px;
    }

    .navbar-brand {
        padding: 0;
    }

    .navbar-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .navbar-links .nav-link {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .brand-subtitle {
        display: none;
    }
}

/* ===== Responsive für neue Elemente ===== */
@media (max-width: 768px) {
    .order-controls {
        flex-direction: column;
    }

    .auto-mode-toggle {
        flex-direction: column;
        text-align: center;
    }

    .grouped-header {
        flex-direction: column;
        gap: 15px;
    }

    .grouped-meta {
        justify-content: center;
    }

    .grouped-file-item {
        flex-wrap: wrap;
    }

    .file-original {
        width: 100%;
        order: 3;
    }

    .modal-content {
        max-height: 90vh;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* ===== SmartMatcher Section ===== */
.smartmatcher-section {
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #1a2a4a 0%, #1a3a3a 100%);
    border-radius: 8px;
    border: 1px solid #3a5a7a;
}

.smartmatcher-section h3 {
    margin: 0 0 10px 0;
    color: #64b5f6;
    font-size: 1rem;
}

.smartmatcher-description {
    color: #90a4ae;
    font-size: 0.9rem;
    margin-bottom: 15px;
    line-height: 1.5;
}

.smartmatcher-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.smartmatcher-stats .stat {
    background: #0d1a2a;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #b0bec5;
}

.smartmatcher-stats .stat strong {
    color: #4fc3f7;
    margin-left: 5px;
}

/* ===== Navbar Collapsed State ===== */
body.nav-collapsed .nav-text,
body.nav-collapsed .brand-text {
    display: none;
}

body.nav-collapsed .main-navbar {
    justify-content: flex-start;
}

body.nav-collapsed .navbar-links {
    gap: 5px;
    margin-left: 20px;
}

body.nav-collapsed .navbar-links .nav-link {
    padding: 10px;
    justify-content: center;
    position: relative;
}

/* Tooltip beim Hover im eingeklappten Zustand */
body.nav-collapsed .navbar-links .nav-link:hover::after {
    content: attr(title);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1001;
    margin-top: 8px;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Tooltip-Pfeil */
body.nav-collapsed .navbar-links .nav-link:hover::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.9);
    margin-top: -4px;
    z-index: 1001;
}

body.nav-collapsed .nav-toggle-btn {
    margin-right: 0;
}