/* ==========================================================================
   1. Globale Stile & Typografie
   ========================================================================== */

html {
    scrollbar-gutter: stable;
}

body {
    padding-top: 70px;
    font-family: -apple-system, BlinkMacMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
}

a {
    color: var(--accent-color, #0d6efd);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    font-weight: 600;
    color: #222;
}

.text-muted {
    color: #6c757d !important;
}

/* ==========================================================================
   2. Seiten-Layout & Navigation
   ========================================================================== */

.app-branding {
    display: flex;
    align-items: center;
    margin-right: 30px;
    gap: 6px;
}

.company-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 1.1em;
    font-weight: 600;
    color: #2d3748;
}

.company-logo-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    /*background-color: var(--accent-color, #0d6efd);*/
    color: white;
    font-weight: bold;
}

.app-name-secondary {
    font-size: 1.1em;
    color: #a0aec0;
    font-weight: 500;
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Konsolidiert: .navbar-content und .navbar .container
   Beide hatten überlappende Breiten- und Padding-Einstellungen.
   Die spezifischeren padding-Werte aus .navbar-content werden beibehalten. */
.navbar-content,
.navbar .container { /* .navbar .container ist jetzt spezifisch genug für padding */
    max-width: none;
    margin: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 8px; /* Werte aus .navbar-content */
}


.user-info {
    margin-right: 10px;
}

.navbar .logo {
    font-weight: bold;
    font-size: 1.5em;
    margin-left: 10px;
}

.navbar a {
    text-decoration: none;
    color: #333;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px; /* Abstand zwischen den Icons */
    margin-right: 15px;
}

.icon-button {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4b5563; /* Etwas dunkleres Grau für bessere Sichtbarkeit */
    transition: background-color 0.2s;
}

.icon-button:hover {
    background-color: #f3f4f6; /* Leichter Hover-Effekt */
}

.icon-button svg {
    width: 20px;
    height: 20px;
}

/* Badge für neue Benachrichtigungen in der Navbar */
.navbar-notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background-color: #dc3545; /* Rot für Aufmerksamkeit */
    color: white;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid white; /* Hebt das Badge vom Icon ab */
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Header-Stil für Dropdowns */
.dropdown-header {
    padding: 10px 15px;
    font-size: 0.9em;
    color: #6c757d;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 5px;
}

main.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 30px;
    border-bottom: 1px solid #dee2e6;
}

/* Konsolidiert: .content-box und .content-panel
   Beide hatten identische Basis-Stile für Hintergrund, Rand, Radius und Schatten.
   Der margin-top von .content-box wird beibehalten. */
.content-box,
.content-panel {
    margin-top: 20px; /* Beibehalten von .content-box */
    margin-bottom: 30px; /* Nur für content-box relevant, aber schadet nicht */
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    /* overflow: hidden; WIRD NICHT MEHR BENÖTIGT UND HAT PROBLEME VERURSACHT - entfernt */
}

.content-box .card-header {
    padding: 10px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-box .card-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.content-box .card-header.danger {
    background-color: #f8d7da;
    border-bottom-color: #f5c2c7;
}

.content-box .card-header.danger h3 {
    color: #842029;
}

.content-box .card-body {
    padding: 20px;
}

.content-box .card-body.compact-top {
    padding-top: 5px;
}

.actions-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.breadcrumb-container {
    margin-bottom: 20px;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.9em;
}
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
    list-style: none;
}
.breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    display: inline-block;
    padding: 0 .5rem;
    color: #6c757d;
}
.breadcrumb-item a {
    color: var(--accent-color, #0d6efd);
}
.breadcrumb-item.active {
    color: #6c757d;
}

.admin-actions {
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.section-header h4 {
    margin: 0;
    font-size: 1.1em;
    color: #333;
}

.item-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.item-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.item-list li:first-child {
    padding-top: 0;
}

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

.item-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rejection-notice {
    background-color: #fff3cd;
    color: #664d03;
    border-left: 3px solid #ffc107;
    padding: 8px 12px;
    font-size: 0.9em;
    border-radius: 4px;
}

.info-banner {
    background-color: var(--accent-color-light);
    color: var(--dark-text-color);
    padding: 1rem;
    border: 1px solid color-mix(in srgb, var(--accent-color-light), black 10%);
    border-radius: 5px;
    margin-bottom: 1rem;
}

/* ==========================================================================
   3. Grid & Card System
   ========================================================================== */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.card {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none;
    color: inherit;
    aspect-ratio: 1 / 1;
}

.project-config-btn {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background-color: transparent;
    padding: 0;
    z-index: 1;
}

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

}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

a.card,
a.card:hover {
    text-decoration: none !important;
}

.card h3 {
    min-height: 2.8em;
    margin-bottom: 10px;
    font-size: 1em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
}

.card-description {
    min-height: 60px;
    color: #555;
    font-size: 0.9em;
    flex-grow: 1;
}

.card-meta {
    font-size: 0.85em;
    color: #666;
    border-top: 1px solid #eee;
    padding-top: 15px;
    margin-top: 15px;
}

.card-meta-project {
    font-size: 0.85em;
    color: #666;
    border-top: 1px solid #eee;
    padding-top: 15px;
    margin-top: 15px;
    margin-left: auto;
}

/* Spezial-Karten */
.card-add-new {
    background-color: var(--accent-color-light);
    border-style: solid;
    border-color: color-mix(in srgb, var(--accent-color-light), black 10%);
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--accent-color, #0d6efd);
}

.card-add-new:hover {
    background-color: var(--accent-color-light);
    border-color: color-mix(in srgb, var(--accent-color-light), black 10%);
}

.empty-state-card {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    background-color: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

.card-all-done {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background-color: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}

.card-all-done svg {
    margin-bottom: 15px;
    color: #22c55e;
}

.notification-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #fd7e14;
    color: white;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9em;
}


/* ==========================================================================
   4. Tabellen
   ========================================================================== */

.table-responsive {
    max-height: calc(100vh - 200px); /* Passt die Höhe an */
    overflow-y: auto;
    overflow-x: auto; /* Ermöglicht horizontales Scrollen, wenn nötig */
    -webkit-overflow-scrolling: touch; /* Sorgt für flüssiges Scrollen auf Mobilgeräten */
}

/* scrollable-table: Jetzt in .table-container integriert für Filter Review */
.scrollable-table {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 60vh;
  scrollbar-gutter: stable;
}

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

table thead th:first-child {
    border-top-left-radius: 8px;
}

table thead th:last-child {
    border-top-right-radius: 8px;
}

table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

thead th {
    background-color: #f9f9f9;
    font-weight: 600;
    color: #555;
    position: relative;
}

tbody tr:hover {
    background-color: #f5f5f5;
}

.inactive-row {
    background-color: #f8f9fa;
    color: #6c757d;
}

.inactive-row td,
.inactive-row td small {
    color: #6c757d !important;
}

tr.fading-out {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.3s ease-in-out;
}

.file-list-table th,
.file-list-table td {
    padding-top: 10px;
    padding-bottom: 10px;
}

.file-list-table th:nth-child(1) { width: 55%; } /* Anzeigename */
.file-list-table th:nth-child(2) { width: 20%; } /* Hochgeladen am */
.file-list-table th:nth-child(3) { width: 15%; } /* Status */
.file-list-table th:nth-child(4) { width: 10%; } /* Aktionen */


/* ==========================================================================
   5. Komponenten (Buttons, Badges, Forms, etc.)
   ========================================================================== */

.form-actions {
    display: flex;
    justify-content: flex-start; /* Richtet Buttons links aus */
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

   .button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-family: inherit;
    font-size: 0.9em;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.button-link:hover {
    text-decoration: none;
    opacity: 0.9;
}

.button-link.primary {
    background-color: var(--accent-color, #0d6efd);
    color: white;
    border-color: var(--accent-color, #0d6efd);
}

/*.button-link.primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}*/

.button-link.secondary {
    background-color: #6c757d;
    color: white;
    border-color: #6c757d;
}

/*.button-link.secondary:hover {
    background-color: #5c636a;
    border-color: #565e64;
}*/

.button-link.danger {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.button-link.danger:hover {
    background-color: #bb2d3b;
    border-color: #b02a37;
}

.button-link.success {
    background-color: #198754;
    color: white;
    border-color: #198754;
}

.button-link.success:hover {
    background-color: #157347;
    border-color: #146c43;
}

.button-link.small {
    padding: 5px 10px;
    font-size: 0.85em;
}

/* Status Badges - Konsolidiert: Duplikate entfernt */
.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: bold;
    text-transform: uppercase;
    display: inline-block;
}

.status-badge.active,
.status-badge.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.warning {
    background-color: #fff3cd;
    color: #664d03;
}

.status-badge.inactive,
.status-badge.status-archived {
    background-color: #e2e3e5;
    color: #495057;
}

.status-badge.status-company_asset {
    background-color: var(--accent-color-light);
    color: var(--dark-text-color);
}

/* Dropdown für Aktionen */
.action-dropdown {
    position: relative;
    display: inline-block;
}

.action-dropdown .dropdown-menu {
    display: none;
    position: absolute;
    /* ... andere Stile wie background, box-shadow etc. sind schon vorhanden ... */
}

/* Zeigt das Menü an, wenn der Toggle-Button den Fokus hat oder ein Element darin */
.action-dropdown:focus-within .dropdown-menu {
    display: block;
}

/* Stellt sicher, dass der Button selbst keinen unschönen blauen Rahmen bekommt */
.action-dropdown .dropdown-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25); /* Optional: Ein dezenter Fokus-Ring */
}

.dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    line-height: 1;
    color: #6c757d;

    display: flex;          /* Stellt Flexbox-Verhalten sicher */
    align-items: center;    /* Zentriert das Icon vertikal */
    justify-content: center;/* Zentriert das Icon horizontal */
    width: 36px;            /* Feste Breite für einen perfekten Kreis */
    height: 36px;           /* Feste Höhe für einen perfekten Kreis */

}

.dropdown-toggle:hover {
    background-color: #e9ecef;
    color: #212529;
}

.dropdown-menu {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 180px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 5px 0;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu.drop-down-right {
    right: 0;
    top: 100%;
    margin-top: 5px;
}

.dropdown-menu.drop-adjacent-left {
    top: 0;
    right: 100%;
    margin-right: 5px;
}

.dropdown-menu.drop-up-left {
    left: 0;
    bottom: 100%;
    margin-bottom: 5px;
}

.card .dropdown-menu {
    right: 10px;  /* Leichter Abstand vom rechten Rand der Kachel */
    bottom: 100%; /* Positioniert das Menü über dem Kebab-Button */
    margin-bottom: 5px;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 15px;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    color: #333;
    font-size: 0.9em;
    text-decoration: none;
    box-sizing: border-box;
    font-family: inherit;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
    text-decoration: none;
}

.dropdown-item.danger {
    color: #dc3545;
}

.dropdown-item.success {
    color: #198754;
}

.dropdown-divider {
    height: 1px;
    margin: 5px 0;
    overflow: hidden;
    background-color: #e9ecef;
}

/* Formulare */
.filter-form,
.search-form {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    align-items: center;
}

.filter-form .form-control,
.search-form .form-control {
    min-width: 300px;
}

.button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    color: var(--dark-text-color);
    transition: all 0.2s ease-in-out;
}

.button-icon:hover {
    background-color: #e2e6ea;
    border-color: #adb5bd;
    color: #212529;
    text-decoration: none;
}

.form-group {
    margin-bottom: 1rem; /* Abstand zwischen den Formularfeldern */
}

.form-group label {
    display: block;
    margin-bottom: .5rem;
    font-weight: 500;
}

.form-group .form-control,
.form-group .form-select {
    width: 100%;
    box-sizing: border-box; /* Wichtig für konsistente Breite */
}

input[type="checkbox"] {
    accent-color: color-mix(in srgb, var(--accent-color), white 10%);
}

/* ==========================================================================
   6. Toast-Benachrichtigungen
   ========================================================================== */

#toast-container {
    position: fixed;
    top: 85px;
    right: 20px;
    z-index: 9999;
    width: 350px;
    pointer-events: none;
}

