/**
 * ============================================================
 *  PDF Allrounder - SEP Interactive (Simon Erich Plath)
 *  Made with ❤️ for Steffi
 *  Copyright © 2025 - All Rights Reserved
 * ============================================================
 */

/* ===== Globale Navigation Bar ===== */
.main-navbar {
    background: var(--surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 0;
}

.brand-icon {
    font-size: 1.8rem;
}

.brand-text {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--primary-color);
    background: rgba(79, 195, 247, 0.15);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    margin-left: 5px;
}

.navbar-links {
    display: flex;
    gap: 5px;
}

.navbar-links .nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.navbar-links .nav-link:hover {
    background: var(--surface-hover);
    color: var(--primary-color);
    border-color: var(--border-light);
}

.navbar-links .nav-link.active {
    background: rgba(79, 195, 247, 0.2);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ===== Header (Legacy Support) ===== */
header {
    text-align: center;
    padding: 30px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.header-nav {
    margin-top: 15px;
}

.nav-link {
    display: inline-block;
    padding: 8px 16px;
    background: var(--surface-hover);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: var(--border);
    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: var(--primary-color);
    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: var(--primary-color);
    color: #000;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
}

/* ===== Sections ===== */
section {
    background: var(--surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-md);
}

section h2 {
    color: var(--text-primary);
    font-size: 1.4rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

/* ===== 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: 500;
    color: var(--text-secondary);
}

.setting-item input[type="file"] {
    padding: 10px;
    background: var(--surface-hover);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
}

.setting-item input[type="file"]:hover {
    border-color: var(--primary-light);
    background: var(--surface);
}

.status {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.status.loaded {
    color: var(--success-color);
}

.count {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.csv-format-hint {
    margin-top: 15px;
    padding: 10px 15px;
    background: var(--surface-hover);
    border-left: 3px solid var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== Upload Section ===== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    padding: 50px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.upload-area:hover {
    border-color: var(--primary-light);
    background: var(--surface-hover);
}

.upload-area.dragover {
    border-color: var(--success-color);
    background: rgba(0, 230, 118, 0.1);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.upload-area p {
    color: var(--text-muted);
    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: var(--primary-color);
}

.results-list {
    max-height: 500px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* ===== Result Item ===== */
.result-item {
    background: var(--surface-hover);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    align-items: center;
    transition: all 0.2s ease;
}

.result-item:hover {
    background: var(--border);
}

.result-item.success {
    border-left: 4px solid var(--success-color);
}

.result-item.warning {
    border-left: 4px solid var(--warning-color);
}

.result-item.error {
    border-left: 4px solid var(--danger-color);
}

.result-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.result-original {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.result-new {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-all;
}

.result-details {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.detail-badge {
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--border);
}

.detail-badge.mieternummer { background: #1e88e5; color: var(--text-primary); }
.detail-badge.mietername { background: #43a047; color: var(--text-primary); }
.detail-badge.dokumententyp { background: #fb8c00; color: var(--text-primary); }
.detail-badge.jahr { background: #8e24aa; color: var(--text-primary); }
.detail-badge.quelle { background: #607d8b; color: var(--text-primary); font-size: 0.75rem; }

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

/* Buttons wurden nach unified-theme.css verschoben */

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* ===== 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 var(--border);
    overflow-y: auto;
}

.modal-preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--background-solid);
    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 var(--border);
    color: var(--text-muted);
    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: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text-primary);
    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: var(--border);
    border-color: var(--primary-color);
}

.modal-preview-section .preview-page-info {
    color: var(--text-muted);
    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: var(--background-solid);
}

.modal-preview-section #editPreviewCanvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    background: var(--text-primary);
}

.modal-preview-section .preview-loading,
.modal-preview-section .preview-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    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: var(--danger-color);
}

.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 var(--border);
    }
    
    .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-primary);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--surface-hover);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filename-preview {
    display: block;
    padding: 12px;
    background: var(--surface-hover);
    border-radius: 8px;
    color: var(--primary-color);
    font-family: monospace;
    word-break: break-all;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

#extractedTextContent {
    background: var(--surface-hover);
    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: var(--text-muted);
    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: var(--text-muted);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-solid);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* ===== 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 var(--border-light);
}

.section-description {
    color: var(--text-muted);
    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: var(--warning-color);
    background: rgba(255, 152, 0, 0.05);
}

.merge-area:hover {
    border-color: var(--warning-color);
    background: rgba(255, 193, 7, 0.1);
}

.merge-files-list {
    margin: 20px 0;
    min-height: 100px;
    background: var(--surface-hover);
    border-radius: 8px;
    padding: 15px;
}

.merge-file-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: var(--border);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: grab;
    transition: all 0.2s ease;
}

.merge-file-item:hover {
    background: var(--border-light);
}

.merge-file-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.merge-file-item.drag-over {
    border: 2px dashed var(--primary-color);
    background: rgba(79, 195, 247, 0.1);
}

.merge-file-number {
    width: 30px;
    height: 30px;
    background: var(--warning-color);
    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: var(--text-muted);
    font-size: 0.85rem;
}

