body {
    font-family: Arial, sans-serif;
    margin: 20px;
    background-color: #f4f4f4;
    color: #333;
}

h1, h2, h3, h4, h5, h6 {
    color: #555;
    margin-top: 20px;
    margin-bottom: 10px;
}

.directory-section {
    border: 1px solid #ccc;
    padding: 15px;
    margin-bottom: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.carousel-wrapper {
    position: relative; /* Wichtig: Referenzpunkt für absolute Positionierung der Buttons */
    padding: 0 40px; /* Platz für die Pfeile außerhalb des scrollbaren Bereichs */
    box-sizing: border-box;
}

.carousel-container {
    width: 100%;
    overflow-x: scroll; /* Wichtig: Ermöglicht das Scrollen */
    overflow-y: hidden; /* Verhindert vertikales Scrollen */
    scroll-behavior: smooth; /* Sanfter Bildwechsel */
    margin-top: 15px;
    /* Padding wird jetzt vom Wrapper übernommen, hier nicht mehr nötig */
    box-sizing: border-box;
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

/* Verstecke die Scrollbar für Webkit (Chrome, Safari) */
.carousel-container::-webkit-scrollbar {
    display: none;
}

.carousel-track {
    display: flex;
}

.carousel-item {
    min-width: 250px; /* Breite jedes Karussell-Elements */
    flex-shrink: 0; /* Verhindert, dass Elemente schrumpfen */
    text-align: center;
    padding: 10px;
    box-sizing: border-box;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-right: 15px; /* Abstand zwischen den Bildern */
    display: flex; /* Für Flexbox-Anordnung der inneren Elemente */
    flex-direction: column; /* ID, Bild, Name untereinander */
    align-items: center;
    justify-content: space-between;
}

.carousel-item:last-child {
    margin-right: 0;
}

.carousel-item img {
    max-width: 100%; /* Bild füllt den verfügbaren Platz aus */
    height: 200px; /* Feste Höhe für Bilder */
    object-fit: contain; /* Bild skaliert, um in den Bereich zu passen, behält Seitenverhältnis */
    border: 1px solid #ddd;
    padding: 2px;
    background-color: #fff;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 10px;
}

.carousel-id {
    font-weight: bold;
    color: #007bff;
    margin-bottom: 5px;
    font-size: 0.9em;
    word-break: break-all; /* Lange IDs umbrechen */
}

.carousel-name {
    font-size: 0.8em;
    color: #666;
    word-break: break-all; /* Lange Dateinamen umbrechen */
}

.carousel-button {
    position: absolute; /* Wichtig: Absolut positioniert zum .carousel-wrapper */
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 24px;
    z-index: 10;
    border-radius: 5px;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.carousel-button:hover {
    opacity: 1;
}

.carousel-button.prev {
    left: 0; /* Positionierung innerhalb des .carousel-wrappers */
}

.carousel-button.next {
    right: 0; /* Positionierung innerhalb des .carousel-wrappers */
}

.no-images {
    font-style: italic;
    color: #777;
    margin-left: 20px;
}

/* --- Modal Styling --- */
.modal {
    display: none; /* KORRIGIERT: Standardmäßig ausgeblendet */
    position: fixed; /* Bleibt beim Scrollen an Ort und Stelle */
    z-index: 1000; /* Ganz oben über allen anderen Elementen */
    left: 0;
    top: 0;
    width: 100%; /* Volle Breite */
    height: 100%; /* Volle Höhe */
    overflow: auto; /* Aktiviert Scrollen bei Bedarf */
    background-color: rgba(0,0,0,0.9); /* Schwarzer Hintergrund mit Transparenz */
    /* Für Flexbox-Zentrierung des Inhalts */
    align-items: center; /* Vertikal zentrieren */
    justify-content: center; /* Horizontal zentrieren */
}

.modal.active {
    display: flex; /* WICHTIG: Diese Klasse macht das Modal sichtbar */
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%; /* Maximale Breite, damit das Bild nicht zu groß wird */
    max-height: 90vh; /* Maximale Höhe des Viewports, 90% um etwas Rand zu lassen */
    object-fit: contain; /* Bildgröße anpassen, ohne es zu beschneiden */
}

.modal-caption {
    margin: auto;
    display: block;
    width: 80%;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    position: absolute; /* Unter dem Bild positionieren */
    bottom: 20px; /* Abstand vom unteren Rand */
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2em;
    max-width: 90%; /* Max. Breite für die Bildunterschrift */
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1001; /* Über dem Modal-Bild */
}

.modal-close:hover,
.modal-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Optional: Animation für das Modal */
.modal-content, .modal-caption {
    -webkit-animation-name: zoom;
    -webkit-animation-duration: 0.6s;
    animation-name: zoom;
    animation-duration: 0.6s;
}

@-webkit-keyframes zoom {
    from {-webkit-transform: scale(0)}
    to {-webkit-transform: scale(1)}
}

@keyframes zoom {
    from {transform: scale(0.1)}
    to {transform: scale(1)}
}