.toast {
    background-color: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-bottom: 15px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.215, 0.610, 0.355, 1.000); /* Weiche Animation */
    border-left: 5px solid #6c757d; /* Standard-Farbe */
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* Farbvarianten basierend auf Django Message Tags */
.toast.success {
    background-color: #f0fdf4;
    color: #15803d;
    border-color: #22c55e;
}

.toast.error {
    background-color: #fef2f2;
    color: #b91c1c;
    border-color: #ef4444;
}

.toast.warning {
    background-color: #fefce8;
    color: #a16207;
    border-color: #facc15;
}

.toast.info {
    background-color: #eff6ff;
    color: var(--accent-color, #0d6efd);
    border-color: color-mix(in srgb, var(--accent-color), white 10%);
}

/* Konsolidiert: .toggle-switch input und .toggle-switch .slider
   Die Stile für den Slider selbst wurden beibehalten, da sie spezifisch sind.
   Die doppelten .toggle-switch Definitionen wurden konsolidiert. */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px; /* Beibehalten von 26px */
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider { /* Umbenannt von .toggle-slider, da hier nur eine Definition existieren sollte */
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 26px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px; /* Beibehalten von 4px */
    bottom: 4px; /* Beibehalten von 4px */
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: var(--accent-color, #0d6efd);
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(24px); /* Verschiebt den Kreis nach rechts */
}


/* ==========================================================================
   7. Spezifische Stile für den Regel-Set-Editor
   ========================================================================== */

.general-info-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem 2rem;
    align-items: start;
}

.general-info-layout .form-group {
    display: contents; /* Damit Label und Input als separate Grid-Items behandelt werden */
    margin-bottom: 0;
}

.general-info-layout .field-label {
    text-align: left;
    margin-bottom: 0;
    
    font-weight: 500;
    font-size: 1rem;
    white-space: nowrap;
}

.general-info-layout .field-input {
    width: 100%;
}

.general-info-layout .field-input input[type="text"] {
    height: 1.5rem; /* Standardhöhe für Name-Feld */
}

.general-info-layout .field-input textarea {
    height: 4rem; /* Höhere Höhe für Beschreibungsfeld */
    resize: vertical; /* Erlaubt vertikale Größenänderung */
}

.general-info-layout .field-input .form-control {
    width: 100%;
}

.general-info-layout .error-message {
    grid-column: 2; /* Fehlermeldungen in der Input-Spalte */
    margin-top: 0.25rem;
}


.form-error-list {
    list-style-type: none;
    padding: 0;
    margin: 5px 0 0 0;
    color: #dc3545;
    font-size: 0.875em;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.non-field-errors {
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
    padding: 1rem;
    border-radius: .25rem;
    margin-bottom: 1rem;
}

.field-error {
    background-color: #fff5f5;
    border: 1px solid #dc3545 !important;
}

.error-message {
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 2px;
    display: block;
}

.rule-row.has-errors {
    background-color: #fff5f5;
    border-left: 3px solid #dc3545;
}

.rule-grid-form {
    margin-top: 20px;
}

.rule-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    position: relative;
}

/* Konsolidiert: rule-table th Definitionen */
.rule-table th {
    background-color: #f2f2f2;
    padding: 4px 5px; /* Kompakteres Padding von der zweiten Definition */
    text-align: center; /* Zentriert von der zweiten Definition */
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid #ddd; /* Von der zweiten Definition */
}

.rule-table td {
    padding: 8px;
    border-bottom: 1px solid #ddd;
    vertical-align: middle;
}

.rule-row {
    background-color: #fff;
}

.rule-row.sortable-ghost {
    opacity: 0.4;
}

.drag-handle {
    cursor: grab;
    padding: 0 10px;
    color: #aaa;
    user-select: none;
    font-size: 1.5em;
    line-height: 1;
}

th.output-header {
    min-width: 120px;
    text-align: center;
    padding-top: 12px;
}

.output-header-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* header-inner-wrapper und output-header-inner bereits konsolidiert in header-inner-wrapper */
}

.remove-col-btn {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffeaea;
    color: #dc3545;
    border-radius: 50%;
    border: 1px solid #dc3545;
    z-index: 20;
    display: none;
    font-size: 0.8em;
    padding: 0 5px;
    box-shadow: 0 2px 8px #0001;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    opacity: 0;
}

th.output-header:hover .remove-col-btn {
    display: block;
    opacity: 1;
}

.output-header-inner input {
    margin-top: -4px;
    width: 90%;
    text-align: center;
}

.plus-overlay {
    pointer-events: none;
    position: absolute;
    top: 6px;
    width: 16px;
    height: 16px;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.15s;
}

.plus-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.plus-overlay .add-col-btn {
    pointer-events: auto;
    position: absolute;
    left: 0;
    top: -4px;
    background: #eaffea;
    color: #38a169;
    border: 1px solid #38a169;
    border-radius: 50%;
    font-size: 0.8em;
    padding: 0 5px;
    box-shadow: 0 2px 8px #0001;
    cursor: pointer;
    opacity: 0.9;
}

.success-message {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 1rem;
    border-radius: .25rem;
    margin-bottom: 1rem;
    display: none;
}

