/* static/style.css */
body, html {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5; /* Heller Hintergrund */
    height: 100%;
    color: #333; /* Standard Textfarbe */
    box-sizing: border-box; /* Verhindert Scrollbalken durch Padding/Border */
}

/* Erbt box-sizing von html */
*, *:before, *:after {
  box-sizing: inherit;
}

#app-container {
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Inhalt startet oben */
    min-height: 100vh; /* Mindestens volle Höhe */
    padding: 20px; /* Außenabstand */
}

#drop-zone {
    border: 3px dashed #adb5bd; /* Gestrichelter Rand */
    border-radius: 15px; /* Abgerundete Ecken */
    padding: 20px;
    text-align: center;
    width: 95%; /* Breite des Hauptbereichs */
    max-width: 1400px; /* Maximale Breite */
    min-height: 85vh; /* Mindesthöhe */
    background-color: #ffffff; /* Weißer Hintergrund */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); /* Weicherer Schatten */
    transition: background-color 0.3s ease, border-color 0.3s ease; /* Übergänge für Hover */
    display: flex;
    flex-direction: column; /* Inhalt untereinander */
}

/* Style, wenn eine Datei über den Bereich gezogen wird */
#drop-zone.dragover {
    background-color: #e9f5ff; /* Hellblau */
    border-color: #007bff; /* Blau */
}

/* Nachricht, die angezeigt wird, wenn noch keine Dateien da sind */
#drop-message {
    font-size: 1.4em;
    color: #6c757d; /* Grau */
    margin: 50px 0; /* Vertikaler Abstand */
}
#drop-zone.files-present #drop-message {
    display: none; /* Ausblenden, wenn Dateien vorhanden */
}

/* Hauptinhaltbereich (Template, Quellen, Ziele) */
#main-content {
    display: flex;
    justify-content: space-around; /* Gleichmäßiger Abstand zwischen Panels */
    flex-grow: 1; /* Nimmt verfügbaren Platz ein */
    margin-top: 15px;
    gap: 15px; /* Abstand zwischen den Panels */
    width: 100%;
}

/* Genereller Style für die Panels */
.panel {
    background-color: #f8f9fa; /* Sehr heller Grauton */
    border-radius: 8px;
    padding: 15px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); /* Innerer Schatten */
    display: flex;
    flex-direction: column;
    height: 68vh; /* Feste Höhe für die Panels */
}

/* Panel-Breiten-Verteilung */
#template-drop-area { width: 20%; }
#left-panel { width: 38%; } /* Quellen */
#right-panel { width: 38%; } /* Ziele */

/* Panel-Überschriften */
.panel h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px;
    color: #495057; /* Dunkleres Grau */
    font-size: 1.1em;
    flex-shrink: 0; /* Verhindert Schrumpfen */
}
/* Kleine Anweisungen in den Panels */
.instructions {
    font-size: 0.85em;
    color: #6c757d;
    text-align: center;
    margin-bottom: 10px;
    padding: 0 5px;
    flex-shrink: 0;
}

/* Spezielles Styling für den Template-Bereich */
#template-drop-area {
    border: 2px dashed #6c757d;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
    min-height: 100px; /* Mindesthöhe */
}
#template-drop-area.drag-over { /* Wenn Datei drübergezogen wird */
    background-color: #e6f0ff;
    border-color: #0d6efd;
}
#template-drop-area.has-template { /* Wenn ein Template gesetzt ist */
     border-style: solid;
     border-color: #ffc107; /* Gold */
     background-color: #fffbeb; /* Hellgelb */
}
#template-placeholder { /* Text, wenn leer */
    color: #6c757d;
    font-size: 0.9em;
}
#template-display .bubble { /* Die Bubble, die das Template anzeigt */
    cursor: default;
    background-color: #fff3cd; /* Hellgelb */
    color: #664d03; /* Dunkelgelb */
    border: 1px solid #ffda6a;
    margin-top: 10px;
    display: inline-block;
    word-break: break-word;
}

