/* Globale Stile & Mobile-First Defaults */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f4f8;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.back-button {
    display: inline-block;
    background-color: #6c757d;
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    margin: 15px 0 0 15px;
    transition: background-color 0.3s, transform 0.2s;
    float: left;
    clear: both;
}

.back-button:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.container {
    background-color: #fff;
    padding: 25px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px; /* Begrenzt die maximale Breite des Hauptcontainers */
    text-align: center;
}

h1 {
    color: #0056b3;
    margin-bottom: 5px;
    font-size: 1.8rem;
}

p {
    color: #666;
    margin-bottom: 25px;
    font-size: 0.95rem;
}

.input-section {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* Styling für den benutzerdefinierten Dateiauswahl-Button */
.custom-file-upload {
    display: inline-block;
    padding: 10px 20px;
    font-size: 0.95rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: bold;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.custom-file-upload:hover {
    background-color: #0056b3;
}

/* Versteckt den Standard-Datei-Input */
#fileInput {
    display: none;
}

.file-name-display {
    font-size: 0.9rem;
    color: #555;
    word-break: break-all; /* Zeilenumbruch für lange Dateinamen */
}

/* --- Hinzugefügte und angepasste Stile für die Hash-Typ-Auswahl --- */
.hash-type-selection {
    margin-top: 15px;
    margin-bottom: 10px; /* Abstand zum nächsten Button */
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: center; /* Zentriert die Auswahl im mobilen Layout */
    flex-wrap: wrap; /* Ermöglicht Umbruch auf kleinen Bildschirmen */
}

.hash-type-selection label {
    font-size: 0.95rem;
    color: #555;
    white-space: nowrap; /* Verhindert Umbruch des Labels */
}

.hash-type-selection select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: #f8f9fa;
    color: #333;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    flex-grow: 1; /* Lässt das Select-Feld wachsen */
    max-width: 200px; /* Begrenzt die Breite auf größeren Bildschirmen */
}

.hash-type-selection select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}
/* --- Ende Hash-Typ-Auswahl Stile --- */


/* Allgemeine Button-Stile */
button {
    padding: 10px 20px;
    font-size: 0.95rem;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: bold;
    width: 100%;
    box-sizing: border-box;
    max-width: 300px; /* Begrenzt die maximale Breite des Buttons */
    margin: 0 auto; /* Zentriert den Button */
    display: block; /* Macht den Button zu einem Block-Element für margin: auto */
}

button:hover:not(:disabled) {
    background-color: #218838;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Ergebnisboxen für Hash und Verifikation */
.result-box {
    margin-top: 30px;
    padding: 20px;
    border-radius: 8px;
    text-align: left;
    font-size: 1rem;
    line-height: 1.6;
    border: 1px solid transparent;
}

.result-box.valid {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.result-box.invalid {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.result-box p {
    margin: 0 0 10px 0;
    color: inherit;
}

/* --- KORREKTUR FÜR DEN ÜBERLAUF DES HASH-WERTS --- */
.result-box pre {
    background-color: rgba(255, 255, 255, 0.5);
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto; /* Erlaubt horizontales Scrollen, falls der Text zu lang ist */
    font-size: 0.85rem;
    color: #333;
    white-space: pre-wrap; /* WICHTIG: Erlaubt Zeilenumbrüche, während Leerzeichen erhalten bleiben */
    word-break: break-all; /* WICHTIG: Erlaubt den Umbruch von Wörtern (Hashes), die keine Leerzeichen enthalten */
    overflow-wrap: break-word; /* Zusätzliche Sicherheit für Wortumbrüche (modernere Eigenschaft) */
    box-sizing: border-box; /* Stellt sicher, dass Padding und Border nicht zur Breite hinzukommen */
    margin: 0; /* Stellt sicher, dass keine äußeren Margins den Überlauf verursachen */
}

.hidden {
    display: none !important;
}

/* Verifikationsbereich */
.verification-section {
    margin-top: 25px;
    padding: 0 10px; /* Optional: etwas seitlicher Abstand zum Container */
    box-sizing: border-box;
    width: 100%; /* Stellt sicher, dass es die volle Breite des Containers einnimmt */
}

.verification-section h2 {
    color: #0056b3;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

/* --- KORREKTUR FÜR ZU KLEINES PRÜFFELD --- */
.verification-section input[type="text"] {
    width: 100%; /* Macht das Eingabefeld so breit wie sein Eltern-Container */
    max-width: 500px; /* Begrenzt die Breite auf großen Bildschirmen für bessere Lesbarkeit */
    padding: 10px 15px;
    font-size: 0.95rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    margin: 0 auto 15px auto; /* Zentriert das Feld horizontal und gibt unteren Abstand */
    background-color: #f8f9fa;
    color: #333;
    display: block; /* Macht das Feld zu einem Block-Element, damit margin:auto funktioniert */
}

/* Styling für den Kopieren-Button (in der Hash-Result-Box) */
.copy-button {
    background-color: #007bff;
    margin-top: 15px; /* Abstand zum Hashwert */
}

.copy-button:hover:not(:disabled) {
    background-color: #0056b3;
}

.error-list {
    margin-top: 20px;
    text-align: left;
    color: #dc3545;
    font-size: 0.9rem;
}

.error-list p {
    margin-bottom: 5px;
    text-align: left;
    color: #dc3545;
}

/* Media Queries für größere Bildschirme */
@media (min-width: 600px) {
    body {
        align-items: center;
        padding: 40px;
    }

    .container {
        padding: 30px 40px;
    }

    h1 {
        font-size: 2.2rem;
    }

    p {
        font-size: 1rem;
        margin-bottom: 30px;
    }

    .input-section {
        flex-direction: row;
        gap: 20px;
        justify-content: center;
        align-items: flex-start;
    }

    /* Dateiauswahl-Label auf größeren Bildschirmen */
    .custom-file-upload {
        width: auto;
        min-width: 150px;
    }

    /* Dateinamenanzeige auf größeren Bildschirmen */
    .file-name-display {
        flex-grow: 1;
        text-align: left;
        padding-left: 10px;
    }

    /* Hash-Typ-Auswahl auf größeren Bildschirmen */
    .hash-type-selection {
        justify-content: flex-start;
        max-width: fit-content;
        margin-left: auto;
        margin-right: 0;
    }

    textarea {
        flex-grow: 1;
        height: 400px;
    }

    button {
        width: auto;
        min-width: 150px;
    }

    .back-button {
        position: absolute;
        top: 30px;
        left: 30px;
        margin: 0;
    }

    .container {
        margin-top: 0;
    }

    .verification-section input[type="text"] {
        margin-left: auto;
        margin-right: auto;
    }
}