.success-message.show {
    display: block;
    animation: fadeInOut 4s ease-in-out;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.empty-outputs-notice {
    text-align: center;
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 5px;
    margin: 10px 0;
}

.add-first-column-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.is-readonly .drag-handle,
.is-readonly .remove-col-btn,
.is-readonly th.output-header:hover .remove-col-btn {
    display: none !important;
}

.is-readonly input[type="text"],
.is-readonly textarea,
.is-readonly .form-select {
    background-color: transparent !important;
    border: none !important;
    pointer-events: none;
    box-shadow: none !important;
    padding-left: 0 !important;
    color: #212529;
}

.is-readonly .form-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.is-readonly input[type="checkbox"] {
    pointer-events: none;
}

/* Breiten für die Spalten (bleibt erhalten) */
.rule-table th:nth-child(1) {
    width: 5%;
} /* Drag */
.rule-table th:nth-child(2) {
    width: 5%;
} /* Prio */
.rule-table th:nth-child(3) {
    width: 30%;
} /* Suchbegriff */
.rule-table th:nth-child(4) {
    width: 15%;
} /* Typ */
.rule-table th:nth-child(5) {
    width: 10%;
} /* Groß/Klein */
.rule-table th:last-child {
    width: 5%;
} /* Löschen */

.rule-table-container {
    min-height: 250px; /* Sorgt für eine Mindesthöhe, auch bei wenigen Regeln */
}

#column-insert-indicator {
    position: absolute;
    top: 0;
    height: 100%;
    width: 2px;
    background-color: #28a745;
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
    box-shadow: 0 0 4px rgba(40, 167, 69, 0.5);
}

#column-insert-indicator.visible {
    opacity: 1;
}

#column-delete-indicator {
    position: absolute;
    top: 0;
    height: 100%;
    background-color: rgba(220, 53, 69, 0.1);
    border: 2px solid #dc3545;
    border-radius: 4px;
    z-index: 15;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
    box-shadow: 0 0 8px rgba(220, 53, 69, 0.3);
}

#column-delete-indicator.visible {
    opacity: 1;
}

/* ==========================================================================
   8. Spezifische Stile für die Test-Umgebung
   ========================================================================== */

#test-environment {
    padding-bottom: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid #dee2e6;
}

/* Der Grid-Container für die Ein- und Ausgabe */
.test-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

/* Labels über den Feldern positionieren */
#test-environment label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Sorgen dafür, dass Textarea und Ergebnis-Box die volle Höhe ihrer Zelle einnehmen */
#test-data-input,
#test-results-output {
    width: 100%;
    box-sizing: border-box;
}

/* Spezielles Styling für die Ergebnis-Box */
#test-results-output {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    font-family: monospace;
    white-space: pre-wrap;
}

/* ==========================================================================
   9. Spezifische Stile für die Projekt-Konfiguration
   ========================================================================== */

.danger-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f5c2c7;
}

.danger-action:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.user-assignment-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 1;
}

.user-assignment-list li {
    margin-bottom: 5px;
}

/* ==========================================================================
   10. Spezifische Stile für den Upload-Workflow
   ========================================================================== */

.upload-layout-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: start;
    /* Der Abstand wird bereits durch die Breadcrumbs (margin-bottom: 20px) erzeugt.
       Deshalb setzen wir den oberen Abstand der Grid-Items hier zurück. */
}

.upload-layout-grid .content-box {
    margin-top: 0;
}

#drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

#drop-zone.dragover {
    background-color: #e9f5ff;
    border-color: var(--accent-color, #0d6efd);
}

#file-list-wrapper {
    margin-top: 20px;
    display: none;
}

#file-list {
    list-style-type: none;
    padding: 0;
}

#file-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
}

#file-list li:last-child {
    border-bottom: none;
}

.remove-file-btn {
    cursor: pointer;
    color: #dc3545;
    font-weight: bold;
    font-size: 1.2em;
    padding: 0 5px;
}

.preset-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

.preset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.preset-item:has(input:checked) {
    background-color: #e9f5ff;
    border-color: var(--accent-color, #0d6efd);
}

.preset-item input[type="radio"] {
    margin-right: 10px;
}

/* Modal für Preset-Vorschau */
#preset-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: none;
}

#preset-modal-backdrop {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

#preset-modal-content {
    position: relative;
    background: white;
    width: 90%;
    max-width: 600px;
    margin: 10vh auto;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

#preset-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
}

#preset-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

#preset-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

#preset-modal-body {
    padding: 20px;
}

/* ==========================================================================
   11. Spezifische Stile für die Parsing-Konfiguration
   ========================================================================== */

.parsing-options-row {
    display: grid;
    /* Spalten für: Encoding, Trennzeichen, Custom-Feld, Header-Index, Refresh-Button */
    grid-template-columns: 25% 25% 10% 25% auto;
    gap: 15px;
    align-items: center; /* Richtet Elemente an ihrer Unterkante aus, was für Formulare oft besser aussieht */
}

/* Verhindert doppelten Abstand innerhalb des Grids */
.parsing-options-row .form-group {
    margin-bottom: 0;
}

/* Stellt sicher, dass das Feld für das benutzerdefinierte Trennzeichen eine feste Breite hat */
.parsing-options-row input[name="custom_delimiter"] {
    width: 100%;
    box-sizing: border-box;
}

/* ==========================================================================
   12. Spezifische Stile für das Spalten-Mapping
   ========================================================================== */

.mapping-layout-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    align-items: start;
}

/* Verhindert den doppelten Abstand zwischen Breadcrumbs und den Content-Boxen */
.mapping-layout-grid .content-box {
    margin-top: 0;
}

.preset-name {
    font-weight: 500;
}

.view-preset-details {
    color: #6c757d;
}

/* Stile für die Zuordnungs-Tabelle */
.target-inputs-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.target-inputs-wrapper select {
    flex-grow: 1; /* Sorgt dafür, dass das Select den verfügbaren Platz einnimmt */
}

/* Klasse zum ausblenden der benutzerdefinierten Felder */
.is-hidden {
    visibility: hidden !important;
    opacity: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    border: none !important;
    margin: 0 !important;
    transition: all 0.2s;
}

/* ==========================================================================
   13. Spezifische Stile für die Ergebnisseite
   ========================================================================== */

/* Statistik-Karten (Leicht & Elegant) */
.stats-grid {
    display: grid;
    /* Passt die Anzahl der Spalten an die verfügbare Breite an */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    /* Der Abstand wird jetzt durch die Ränder der Karten selbst definiert */
    gap: 0;
    padding-bottom: 10px;
}

.stat-card {
    padding: 10px 15px;
    text-align: center;
    /* Fügt eine feine Trennlinie rechts von jeder Karte hinzu */
    border-right: 1px solid #eef0f2;
    background: none;
    border-left: none;
    box-shadow: none;
    transition: none; /* Kein Hover-Effekt mehr nötig */
}

.stat-card:hover {
    transform: none; /* Kein Hover-Effekt mehr nötig */
    box-shadow: none;
}

/* Die letzte Karte bekommt keine Trennlinie rechts */
.stat-card:last-child {
    border-right: none;
}