/* Container für die Bubbles in den Panels */
.bubble-container {
    display: flex;
    flex-wrap: wrap; /* Bubbles umbrechen lassen */
    gap: 8px; /* Abstand zwischen Bubbles */
    justify-content: flex-start; /* Bubbles starten links */
    align-content: flex-start; /* Füllt von oben */
    flex-grow: 1; /* Nimmt restlichen Platz im Panel ein */
    overflow-y: auto; /* Scrollbar, wenn Bubbles überlaufen */
    padding: 5px;
}

/* Generelles Bubble-Styling */
.bubble {
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease, background-color 0.3s ease;
    cursor: default; /* Standardmäßig nicht interaktiv */
    display: inline-flex; /* Passt sich Inhalt an, aber nebeneinander */
    align-items: center; /* Vertikal zentrieren */
    gap: 5px; /* Abstand innerhalb der Bubble */
    word-break: break-word; /* Lange Wörter umbrechen */
    max-width: 95%; /* Verhindert Überlaufen */
    min-width: 70px;
    text-align: center;
    justify-content: center; /* Horizontal zentrieren */
    background-color: #dee2e6; /* Standard-Grau */
    color: #495057; /* Standard-Textfarbe */
}
/* Bereich für den Namen in der Bubble */
.bubble-name {
     flex-grow: 1; /* Nimmt Platz ein */
     overflow: hidden; /* Versteckt überlaufenden Text */
     text-overflow: ellipsis; /* Fügt "..." hinzu */
     white-space: nowrap; /* Verhindert Zeilenumbruch */
}

/* Styling für Datei-Bubbles (links) */
.file-bubble {
    background-color: #cfe2ff; /* Hellblau */
    color: #052c65;
    cursor: grab; /* Zeigt an, dass sie ziehbar ist */
}
.file-bubble:active { /* Wenn geklickt/gezogen */
    cursor: grabbing;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    transform: scale(1.02); /* Leichte Vergrößerung */
}
.file-bubble.dragging { /* Während des Ziehens */
    opacity: 0.4;
}
/* Style für benutzte (zugeordnete oder Template) Bubbles */
.file-bubble.used {
    opacity: 0.5; /* Ausgrauen */
    cursor: default; /* Nicht mehr ziehbar */
}
/* Spezieller Style für die Template-Bubble */
.file-bubble.is-template {
    background-color: #fff3cd; /* Hellgelb */
    color: #664d03;
    border: 1px solid #ffc107; /* Goldener Rand */
    opacity: 1; /* Standardmäßig voll sichtbar */
}
/* Wenn Template UND benutzt (also als Template ausgewählt) */
.file-bubble.is-template.used {
     opacity: 0.6; /* Leicht ausgegraut */
     cursor: default;
}


/* Styling für Historiker-Bubbles (rechts) */
.historian-bubble {
    background-color: #d1e7dd; /* Hellgrün */
    color: #0a3622;
    border: 2px dashed transparent; /* Unsichtbarer Rand für Hover-Effekt */
    transition: background-color 0.3s ease, border-color 0.3s ease;
    flex-direction: column; /* Name über Dateiname */
    align-items: center;
    min-height: 45px;
    padding: 5px;
    max-width: 150px; /* Beschränkt Breite */
}
.historian-bubble.drag-over { /* Wenn Datei drübergezogen wird */
    border-color: #0d6efd; /* Blauer Rand */
    background-color: #e6f0ff; /* Heller Blauton */
}
.historian-bubble.associated { /* Wenn eine Datei zugeordnet ist */
    background-color: #a3cfbb; /* Dunkleres Grün */
    border-style: solid;
    border-color: #198754; /* Dunkelgrüner Rand */
}
/* Kleiner Text unter dem Historikernamen für die zugeordnete Datei */
.associated-file {
    font-size: 0.75em;
    font-style: italic;
    color: #0a3622;
    margin-top: 2px;
    word-break: break-word;
    max-width: 95%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap; /* Hält es auf einer Zeile */
}

/* Bereich für den Merge-Button */
#action-area {
    margin-top: 15px;
    text-align: center;
    flex-shrink: 0; /* Verhindert Schrumpfen */
}
#merge-button {
    background-color: #198754; /* Grün */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease, opacity 0.3s ease;
}
#merge-button:disabled { /* Wenn Button deaktiviert ist */
    background-color: #6c757d; /* Grau */
    cursor: not-allowed;
    opacity: 0.7;
}
#merge-button:not(:disabled):hover { /* Hover-Effekt für aktiven Button */
    background-color: #157347; /* Dunkleres Grün */
}