.merge-file-remove {
    background: none;
    border: none;
    color: var(--danger-color);
    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 var(--border-light);
}

.merge-preview {
    color: var(--text-muted);
}

.merge-preview span {
    color: var(--warning-color);
    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 var(--border-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Order Section (Dokumententyp-Reihenfolge) ===== */
.order-section {
    border: 2px solid var(--primary-color);
    background: rgba(79, 195, 247, 0.05);
}

.order-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.order-list {
    background: var(--surface-hover);
    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: var(--border);
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.order-item:hover {
    background: var(--border-light);
    transform: translateX(3px);
}

.order-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
    background: #5a5a8a;
}

.order-item.drag-over {
    border: 2px dashed var(--primary-color);
    background: rgba(79, 195, 247, 0.2);
}

.order-drag-handle {
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: grab;
    padding: 0 5px;
}

.order-drag-handle:hover {
    color: var(--primary-color);
}

.order-number {
    width: 30px;
    height: 30px;
    background: var(--primary-color);
    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: var(--surface-hover);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    padding: 2px 8px;
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.order-arrow-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
}

.order-arrow-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.order-handle {
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: grab;
}

.order-info {
    margin-top: 15px;
    padding: 10px 15px;
    background: var(--surface-hover);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ===== Auto-Mode Toggle ===== */
.auto-mode-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--surface-hover);
    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: var(--border);
    transition: 0.3s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-primary);
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--success-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* ===== Grouped Section ===== */
.grouped-section {
    border: 2px solid var(--success-color);
    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: var(--success-color);
}

.grouped-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.grouped-item {
    background: var(--surface-hover);
    border-radius: 10px;
    overflow: hidden;
    border-left: 4px solid var(--success-color);
}

.grouped-header-info {
    padding: 15px 20px;
    background: var(--border);
}

.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: var(--success-color);
    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: var(--border-light);
    color: var(--text-primary);
}

.grouped-files {
    padding: 15px 20px;
    border-top: 1px solid var(--border-light);
}

.grouped-file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    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: var(--text-muted);
    cursor: grab;
    padding: 0 5px;
    font-size: 1rem;
}

.file-drag-handle:hover {
    color: var(--primary-color);
}

.file-order {
    width: 25px;
    color: var(--success-color);
    font-weight: bold;
}

.file-type-badge {
    padding: 3px 10px;
    background: #fb8c00;
    color: var(--text-primary);
    border-radius: 10px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.file-original {
    flex: 1;
    color: var(--text-muted);
    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 var(--border-light);
    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: var(--border);
    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 var(--primary-color);
    border-radius: 4px;
}

/* Verschieben Button */
.btn-tiny {
    padding: 2px 8px;
    font-size: 0.75rem;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, background 0.2s;
}

.btn-tiny:hover {
    opacity: 1;
    background: var(--border);
}

.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 var(--success-color);
    border-radius: 8px;
}

/* ===== Move Modal ===== */
.move-modal .modal-actions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
    background: #1e1e3a;
}

.move-file-info {
    background: var(--surface-hover);
    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: var(--surface-hover);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.move-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.new-group-fields {
    margin-top: 15px;
    padding: 15px;
    background: var(--background-solid);
    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: var(--text-secondary);
}

.new-group-fields input {
    width: 100%;
    padding: 8px 10px;
    background: var(--surface-hover);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    color: var(--text-primary);
}

.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: var(--primary-color);
}

.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: var(--primary-color);
}

.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: var(--text-primary);
}

.edit-group-fields input {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-hover);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.edit-group-fields input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.2);
}

.grouped-actions {
    padding: 15px 20px;
    background: var(--surface-hover);
    border-top: 1px solid var(--border-light);
    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: var(--surface-hover);
    border-radius: 8px;
    margin-top: 15px;
}

.processing-status.hidden {
    display: none;
}

.processing-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary-color);
    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 var(--primary-color);
    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: var(--primary-color);
    font-weight: 500;
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.append-to-all-info .append-position {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: none;
}

.append-to-all-info .append-position-select {
    background: var(--surface-hover);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 0.85rem;
    cursor: pointer;
}

.append-to-all-info .append-position-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.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 var(--success-color);
    animation: fadeIn 0.3s ease;
}

.processing-summary.hidden {
    display: none;
}

.summary-header {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--success-color);
    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 var(--success-color);
}

.stat-item.warning {
    border-bottom: 3px solid var(--warning-color);
}

.stat-item.error {
    border-bottom: 3px solid var(--danger-color);
}

.stat-number {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.summary-groups {
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
    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 var(--border);
    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 var(--border);
    background: #252545;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--border);
    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 var(--warning-color);
    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: var(--background-solid);
    margin-bottom: 5px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    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: var(--primary-color);
    color: var(--background-solid);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
    font-family: 'Segoe UI', sans-serif;
}

.info-text {
    color: var(--text-muted);
    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: var(--primary-color);
    margin-left: 5px;
}