.stat-value {
    font-size: 1.8em;
    font-weight: 400;
    line-height: 1.2;
    color: var(--accent-color, #0d6efd);
}

.stat-label {
    font-size: 0.8em;
    color: #666;
    letter-spacing: 0.5px;
    margin-top: 8px;
}

thead th a {
    color: #555;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

thead th a:hover {
    text-decoration: underline;
}

.sort-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    margin-right: 0.4em; /* Kleiner Abstand zum Text */
    color: #777; /* Sehr dezentes Hellgrau für nicht-sortierte Spalten */
    flex-shrink: 0; /* Verhindert, dass das Icon in engen Spalten schrumpft */
}

/* Wenn eine Spalte aktiv sortiert ist, wird das Icon dunkler */
.sort-icon.sort-active {
    color: #555; /* Dunkleres, sattes Grau für den Fokus */
}

/* Filter- und Sortier-Elemente in Tabellen-Headern */
/* header-content in filterable-header übernommen */

/* filter-icon, filter-panel, filter-panel-right sind jetzt im "MODERNE REVIEW FILTER STYLES" Abschnitt */

/* Paginierung */
.pagination {
    margin-top: 20px;
    text-align: center;
    padding: 5px;
}

/* ==========================================================================
   14. Import-Assistent Stepper (Dezente Variante)
   ========================================================================== */
.wizard-stepper-subtle {
    width: 60%;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
    border-bottom: none;
}

.wizard-stepper-subtle ul {
    display: flex;
    justify-content: space-between;
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}

/* Die graue Hintergrundlinie */
.wizard-stepper-subtle ul::before {
    content: '';
    position: absolute;
    top: 8px; /* Positioniert die Linie mittig zum Punkt */
    left: 0;
    right: 0;
    height: 2px;
    background-color: #e2e8f0;
    z-index: 1;
}

.wizard-stepper-subtle li {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 2;
    position: relative;
    color: #9ca3af; /* Farbe für inaktive Schritte */
}

/* Der Punkt für jeden Schritt */
.wizard-stepper-subtle li::before {
    content: '';
    width: 14px;
    height: 14px;
    background-color: white;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.wizard-stepper-subtle li strong {
    font-weight: 400;
}

/* Styling für den aktiven Schritt */
.wizard-stepper-subtle li.active {
    color: #222; /* Blaue Akzentfarbe */
}

.wizard-stepper-subtle li.active::before {
    border-color: var(--accent-color, #0d6efd);
    background-color: var(--accent-color, #0d6efd);
}

/* Styling für abgeschlossene Schritte (können wir später nutzen) */
.wizard-stepper-subtle li.completed::before {
    border-color: var(--accent-color, #0d6efd);
    background-color: white;
}

/* ==========================================================================
   15. Import-Assistent Konfigurations-Seite
   ========================================================================== */

.configure-layout {
    display: grid;
    grid-template-columns: 1fr 2fr; /* Verhältnis 1:2 zwischen Konfig und Vorschau */
    gap: 30px;
    align-items: start;
}

.config-panel .form-group {
    margin-bottom: 1.5rem;
}

.config-subheader {
    font-size: 1.1em;
    color: #4a5568;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eef0f2;
}

.parsing-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 15px;
    align-items: end;
}

/* Alle Formularfelder im kompakten Grid kleiner machen */
.parsing-grid-compact .form-select,
.parsing-grid-compact .form-control {
    padding: 0.375rem 0.75rem;
    font-size: 0.9em;
    height: auto;
}

/* Stellt sicher, dass alle Labels im Grid die gleiche Schriftgröße haben */
.parsing-grid-compact label {
    font-size: 0.9em;
    margin-bottom: 0.3rem;
}

.preview-panel .table {
    font-size: 0.85em; /* Kleinere Schrift für mehr Übersicht */
}

.preview-panel .table td,
.preview-panel .table th {
    padding: 8px;
    white-space: nowrap; /* Verhindert Zeilenumbrüche in Zellen */
    overflow: hidden;
    text-overflow: ellipsis; /* Fügt "..." hinzu, wenn der Text zu lang ist */
    max-width: 200px;
}

#preview-table-container {
    overflow-y: auto; /* Fügt eine vertikale Scroll-Leiste hinzu, wenn nötig */
}

/* Responsive Anpassung für kleinere Bildschirme */
@media (max-width: 768px) {
    .configure-layout {
        grid-template-columns: 1fr; /* Untereinander anordnen */
    }
    .general-info-layout {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .general-info-layout .field-label {
        padding-top: 0;
        margin-bottom: 0.25rem;
    }
    .general-info-layout .error-message {
        grid-column: 1;
    }
    .filterable-header[data-column-name="Tagging-Ergebnisse"] {
        min-width: 150px !important;
    }
    
    .filter-panel {
        max-width: 280px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
    }
}


.table-divider-row td {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    font-size: 0.9em;
    padding: 15px 0;
    background-color: #f8f9fa;
}

.omitted-row {
    font-style: italic;
    color: #666;
    text-align: center;
}

/* ==========================================================================
   16. Import-Assistent Mapping-Seite
   ========================================================================== */

/* .mapping-layout ist jetzt .mapping-workbench-layout - die alte Definition wird entfernt */

.target-structure-panel {
    position: -webkit-sticky; /* für Safari */
    position: sticky;
    top: 20px; /* Hält die Box beim Scrollen 20px vom oberen Rand entfernt */
    align-self: start;
}

.source-filmstrip-panel {
    overflow: hidden; /* Verhindert, dass Elemente unkontrolliert überlappen */
}

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

.filmstrip-viewport {
    overflow-x: auto; /* ERMÖGLICHT horizontales Scrollen */
    overflow-y: hidden;
    /* Die folgenden Regeln verstecken den sichtbaren Scrollbalken für alle gängigen Browser */
    scrollbar-width: none;  /* Firefox */
    -ms-overflow-style: none;  /* IE und Edge */
}

.filmstrip-viewport::-webkit-scrollbar {
    display: none;  /* Chrome, Safari, Opera */
}

#filmstrip-scroller {
    display: flex;
    flex-wrap: nowrap; /* Stellt sicher, dass die Elemente nicht umbrechen */
    gap: 15px;
    padding-bottom: 15px;
    /* Die Bewegung wird später per JS gesteuert */
}

.file-column-group {
    flex: 0 0 250px;
    border: none; /* Entfernt den Rahmen */
    background-color: transparent; /* Entfernt den Hintergrund */
    text-align: center; /* Zentriert den Inhalt */
}

.file-header-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px;
    background-color: transparent; /* Entfernt Header-Hintergrund */
    border-bottom: none; /* Entfernt Header-Linie */
    font-weight: normal;
}

.file-header-tile svg {
    width: 24px;
    height: 24px;
    color: #6c757d; /* dezentes Grau für das Icon */
}

.file-header-tile .file-name-text {
    font-size: 0.8em;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Container für die Quell-Pillen */
#source-pills-container { /* Die ID bleibt, die Definition wurde nach 17 verschoben */
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
}

/* Anpassung der Quell-Pillen für Auto-Breite */
.source-pills-container .mapping-pill {
    display: inline-block; /* Lässt die Pille nur so breit sein wie ihr Inhalt */
    width: auto; /* Stellt sicher, dass die Breite nicht überschrieben wird */
    margin: 4px;
}

.mapping-pill.status-gruen { /* Dupliziert in 17, aber hier beibehalten für spezifische Verwendung */
    background-color: #f0fdf4; /* helles Grün */
    border-color: #86efac;
    color: #166534;
}

.mapping-pill.status-gelb { /* Dupliziert in 17, aber hier beibehalten für spezifische Verwendung */
    background-color: #fefce8; /* helles, warmes Gelb */
    border-color: #facc15;
    color: #a16207;
}

.mapping-pill.status-grau {
    background-color: #f1f5f9; /* Sehr helles, neutrales Grau */
    border-color: #cbd5e1;
    color: #475569;
}

/* Wir können die existierende mapping-list-Klasse wiederverwenden */
.mapping-list {
    list-style-type: none;
    padding: 10px;
    margin: 0;
    min-height: 200px;
}

.mapping-pill { /* Dupliziert in 17, aber hier beibehalten für spezifische Verwendung */
    display: inline-block;
    padding: 6px 12px;
    margin: 4px;
    border-radius: 18px;
    border: 1px solid transparent;
    cursor: grab;
    user-select: none;
}

.mapping-pill.drop-target-highlight {
    background-color: #e0f7ff;
    border: 2px dashed var(--accent-color, #0d6efd);
    transform: scale(1.05);
}

.mapped-sources-list {
    list-style-type: none;
    padding: 0.75rem;
    margin: 0;
    min-height: 40px; /* Bietet eine Drop-Zone auch wenn leer */
}

.target-column-pills .mapping-pill {
    position: relative;
    padding-right: 28px; /* Etwas mehr Platz für den Button */
}

.edit-target,
.unmap-source {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8em;
    margin-left: 0.5em;
    color: #007bff;
}

/* -----------------------------------------------------------
   Top-Level Ziel-Pillen als Flexbox, Icon immer mittig ausrichten
   ----------------------------------------------------------- */
#target-structure-list > li {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.75rem;
    list-style-type: none; /* Stellt sicher, dass keine Aufzählungspunkte erscheinen */
}

#target-structure-list > li.drop-target-highlight {
    outline: 2px dashed var(--accent-color, #0d6efd);
    outline-offset: 2px;
    background-color: #e9f5ff;
}

.target-header { /* Das ist jetzt das <summary> Element */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    cursor: pointer;
    list-style: none; /* Entfernt den Standard-Pfeil */
}

.target-header::-webkit-details-marker {
    display: none; /* Entfernt den Standard-Pfeil in Webkit-Browsern */
}

.target-name {
    font-weight: 500;
}

/* Knopf für "Bearbeiten" bleibt ein einfacher Button */
.edit-target {
    color: #6c757d;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    opacity: 0.4; /* Standardmäßig dezent */
    transition: opacity 0.2s ease-in-out;
}

.edit-target:hover {
    background-color: #e2e6ea;
}

.target-header:hover .edit-target {
    opacity: 1;
}

.edit-target svg {
    width: 16px;
    height: 16px;
    display: block; /* Verhindert unerwünschte Abstände */
}

/* Die Liste der zugeordneten Quell-Pillen */
.mapped-sources-list {
    list-style-type: none;
    padding-left: 20px; /* Einrückung für die Hierarchie */
    margin-top: 8px;
    border-top: 1px solid #e9ecef;
    padding-top: 8px;
}


/* Das 'x' zum Entfernen der Zuordnung (jetzt korrekt positioniert) */
.unmap-source {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #dc3545;
    line-height: 1;
    padding: 2px;
    border-radius: 3px;
}

.unmap-source:hover {
    background-color: #f8d7da;
}

.unmap-source svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* roter Rahmen bei ungültigem Drop */
.drop-target-invalid {
    outline: 2px dashed #dc3545;
    outline-offset: 2px;
}

.target-accordion {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    background: #f8f9fa;
}

.target-accordion[open] summary {
    border-bottom: 1px solid #e9ecef;
}

.mapped-count-badge {
    font-size: 0.8em;
    font-weight: normal;
    background-color: #e9ecef;
    color: #495057;
    padding: 3px 8px;
    border-radius: 12px;
}

/* ==========================================================================
   17. Import-Assistent Mapping-Seite (NEUES WERKBank-LAYOUT)
   ========================================================================== */

/* Das neue 3-spaltige Grid-Layout */
.mapping-workbench-layout {
    display: grid;
    grid-template-columns: 1fr 1.4fr 0.8fr; /* Ziel | Pool (etwas breiter) | Vorschau */
    gap: 20px;
    align-items: start;
    height: calc(100vh - 200px);
    min-height: 0;
}

/* Basis-Stil für alle drei Panels */
.workbench-panel {
    background: #fff;
    /*border: 1px solid #e0e0e0; - Auskommentiert, da .content-box es bereits hat */
    /*border-radius: 8px; - Auskommentiert */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Auskommentiert, da .content-box es bereits hat */
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Kopfzeile der Panels */
.panel-header {
    padding: 10px 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    min-height: 38px;
}

.panel-header h5 {
    margin: 0;
    font-size: 1em;
}

.filter-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-body {
    padding: 15px;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 0;
}

/* Stile für die Zielspalten-Karten (die später von JS erstellt werden) */
.target-column-card {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 5px;
}

.target-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

.target-column-header .target-name {
    font-weight: 500;
}

.target-column-pills {
    min-height: 30px; /* Minimale Höhe als Drop-Zone */
    padding-top: 5px;
    /* Erlaubt das Umbrechen von vielen Pillen */
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* Drop-Zone für neue Zielspalten */
.new-target-dropzone {
    border: 2px dashed #ccc;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    color: #6c757d;
    margin: 15px;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 0.9em;
}

.new-target-dropzone.drag-over {
    background-color: #e9f5ff;
    border-color: var(--accent-color, #0d6efd);
    color: var(--accent-color, #0d6efd);
}

/* Container für die Quell-Pillen */
#source-pills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
}

/* Placeholder-Text in der Vorschau */
#data-preview-content .placeholder {
    text-align: center;
    padding-top: 40px;
    font-size: 0.9em;
}

.mapping-pill.is-locked {
    cursor: default;
}

.target-header-left {
    display: flex;
    align-items: center;
    gap: 8px; /* Abstand zwischen Stern und Name */
}

.set-primary-btn {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: #cbd5e1; /* Leeres Grau für inaktive Sterne */
    line-height: 1;
}

.set-primary-btn:hover {
    color: #facc15; /* Gelb-Gold beim Hovern */
}

.set-primary-btn.active {
    color: #f59e0b; /* Kräftiges Gold für den aktiven Stern */
}

.set-primary-btn svg {
    width: 20px;
    height: 20px;
}

/* Stile für den Vorlagen-Manager */
.template-manager {
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

.template-manager-header {
    padding: 8px 15px;
    text-align: right;
}

.template-toggle-link {
    font-size: 0.9em;
    color: #6c757d;
    text-decoration: none;
}

.template-toggle-link:hover {
    color: var(--accent-color, #0d6efd);
}

.template-manager-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 15px;
    border-top: 1px solid #e0e0e0;
}

.template-section label {
    display: block;
    font-size: 0.9em;
    margin-bottom: 5px;
    font-weight: 500;
}

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

.input-group .form-select,
.input-group .form-control {
    flex-grow: 1;
}

.input-group .button-link {
    flex-shrink: 0;
}

.data-preview-list {
    list-style-type: none; /* Entfernt die Bullet-Points */
    padding-left: 0; /* Entfernt die Standard-Einrückung der Liste */
    margin: 0;
    font-size: 0.9em; /* Etwas kleinere Schrift für mehr Übersicht */
    color: #333;
}

.data-preview-list li {
    padding: 5px 2px; /* Etwas vertikaler Abstand */
    border-bottom: 1px solid #f0f0f0; /* Feine Trennlinie */
    white-space: nowrap; /* Verhindert Zeilenumbrüche */
    overflow: hidden; /* Versteckt überstehenden Text */
    text-overflow: ellipsis; /* Fügt "..." bei zu langem Text hinzu */
}

/* Entfernt die Linie beim letzten Element */
.data-preview-list li:last-child {
    border-bottom: none;
}

.card-body {
    position: relative;
    /* Hier stehen wahrscheinlich schon andere Regeln wie 'padding' */
}

.help-arrow-container {
    position: absolute; /* Löst das Element aus dem normalen Fluss */
    top: 200px; /* Abstand von oben - muss evtl. angepasst werden */
    left: 40px; /* Abstand vom linken Rand des ersten Panels */
    transform: translateX(-100%); /* Schiebt das Element um seine eigene Breite nach links */
    display: flex;
    align-items: center;
    z-index: 10; /* Stellt sicher, dass es über anderen Elementen liegt */
    pointer-events: none; /* Sorgt dafür, dass man "durch" den Pfeil klicken kann */
}

/* Das SVG-Element für den Pfeil */
.help-arrow-svg {
    width: 60px;
    height: 90px;
    transform: rotate(80deg); /* Leichte Drehung für die Ausrichtung */
}

/* Der "klick"-Text */
.help-arrow-text {
    color: #6c757d;
    font-size: 0.9em;
    font-style: italic;
    margin-left: -90px; /* Schiebt den Text näher an die Pfeilspitze */
    margin-bottom: 35px;
    transform: rotate(315deg);
}

#target-panel .actions-box {
    /* genau dieselben Werte wie .card-body */
    padding: 20px;
}

/* auf Wunsch: horizontales Ausrichten wie configure */
#target-panel .actions-box .action-buttons {
    gap: 10px; /* schon vorhanden aus .action-buttons */
    margin-top: -35px;
}

.format-icon-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.format-icon {
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.format-icon.selected {
    opacity: 1;
    color: var(--primary);
}

/* Beispiel-Icons mit FontAwesome */
.format-icon-text::before {
    content: "\f0f6";
    /* fa-text-width */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
}

.format-icon-zahl::before {
    content: "\f162";
    /* fa-calculator */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
}

.format-icon-datum::before {
    content: "\f073";
    /* fa-calendar-alt */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
}

.filter-panel.drop-up {
    top: auto;
    bottom: 100%;
    margin-bottom: 5px;
}


/* ==========================================================================
   Erweiterte Mapping-Features
   ========================================================================== */

/* Panel-Header Controls */
.panel-header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Daten-Vorschau Tooltip */
.data-preview-tooltip {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    max-width: 300px;
    max-height: 400px;
    overflow: hidden;
}

.tooltip-header {
    background: #f8f9fa;
    padding: 8px 12px;
    font-weight: 500;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.9em;
}

.tooltip-content {
    padding: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.preview-value {
    padding: 2px 0;
    font-size: 0.85em;
    border-bottom: 1px solid #f0f0f0;
}

.preview-value:last-child {
    border-bottom: none;
}

.preview-more {
    padding: 4px 0;
    font-size: 0.8em;
    color: #6c757d;
    font-style: italic;
}

/* Format-Warnungen */
.format-warning-icon {
    margin-left: 5px;
    font-size: 0.8em;
    cursor: help;
}

.mapping-pill.has-issues {
    border-left: 3px solid #ffc107;
}

/* Suchfeld-Hervorhebung */
.search-highlight {
    background-color: #fff3cd !important;
    border-color: #ffc107 !important;
}

#column-search-input:focus {
    border-color: var(--accent-color, #0d6efd);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}


/* ===== MODERNE REVIEW FILTER STYLES ===== */

/* Header Controls 
.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    padding: 10px 0;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
    gap: 15px;
} */

.data-info {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 0.9em;
}

.total-rows,
.visible-rows {
    color: #333;
}

.filter-status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-color, #0d6efd);
}

.filter-count {
    font-weight: 600;
}

.reset-all-filters {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.reset-all-filters:hover {
    color: #b02a37;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Toggle Switch */
.row-limit-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* .toggle-switch ist oben konsolidiert */

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px; /* 24px statt 26px */
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--accent-color, #0d6efd);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px); /* 26px statt 24px */
}

/* Active Filters Container */
.active-filters-container {
    margin-bottom: 15px;
    padding: 12px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

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

/* Table Wrapper - KRITISCH für Filter-Positionierung */
.table-wrapper {
    position: relative;
    /* WICHTIG: Kein overflow: hidden hier! */
}

.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table-container {
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    /* WICHTIG: position: relative für absolute positioning der Filter */
    position: relative;
}

/* Tabelle - Z-Index Fix */
.sticky-header th {
    position: sticky;
    top: 0;
    background: white;
    z-index: 100;
    padding: 2px 2px;
    border-bottom: 2px solid #ddd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filterable-header {
    position: relative;
    user-select: none;
    min-width: 120px;
    vertical-align: top;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 0;
}

.header-title {
    font-weight: 600;
    flex: 1;
    font-size: 0.9em;
}

/* Filter Icons */
.filter-icon {
    cursor: pointer;
    padding: 4px 4px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
    color: #666;
    background-color: transparent;
    border: 1px solid transparent;
}

.filter-icon svg {
    display: block; /* Verhindert unerwünschte Abstände unter dem Icon */
}

.filter-icon:hover {
    background-color: #f0f0f0;
    border-color: #ccc;
    color: #333;
}

/* Filter Panels - KOMPLETT NEU mit höherem Z-Index */
.filter-panel { /* Konsolidiert: filter-panel */
    position: fixed; /* Fixed positioning für korrekte Anzeige */
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    z-index: 9999; /* SEHR HOHER Z-INDEX - über allem */
    min-width: 300px;
    max-width: 400px;
    max-height: 80vh;
    display: none;
    overflow: hidden;
    animation: filterPanelSlideIn 0.2s ease-out;

    flex-direction: column;
}

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

/* Date Filter Content */
.date-filter-content {
    padding: 16px;
    overflow-y: auto;
    flex-grow: 1;
}

.date-input-group {
    margin-bottom: 12px;
}

.date-input-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85em;
    font-weight: 500;
    color: #495057;
}

.date-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9em;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.date-input:focus {
    outline: none;
    border-color: var(--accent-color, #0d6efd);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Multi-Select Filter Content */
.multi-filter-content {
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-grow: 1;
    box-sizing: border-box;
}

.filter-search {
    padding: 12px 16px;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.filter-search-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9em;
    box-sizing: border-box;
}

.filter-search-input:focus {
    outline: none;
    border-color: var(--accent-color, #0d6efd);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.filter-options {
    max-height: 300px;
    overflow-y: auto;
    padding: 0;
    flex-grow: 1;
}

.select-all-container {
    padding: 12px 8px;
    border-bottom: 1px solid #dee2e6;
    box-sizing: border-box;
}

.select-all-container label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
}

.filter-values-container {
    padding: 0 8px;
}

.filter-option {
    padding: 0;
    margin-bottom: 2px;
}

.filter-option label {
    display: flex;
    align-items: center;
    gap: 8px; /* Fügt einen horizontalen Abstand von 8px hinzu */
    cursor: pointer;
}

.select-all-container label,
.filter-option label {
    font-size: 0.85em;
}

.filter-actions {
    display: flex;
    justify-content: flex-start; /* Richtet Buttons rechts aus */
    align-items: center;
    gap: 10px; /* Abstand zwischen den Buttons */
    padding: 12px 16px;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
    flex-shrink: 0; /* Verhindert Schrumpfen */
}

#data-table tbody td {
    font-size: 0.9em;
    padding-top: 10px;
    padding-bottom: 10px;
}



/* ==========================================================================
   Stile für das Einstellungs-Modal
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 500px;
    animation: fadeIn 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
}

.modal-header h2, .modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-header .modal-close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #6c757d;
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

/* Wir passen die Formulare im Modal leicht an */
.modal-body .content-box {
    margin-top: 0;
    margin-bottom: 20px;
    box-shadow: none;
    border: 1px solid #e0e0e0;
}
.modal-body .content-box:last-child {
    margin-bottom: 0;
}

.modal-body .content-box:last-of-type .form-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Alle Labels im Passwort-Bereich bekommen eine FESTE Breite */
.modal-body .content-box:last-of-type .form-group label {
    flex-shrink: 0;
    margin-bottom: 0;
    width: 200px;         /* NEU: Feste Breite statt Mindestbreite */
    text-align: left;      /* NEU: linksbündig statt rechtsbündig */
}

/* Die Passwort-Textboxen nehmen 100% des ihnen zur Verfügung stehenden Platzes ein */
.modal-body .content-box:last-of-type .form-group input {
    width: 100%; /* Stellt sicher, dass alle Textboxen gleich breit sind */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Kleinere Header im Modal */
.modal-body .card-header {
    padding: 10px 15px;
    background-color: #f8f9fa;
}
.modal-body .card-header h3 {
    font-size: 1.0em; /* Kleinere Schriftgröße */
    font-weight: 600;
}
.modal-body .card-body {
    padding: 15px;
}

/* Alle Formular-Eingabefelder im Modal bekommen den .form-control Stil */
.modal-body input[type="text"],
.modal-body input[type="password"],
.modal-body input[type="email"] {
    width: 100%;
    box-sizing: border-box;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
    display: flex;
    justify-content: flex-end; /* Buttons rechtsbündig */
    gap: 10px; /* Abstand zwischen den Buttons */
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;

}

.modal-footer .button-link {
    font-size: 0.9em;
    padding: 6px 12px;
}

/* Für Label und Input nebeneinander ("Anzeigename") */
.form-row-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}
.form-row-inline label {
    flex-shrink: 0; /* Verhindert, dass das Label kleiner wird */
    margin-bottom: 0;
}

/* Positioniert den Hilfetext unten rechts */
.form-help-text {
    text-align: right;
    margin-top: -1px;
    padding-right: 5px;
}
.form-help-text small {
    color: #6c757d;
    font-size: 0.8em;
}

/* Stile für den Anforderungs-Block beim Passwort */
.password-help-text {
    font-size: 0.8em;
    color: #6c757d;
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    margin: 5px 0 15px 0;
}
.password-help-text ul {
    margin: 0;
    padding-left: 15px;
}


/* ==========================================================================
   ZUSÄTZLICH: Stile für die Breadcrumbs in der Navbar
   ========================================================================== */

.navbar-left {
    display: flex;
    align-items: center;
    flex-grow: 1; /* Nimmt den meisten Platz ein */
    min-width: 0; /* Wichtig für Flexbox-Kürzung */
}

.navbar-logo {
    font-weight: bold;
    font-size: 1.25em;
    color: #333;
    text-decoration: none;
    white-space: nowrap; /* Verhindert, dass der Name umbricht */
    
    /* Visueller Trenner */
    margin-right: 24px;
    /*padding-right: 12px;*/
    /*border-right: 1px solid #e5e7eb;*/
}

#navbar-breadcrumb-container {
    flex-grow: 1; /* Nimmt den verfügbaren Platz ein */
    min-width: 0; /* Wichtig für Flexbox-Kürzung */
    overflow: hidden; /* Versteckt den überlaufenden Inhalt */
}

.icon-button,
.breadcrumb-home-link {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px; /* Einheitliches Padding */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4b5563; /* Einheitliche Farbe */
    transition: background-color 0.2s;
    line-height: 1; /* Verhindert Höhenprobleme */
}

.icon-button:hover,
.breadcrumb-home-link:hover {
    background-color: #f3f4f6; /* Einheitlicher Hover-Effekt */
    text-decoration: none;
}

.icon-button svg,
.breadcrumb-home-link svg {
    width: 20px;  /* Einheitliche Breite */
    height: 20px; /* Einheitliche Höhe */
    display: block; /* Stellt sauberes Rendering sicher */
}

.navbar-breadcrumbs {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    white-space: nowrap; /* Verhindert Zeilenumbruch */
    font-size: 0.9em;
}

.navbar-breadcrumbs .breadcrumb-item {
    display: flex;
    align-items: center;
}

.navbar-breadcrumbs .breadcrumb-item a,
.navbar-breadcrumbs .breadcrumb-item span {
    color: #4b5563;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.navbar-breadcrumbs .breadcrumb-item a:hover {
    background-color: #f3f4f6;
    text-decoration: none;
}

.navbar-breadcrumbs .breadcrumb-item span {
    font-weight: 600;
    color: #111827;
}

/* Trennzeichen (Separator) */
.navbar-breadcrumbs .breadcrumb-item:not(.ellipsis) + .breadcrumb-item::before {
    content: '›';
    color: #9ca3af;
    font-size: 1.2em;
}

.navbar-breadcrumbs .breadcrumb-item.ellipsis {
    color: #6c757d;
    font-weight: bold;
    padding: 0 8px;
}

/* Spezielles Styling für das Haus-Icon 
.navbar-breadcrumbs .breadcrumb-item a[href*="dashboard"] {
    font-size: 1.5em; 
    line-height: 1;
}
*/

#preset-editor-list .list-header {
    border-bottom-width: 2px;
    border-bottom-color: #dee2e6;
}

#preset-editor-list .list-header, 
#preset-editor-list .target-column-card {
    display: flex;
    align-items: flex-start;
    gap: 1.75rem;
    padding: 10px 10px;
    margin-bottom: 5px;
    /*border-bottom: 2px solid #dee2e6;*/
    padding-bottom: 10px;
}

#preset-editor-list .list-header {
    align-items: baseline;
    gap: 1.75rem;
    padding: 15px 10px;
    border-bottom: 1px solid #e9ecef;
}

#preset-editor-list .target-column-card {
    border-bottom: 1px solid #e9ecef;
}

#preset-editor-list #target-columns-container .target-column-card:last-child {
    border-bottom: none;
}

#preset-editor-list .header-col {
    font-size: 0.8em;
    font-weight: 500;
    color: #6c757d;
}