/* Bereich für Text-Statusmeldungen */
#status-area {
    margin-top: 10px;
    padding: 8px;
    min-height: 30px; /* Platzhalterhöhe */
    text-align: center;
    width: 100%;
    flex-shrink: 0;
}
/* Style für die einzelnen Statusmeldungen */
.status-message {
    padding: 8px 12px;
    border-radius: 5px;
    margin-bottom: 5px;
    font-size: 0.9em;
    display: inline-block; /* Nimmt nur benötigte Breite ein */
    max-width: 90%;
}
/* Farben für verschiedene Status-Typen */
.status-success { background-color: #d1e7dd; color: #0f5132; border: 1px solid #badbcc; }
.status-error { background-color: #f8d7da; color: #842029; border: 1px solid #f5c2c7; }
.status-info { background-color: #cff4fc; color: #055160; border: 1px solid #b6effb; }
.status-warning { background-color: #fff3cd; color: #664d03; border: 1px solid #ffe69c; } /* Neue Warnfarbe */
/* Style für Links in Statusmeldungen (obwohl nicht mehr für Download genutzt) */
#status-area a { color: #0d6efd; font-weight: bold; text-decoration: none; }
#status-area a:hover { text-decoration: underline; }


/* Bereich für die Fortschrittsanzeige des Merges */
#progress-area {
    margin-top: 15px;
    padding: 10px;
    background-color: #f0f0f0; /* Etwas dunklerer Hintergrund als Panel */
    border-radius: 8px;
    text-align: center;
    width: 100%;
    flex-shrink: 0;
}
#progress-area h3 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #333;
    font-size: 1em;
}
/* Die Textbox für das Log */
#progress-display {
    font-family: 'Consolas', 'Courier New', Courier, monospace; /* Monospace Schrift */
    font-size: 0.9em;
    color: #212529; /* Dunkler Text */
    min-height: 50px;
    background-color: #fff; /* Weißer Hintergrund */
    padding: 10px; /* Innenabstand */
    border-radius: 4px;
    white-space: pre-wrap; /* Zeilenumbrüche aus Log anzeigen */
    text-align: left; /* Linksbündig */
    max-height: 200px; /* Maximale Höhe, dann scrollen */
    overflow-y: auto; /* Scrollbar bei Bedarf */
    border: 1px solid #ced4da; /* Heller Rand */
    line-height: 1.4; /* Zeilenabstand */
}
/* Container für den Fortschrittsbalken */
#progress-bar-container {
    margin-top: 10px;
    background-color: #d1d1d1; /* Hintergrund des leeren Balkens */
    border-radius: 5px;
    overflow: hidden; /* Stellt sicher, dass der innere Balken nicht überläuft */
}
/* Der eigentliche Fortschrittsbalken */
#progress-bar {
    width: 0%; /* Startet bei 0% */
    height: 18px; /* Höhe des Balkens */
    background-color: #0d6efd; /* Startfarbe Blau */
    border-radius: 5px;
    transition: width 0.4s ease-in-out, background-color 0.4s ease; /* Animationen */
    text-align: center;
    color: white; /* Textfarbe auf Balken */
    font-size: 0.8em;
    font-weight: bold; /* Fett */
    line-height: 18px; /* Text vertikal zentrieren */
    white-space: nowrap; /* Verhindert Umbruch des %-Textes */
}

/* Bereich für den Download-Button */
#download-area {
    margin-top: 15px;
    text-align: center;
    padding: 10px;
    flex-shrink: 0;
}
/* Style für den Download-Link als Button */
#download-area a.download-button {
    display: inline-block; /* Verhält sich wie Button */
    padding: 10px 20px;
    background-color: #28a745; /* Grün */
    color: white;
    text-decoration: none; /* Kein Unterstrich */
    border-radius: 20px; /* Runde Ecken */
    font-weight: bold;
    transition: background-color 0.3s ease;
}
#download-area a.download-button:hover { /* Hover-Effekt */
    background-color: #218838; /* Dunkleres Grün */
}


/* Hilfsklasse zum Ausblenden von Elementen */
.hidden {
    display: none !important;
}