/* Spaltenbreiten */
#preset-editor-list .primary-col {
    flex-basis: 30px;
    flex-shrink: 0;
    text-align: center;
    padding-top: 1.5px; 
}
#preset-editor-list .target-col {
    flex-grow: 1;
    flex-basis: 20%;
}
#preset-editor-list .source-col {
    flex-grow: 1;
    flex-basis: 50%;
}
#preset-editor-list .actions-col {
    flex-shrink: 0;
    padding-top: 5px; 
}

/* Kleinere Anpassungen */
#preset-editor-list .source-tag-input {
    margin-top: 5px;
}
/*#preset-editor-list .delete-target-btn {
    margin-top: 2px;
}*/
.delete-card-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #6c757d;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0 5px;
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
}
.delete-card-btn:hover {
    opacity: 1;
    color: #dc3545;
}
.source-tags-container {
    display: flex; 
    flex-wrap: wrap; 
    gap: 5px; 
    margin-top: 5px;
    margin-bottom: 8px;
}
.source-tag {
    background-color: #e9ecef; 
    color: #495057; 
    padding: 3px 8px; 
    border-radius: 12px; 
    font-size: 0.85em; 
    display: inline-flex; 
    align-items: center; 
}
.delete-tag-btn {
    background: none; 
    border: none; 
    cursor: pointer; 
    color: #6c757d; 
    margin-left: 5px; 
    font-weight: bold; 
    line-height: 1; 
    padding: 0 2px;
}
.delete-tag-btn:hover {
    color: #dc3545;
}

.set-primary-btn .star-icon-filled { display: none; }
.set-primary-btn .star-icon-outline { display: block; }
.set-primary-btn.active .star-icon-filled { display: block; }
.set-primary-btn.active .star-icon-outline { display: none; }

.form-check {
    display: flex;
    align-items: center; /* Richtet Checkbox & Text vertikal mittig aus */
    gap: 0.5rem;         /* Ein kleiner Abstand zwischen Checkbox und Text */
    margin-bottom: 0.75rem; /* Abstand zwischen den Options-Zeilen */
}

.form-check-input {
    margin: 0; /* Entfernt Standard-Abstände der Checkbox */
}

.form-check-label {
    margin-bottom: 0; /* Entfernt Standard-Abstände des Labels */
}


.pill-manager { max-width: 800px; }
.pill-input-group { display: flex; gap: 10px; }
#pill-container { display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
    display: inline-flex;
    align-items: center;
    background-color: #e9ecef;
    color: #495057;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    transition: all 0.2s;
}
.delete-pill-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #6c757d;
    margin-left: 8px;
    font-weight: bold;
    font-size: 1.1em;
    opacity: 0.7;
}
.delete-pill-btn:hover { color: #dc3545; opacity: 1; }
.pill.is-removing { transform: scale(0); opacity: 0; }

/* --- NEU: Stile für die Trennlinie und das Highlight --- */
hr.pill-separator {
    border: 0;
    border-top: 1px solid #e9ecef;
    margin: 1.5rem 0;
}
.pill.highlight {
    background-color: #d1fae5; /* Helles Grün */
    color: #065f46;       /* Dunkelgrüner Text */
}


/* ==========================================================================
   Stile für für Formulare in .card-body
   ========================================================================== */

.card-body form p {
    display: grid;
    grid-template-columns: 180px 1fr; /* 1. Spalte (Label) fix, 2. Spalte (Input) flexibel */
    gap: 10px; /* Abstand zwischen Label und Input */
    align-items: center;
    margin-bottom: 1rem;
}

/* Richtet das Label am rechten Rand seiner Spalte aus */
.card-body form p label {
    text-align: right;
    font-weight: 500;
}

/* Stellt sicher, dass alle Textfelder etc. die volle Breite ihrer Spalte nutzen */
.card-body form input[type="text"],
.card-body form input[type="email"],
.card-body form input[type="password"],
.card-body form select,
.card-body form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Ausnahme für Checkboxen, damit sie linksbündig bleiben */
.card-body form p label[for*="is_case_sensitive"] {
    /* Das Label bleibt in der ersten Grid-Spalte und ist rechtsbündig, genau wie die anderen */
    grid-column: 1;
    text-align: right;
}

.card-body form input[type="checkbox"] {
    /* Die Checkbox selbst kommt in die zweite Grid-Spalte und ist linksbündig */
    grid-column: 2;
    width: auto; /* Behält ihre natürliche Größe */
    justify-self: start; /* Richtet sie am Anfang der Spalte aus */
}

.membership-pill {
    display: inline-block;
    padding: 4px 10px;
    margin: 2px;
    border-radius: 15px; /* Macht die Ecken rund */
    background-color: #e9ecef; /* Helles Grau als Hintergrund */
    color: #495057;
    font-size: 0.85em; /* Kleinere Schrift */
    white-space: nowrap; /* Verhindert Zeilenumbruch innerhalb einer Pille */
}

/* ==========================================================================
   Stile für für die Timeline des Audit-Trails
   ========================================================================== */

.timeline {
    list-style: none;
    padding: 20px 0 20px;
    position: relative;
}

/* Die zentrale vertikale Linie */
.timeline:before {
    content: ' ';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 40px;
    width: 3px;
    background-color: #eeeeee;
    margin-left: -1.5px;
}

.timeline-item {
    margin-bottom: 20px;
    position: relative;
}

.timeline-item:before,
.timeline-item:after {
    content: " ";
    display: table;
}
.timeline-item:after {
    clear: both;
}

/* Der runde Punkt auf der Linie mit Icon */
.timeline-badge {
    color: #fff;
    width: 50px;
    height: 50px;
    line-height: 50px;
    font-size: 1.4em;
    text-align: center;
    position: absolute;
    top: 16px;
    left: 40px;
    margin-left: -25px;
    background-color: #999999;
    z-index: 100;
    border-radius: 50%;
}

/* Farbcodes für verschiedene Event-Typen */
.timeline-badge.primary { background-color: #2e6da4; }
.timeline-badge.success { background-color: #3f903f; }
.timeline-badge.info { background-color: #46b8da; }

/* Das Panel mit dem Inhalt */
.timeline-panel {
    width: calc(100% - 90px);
    float: right;
    border: 1px solid #d4d4d4;
    border-radius: 5px;
    padding: 20px;
    position: relative;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.timeline-heading {
    margin-bottom: 10px;
}

.timeline-title {
    margin-top: 0;
    color: inherit;
}

.timeline-body > p,
.timeline-body > ul {
    margin-bottom: 0;
}


/* Fuzzy-Optionen Container Styling */
#fuzzy-options-container {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 1rem;
}

#fuzzy-options-container .form-check-label {
    font-weight: 500;
}

#fuzzy-options-container small.text-muted {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Threshold Slider Styling */
.advanced-options-box {
    background-color: #f8f9fa; /* Konsistenter heller Hintergrund */
    border: 1px solid #dee2e6;  /* Konsistente Rahmenfarbe */
    border-radius: 6px;         /* Konsistenter Eckenradius */
    padding: 1rem;
    margin-top: 1rem;
}

/* Hebt die Überschrift der Checkbox hervor */
.advanced-options-box .form-check-label strong {
    font-weight: 600;
    color: #343a40;
}

/* Styling für die Beschriftung des Sliders */
#fuzzy-threshold-container .form-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Anzeige des Prozentwerts */
#threshold-display {
    font-weight: 700;
    color: var(--accent-color, #0d6efd); /* Verwendet die Firmen-Primärfarbe */
    background-color: #e9ecef;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Modernes Styling für den Schieberegler (Range Slider) */
.form-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: #dee2e6; /* Farbe der Leiste */
    outline: none;
    border-radius: 4px;
    margin: 0.5rem 0;
}

/* Styling für den Schieber-Knopf (Chrome, Safari, Edge) */
.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-color, #0d6efd); /* Verwendet die Firmen-Primärfarbe */
    cursor: pointer;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    margin-top: -6px; /* Vertikale Zentrierung */
}

/* Styling für den Schieber-Knopf (Firefox) */
.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-color, #0d6efd); /* Verwendet die Firmen-Primärfarbe */
    cursor: pointer;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.live-test-wrapper {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background-color: #fff;
    margin-bottom: 1.5rem;
}

/* Kopfzeile der Test-Box */
.live-test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #dee2e6;
}

.live-test-header h4 {
    margin: 0;
    font-size: 1.1em;
}

/* Neuer, dezenter Button für die Einstellungen */
.settings-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.settings-trigger.active, .settings-trigger:hover {
    background-color: #e9ecef;
}

/* Der ausklappbare Bereich für die Einstellungen */
.collapsible-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding: 0 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid transparent;
}

/* Zustand, wenn das Panel geöffnet ist */
.collapsible-panel.open {
    max-height: 200px;
    padding: 1rem;
    border-bottom-color: #dee2e6;
}

/* Badge für Fuzzy-Treffer im Ergebnis-Textfeld */
.fuzzy-badge {
    display: inline-block;
    font-size: 0.75em;
    font-weight: 600;
    color: #fff;
    background-color: var(--accent-color, #007bff);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.rules-snapshot-table-wrapper {
    margin-top: 5px;
    overflow-x: auto; /* NEU: Horizontales Scrollen aktivieren */
    border: 1px solid #dee2e6;
    border-radius: 4px;
}
.rules-snapshot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}
.rules-snapshot-table th, .rules-snapshot-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e9ecef;
    text-align: left;
    vertical-align: top;
    white-space: nowrap; /* Verhindert unerwünschten Zeilenumbruch in den Zellen */
}
.rules-snapshot-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    position: sticky; /* Hält die Kopfzeile beim Scrollen sichtbar */
    top: 0;
    z-index: 1;
}
.rules-snapshot-table tbody tr:last-child td {
    border-bottom: none;
}

/* NEU: Spaltenbreiten definieren */
.rules-snapshot-table .col-prio {
    width: 50px;
}
.rules-snapshot-table .col-keyword {
    width: 35%;
    min-width: 200px;
    white-space: normal; /* Erlaubt Zeilenumbruch bei sehr langen Suchbegriffen */
    word-break: break-all;
    font-family: 'Courier New', monospace;
    background-color: #f1f3f4;
}
.rules-snapshot-table .col-type {
    width: 120px;
}
.rules-snapshot-table .col-output {
    min-width: 150px; /* Jede Output-Spalte ist mindestens 150px breit */
}

.modal-content.modal-wide {
    max-width: 1000px; /* Sie können diesen Wert bei Bedarf anpassen */
    width: 90%;      /* Nimmt fast die gesamte Breite ein, aber mit Rand */
}

.with-help { display: inline-flex; align-items: center; gap: 8px; }

.help-icon{
  --aw-accent: var(--accent-color, #0d6efd);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  color: #000;
  background: var(--accent-color-light);
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  cursor: help;
  user-select: none;
  transition: background .2s ease, color .2s ease, transform .1s ease, box-shadow .2s ease;
}

.help-icon:hover{
  background: var(--aw-accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}

.help-icon:focus-visible{
  outline: 3px solid rgba(0,0,0,0);
  box-shadow: 0 0 0 3px rgba(13,110,253,.25);
}

.landing-header .help-icon,
.landing-footer .help-icon{
  background: transparent;
}

/* 1. Gesamte Tabelle kompakter gestalten */
#results-table th,
#results-table td {
    padding: 8px 12px;
    font-size: 0.8em;
    white-space: nowrap;
}

/* 2. ALLE Header-Zellen werden sticky, sobald sie den oberen Rand erreichen */
#results-table thead th {
    position: -webkit-sticky;
    position: sticky;
    top: 0px;
    background-color: white;
    z-index: 10;
}

/* 3. Die fixierte Checkbox-Spalte (Header UND Body) */
#results-table th.col-select,
#results-table td.col-select {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    width: 50px;
    background-color: white;
    z-index: 5;
}

/* 4. Der Header der Checkbox-Spalte bekommt einen HÖHEREN z-index */
#results-table thead th.col-select {
    z-index: 15;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

/* 5. Hover-Effekt für die fixierte Spalte beibehalten */
#results-table tbody tr:hover td.col-select {
    background-color: #f5f5f5;
}

/* 6. Standardmäßig sind Bearbeitungselemente unsichtbar */
.col-select,
#bulk-bar {
    display: none;
}

/* 7. Im Bearbeitungsmodus werden sie sichtbar */
#results-content-box.is-editing .col-select {
    display: table-cell;
}

/* Sichtbar machen, wenn der Bearbeitungsmodus aktiv ist */
#results-content-box.is-editing #bulk-bar {
    display: flex;
}

/* Stile für die neue, integrierte Bulk-Aktionsleiste */
#bulk-bar {
    align-items: center;
    gap: 15px;
    margin-left: 20px;
    border-left: 1px solid #dee2e6;
    padding-left: 20px;
}

.bulk-info {
    font-size: 0.9em;
    color: #6c757d;
}

#bulk-count {
    font-weight: bold;
    color: #333;
}

.bulk-buttons {
    display: flex;
    gap: 8px;
}

/* Buttons im disabled-Zustand ausgrauen */
.bulk-buttons button:disabled {
    background-color: #e9ecef;
    border-color: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
    opacity: 1;
}

.toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 10px;
    gap: 15px;
}

.rule-pills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.rule-pill {
    display: inline-flex;
    align-items: center;
    background-color: #e2e3e5;
    color: #495057;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    transition: all 0.2s;
}
.rule-pill.is-interactive {
    cursor: pointer;
}
.rule-pill.is-interactive:hover {
    background-color: #d1e7fd;
    color: var(--accent-color, #0d6efd);
}
.rule-pill.is-primary {
    background-color: #fff3cd;
    color: #664d03;
    font-weight: bold;
    border-color: #fff3cd;
}
.rule-pill.is-primary:hover {
    background-color: #fff3cd;
    color: #664d03;
    opacity: 0.9;
}
#results-content-box.is-editing .rule-pill.is-interactive:hover .remove-pill-btn {
    display: inline-block;
}

#results-content-box.is-editing .rule-pill.is-interactive .remove-pill-btn {
    display: inline-block;
}

#tag-list .rule-pill.selected {
    background-color: #dc3545;
    color: white;
}
#tag-list .rule-pill.selected .remove-pill-btn {
    background: rgba(255,255,255,0.2);
}

.rule-pill .remove-pill-btn {
    display: none;
}

/* Zeigt den Lösch-Button nur an, wenn der Bearbeitungsmodus aktiv ist */
.is-editing .rule-pill.is-interactive .remove-pill-btn {
    display: inline-block;
}

.tag-filter-list {
    display: flex;
    flex-direction: column;
    max-height: 200px;
    overflow-y: auto;
}

a.tag-filter-option {
    display: block;
    padding: 6px 12px;
    text-decoration: none;
    color: #333;
    border-radius: 4px;
}

a.tag-filter-option:hover {
    background-color: #f0f0f0;
}

a.tag-filter-option.active {
    background-color: var(--accent-color, #0d6efd);
    color: white;
    font-weight: bold;
}

.filter-icon.is-active {
    background-color: #fff3cd;
    color: #664d03;
    border-color: #fff3cd;
}

.form-error-box {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    text-align: center;
}

/* Styling für die Methodenauswahl im Wizard */
.method-selection-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.method-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.method-card:hover {
    border-color: var(--accent-color, #0d6efd);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.method-card h5 {
    margin-top: 0;
    color: var(--accent-color, #0d6efd);
}

.method-card p {
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 0;
}


#enrichment-form, #preset-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

#enrichment-validation-table, #enrichment-preview-table, #enrichment-overview-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#enrichment-validation-table th, #enrichment-validation-table td,
#enrichment-preview-table th, #enrichment-preview-table td,
#enrichment-overview-table th, #enrichment-overview-table td {
    border: 1px solid #dee2e6;
    padding: 8px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent-color, #0d6efd);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-bar {
    height: 20px;
    border-radius: 4px;
    text-align: center;
    color: white;
    line-height: 20px;
}

.enrich-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #adb5bd; /* Dezentes Grau */
    opacity: 0.6; /* Standardmäßig leicht transparent */
    transition: all 0.2s ease-in-out;
    display: inline-flex; /* Macht den Button zu einem Flex-Container */
    align-items: center;  /* Zentriert das Icon vertikal */
    justify-content: center; /* Zentriert das Icon horizontal */
    width: 26px;  /* Feste Breite */
    height: 26px; /* Feste Höhe (gleich der Breite) */
    padding: 0;   /* Entfernt inneren Abstand, der stören könnte */
    border-radius: 50%; /* Ihr Code für den runden Hintergrund */
}

.enrich-action-btn:hover {
    opacity: 1; 
    background-color: #e9ecef; 
    color: #495057; 
}

#enrichment-bar,
.enrich-action-btn {
    display: none;
}

/* WENN der "enrichment"-Schritt aktiv ist, werden sie sichtbar */
.step-enrichment-active #enrichment-bar,
.step-enrichment-active .enrich-action-btn {
    display: flex; /* oder 'inline-flex' für den Button */
}

/* Standardmäßig sind die Correction-UI-Teile sichtbar */
.step-corrections-active #bulk-bar {
    display: flex;
}

.form-grid {
    display: grid;
    grid-template-columns: max-content 1fr; /* Spalte 1 so breit wie der Inhalt, Spalte 2 füllt den Rest */
    gap: 12px 15px; /* Zeilen- und Spaltenabstand */
    align-items: center;
    margin-top: 20px;
}

.form-grid label {
    justify-self: end; /* Richtet die Labels rechtsbündig aus */
    font-weight: 500;
}

/* Hilfsklasse, damit ein Element über beide Spalten geht */
.form-grid-span-2 {
    grid-column: 1 / -1;
}

.manual-table-container {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-top: 15px;
}

#manual-enrichment-table {
    line-height: 1.2;
}
#manual-enrichment-table td, 
#manual-enrichment-table th {
    padding: 4px 8px !important; 
    vertical-align: middle;
}

#manual-enrichment-table input.form-control {
    padding: 4px 8px;
    font-size: 0.9em;
    width: 100%;
}

.file-upload-card {
    border: 1px dashed #ced4da;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background-color: #f8f9fa;
}
.separator-text {
    text-align: center;
    margin: 15px 0;
    color: #6c757d;
}

#lookup-drop-zone {
    border: 2px dashed #ced4da;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}
#lookup-drop-zone.dragover {
    background-color: #e2e6ea;
    border-color: #adb5bd;
}

.file-selection-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

