/* Allgemeine Stile & Comic-Look */
body {
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive', sans-serif;
    background-color: #f0f8ff; /* Initial background */
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0; /* Remove body padding */
    /* Background image properties - will be set by JS */
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed; /* Keeps background fixed during scroll */
}

.container {
    max-width: 1200px;
    margin: 20px auto; /* Add margin back for spacing */
    /* Slightly transparent background to see body background */
    background-color: rgba(255, 255, 255, 0.92);
    padding: 20px 30px;
    border: 3px solid #555;
    border-radius: 15px;
    box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2);
}

header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    min-height: 10px;
}

h1 {
    color: #ff6347;
    font-size: 2.8em;
    text-shadow: 2px 2px #ffdab9;
}

h2, h3 {
    color: #4682b4;
    border-bottom: 2px solid #add8e6;
    padding-bottom: 5px;
    margin-top: -4px;
}

button {
    font-family: inherit;
    background-color: #32cd32; /* Grün */
    color: white;
    padding: 12px 25px;
    border: 2px solid #228b22;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.15);
    margin-top: 10px; /* Default margin top */
}

button:hover {
    background-color: #228b22;
}
button:active {
    transform: scale(0.98);
}

/* Start Screen als Vollbild-Overlay */
#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('StartScreen.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column; /* Buttons untereinander */
    justify-content: center;
    align-items: center;
    z-index: 500;
    padding: 0;
}

#start-screen button {
    padding: 15px 35px;
	margin-top: 100px; /* Abstand nach oben */
    font-size: 1.5em;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

/* WICHTIG: !important, um display:flex vom Modal zu überschreiben */
.hidden {
    display: none !important;
}


/* Spielbereich Layout */
.game-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.map-container {
    flex: 2;
    border: 2px solid #ccc;
    border-radius: 10px;
    padding: 15px;
    background-color: #fafad2;
    display: flex; /* Für Footer-Positionierung */
    flex-direction: column; /* Inhalt untereinander */
}

/* Leaflet Karte */
#map {
    height: 500px; /* Feste Höhe */
    width: 100%; /* Volle Breite des Containers */
    border: 1px solid #aaa;
    border-radius: 5px;
    margin-top: 10px;
    margin-bottom: 10px;
    flex-shrink: 0; /* Verhindert Schrumpfen */
}


.info-container {
    flex: 1;
    min-width: 300px;
    border: 2px solid #ccc;
    border-radius: 10px;
    padding: 15px;
    background-color: #f5f5f5;
    /* NEU: Flexbox-Eigenschaften hinzufügen */
    display: flex;
    flex-direction: column;
	max-height: 811px;
    /* Die Höhe wird durch den übergeordneten .game-layout flex container bestimmt */
}

.score {
    font-size: 1.4em;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
    background-color: #e6e6fa;
    padding: 10px;
    border-radius: 8px;
    border: 2px dashed #9370db;
}

#score-value {
    color: #ff4500;
}

/* Styling für die Detail-Boxen */
.details-box {
    position: relative; /* Wichtig für absoluten Close-Button */
    margin-top: 20px;
    padding: 15px;
    padding-top: 30px; /* Mehr Platz oben für Close Button */
    border: 2px dotted #4682b4;
    border-radius: 8px;
    background-color: #e0ffff;
    max-height: 250px; /* Maximale Höhe, dann scrollen */
    overflow-y: auto; /* Scrollbar bei Bedarf */
}
.details-box h3 { margin-top: 0; padding-bottom: 10px; font-size: 1.1em; }
.details-box p { margin: 5px 0; font-size: 0.95em;}
.details-box ul { list-style: none; padding-left: 15px; margin-top: 5px; }
.details-box li { margin-bottom: 5px; font-size: 0.9em; }

/* Close Button in Detail-Boxen */
.details-box .close-details-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 20px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}
.details-box .close-details-btn:hover {
    color: #333;
}

#school-details-content ul {
    list-style: none;
    padding-left: 10px;
}
#school-details-content li {
    margin-bottom: 5px;
}


#conflict-list {
     margin-top: 20px;
     /* NEU: Flexbox für den Container der Liste */
     display: flex;
     flex-direction: column; /* h3 und ul untereinander */
     flex-grow: 1; /* Soll verfügbaren Platz im info-container einnehmen */
     min-height: 0; /* WICHTIG: Erlaubt Schrumpfen unter die Inhaltsgrösse */
}

#conflict-list h3 {
    /* Optional: Verhindern, dass die Überschrift schrumpft */
    flex-shrink: 0;
     /* Bestehende Styles beibehalten */
     color: #4682b4;
     border-bottom: 2px solid #add8e6;
     padding-bottom: 5px;
     margin-top: 0; /* Entferne oberen Margin, da #conflict-list ihn hat */
     margin-bottom: 10px; /* Abstand zur Liste */
}

#conflict-list ul {
    list-style: none;
    padding: 0;
    /* ALT: max-height: 400px; */ /* Entfernen oder auskommentieren */

    /* NEU: Flex-Wachstum und Scrolling */
    flex-grow: 1; /* Nimmt verfügbaren Platz im #conflict-list ein */
    overflow-y: auto; /* Scrollbar, wenn Inhalt zu lang */
    min-height: 0; /* WICHTIG: Erlaubt Schrumpfen unter die Inhaltsgrösse */

    /* Bestehende Styles beibehalten */
    margin: 0; /* Entferne Standard-ul-Margin */
}

#conflict-list li {
    background-color: #fff0f5;
    margin-bottom: 8px;
    padding: 8px 12px;
    border: 1px solid #ffb6c1;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.9em;
}
#conflict-list li:hover {
    background-color: #ffc0cb;
}
#conflict-list li strong {
    color: #dc143c;
}
#conflict-list li.non-clickable {
     cursor: default;
     background-color: #f8f8f8;
     border-color: #ddd;
}
#conflict-list li.non-clickable:hover {
    background-color: #f8f8f8;
}

/* Modal Stile */
.modal {
    position: fixed;
    z-index: 1500; /* Zwischen Spiel und Celebration */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    display: flex; /* Enables centering */
    justify-content: center;
    align-items: center;
}

.modal-content {
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive', sans-serif;
    background-color: #fefefe;
    margin: auto; /* Important for centering */
    padding: 30px;
    border: 3px solid #888;
    border-radius: 15px;
    width: 80%;
    max-width: 550px; /* Standardbreite für Modals */
    box-shadow: 5px 5px 15px rgba(0,0,0,0.3);
    position: relative;
    color: #333;
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
}

/* Config, Add Class, Redistribute Modal Specific Styles */
#config-modal label, #add-class-modal label, #redistribute-modal label {
    display: block;
    margin-top: 12px;
    margin-bottom: 3px;
    font-weight: bold;
    color: #4682b4;
}
#config-modal input[type="number"],
#add-class-modal select,
#redistribute-modal select,
#school-assignment-select { /* Auch das Select im Student-Modal */
    width: 100%;
    padding: 8px;
    border: 2px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box; /* Include padding in width */
    font-family: inherit;
    font-size: 1em;
    margin-bottom: 10px; /* Abstand nach unten */
}
#config-modal button[type="button"], /* Nur den Button im Form */
#add-class-modal button,
#redistribute-modal button,
#confirm-assignment-button { /* Auch den Bestätigungsbutton im Student-Modal */
    margin-top: 15px; /* Mehr Platz vor Button */
    width: 100%;
}


#modal-student-info {
    margin-bottom: 15px;
    font-size: 1.1em;
    line-height: 1.4;
}

/* Style für alle Feedback-Paragraphen in Modals */
#modal-feedback, #config-feedback, #add-class-feedback, #redistribute-feedback {
    margin-top: 15px;
    font-weight: bold;
    min-height: 1.2em; /* Verhindert Springen des Layouts */
}
.feedback.success {
    color: green;
}
.feedback.error {
    color: red;
}
.feedback.info {
    color: #4682b4; /* Blau für Info */
    font-weight: normal;
}

/* Allgemeine Labels (falls nicht im Modal) */
label {
    display: block;
    margin-top: 10px;
    font-weight: bold;
     color: #4682b4;
}

/* Allgemeine Selects (falls nicht im Modal oder oben gestyled) */
select {
     font-family: inherit;
     padding: 8px;
     border: 2px solid #ccc;
     border-radius: 5px;
     margin-top: 5px;
     margin-bottom: 15px;
     width: 100%;
     box-sizing: border-box;
}


/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
    border-radius: 5px;
}
.leaflet-popup-content {
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive', sans-serif;
    font-size: 1em;
}

/* Klickbare Konflikte in Detailansicht */
.clickable-conflict{
	color:red;
    cursor: pointer;
    text-decoration: underline;
}
.clickable-conflict:hover{
    color: darkred;
}


/* Benachrichtigungs-Styling */
#notification-area {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9999; /* Über fast allem */
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 300px; /* Maximale Breite */
}

.notification {
    padding: 15px;
    border-radius: 8px;
    color: white;
    font-family: sans-serif; /* Besser lesbare Schrift */
    font-size: 0.9em;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.3);
    opacity: 0.9;
    transition: opacity 0.5s ease-out; /* Fade-Out Effekt */
}

.notification.success {
    background-color: #28a745; /* Grün */
}

.notification.error {
    background-color: #dc3545; /* Rot */
}
.notification.info {
    background-color: #17a2b8; /* Türkis/Blau für Info */
}

/* Footer unter der Karte */
.map-footer-info {
    margin-top: 15px;
    padding: 10px 15px;
    background-color: #f0f0f0;
    border-radius: 5px;
    border: 1px solid #ddd;
    display: flex;
    justify-content: center; /* Zentriert die Gruppen */
    align-items: center;
    flex-wrap: wrap;
    gap: 10px; /* Abstand zwischen den Gruppen */
}

.map-footer-group {
    display: flex;
    align-items: center;
    gap: 10px; /* Abstand zwischen Text und Button */
}

.map-footer-group p {
    margin: 0;
    font-size: 0.95em;
}

.map-footer-group button {
     padding: 6px 12px;
     font-size: 0.9em;
     margin: 0; /* Button-Margin entfernen */
     background-color: #6c757d; /* Grau */
     border-color: #5a6268;
}
.map-footer-group button:hover {
    background-color: #5a6268;
}

/* Import/Export Buttons Container */
.io-button-group {
    margin-top: 15px;
    padding: 10px 15px;
    background-color: #f0f0f0;
    border-radius: 5px;
    border: 1px solid #ddd;
    display: flex;
    justify-content: center; /* Zentriert die Gruppen */
    align-items: center;
    flex-wrap: wrap;
    gap: 10px; /* Abstand zwischen den Gruppen */
}
 .io-button-group button {
	padding: 6px 12px;
    font-size: 0.9em;
    margin: 0;
    background-color: #6c757d;
    border-color: #5a6268;
 }
 .io-button-group button:hover {
     background-color: #525d68;
 }

 /* Verstecktes File Input */
 #import-excel-input {
     display: none;
 }


 /* Style für Celebration Overlay */
#celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 128, 0, 0.85); /* Halbtransparentes Grün, etwas deckender */
    z-index: 3000; /* Über allem anderen */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    /* Simple Animation */
    animation: fadeInCelebration 1s ease-in-out;
}
#celebration-overlay h2 {
    font-size: 3em;
    color: #fff; /* Überschreibt Standardfarbe */
    text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    margin-bottom: 20px;
     border-bottom: none; /* Keine Linie */
}
 #celebration-overlay p {
     font-size: 1.5em;
     margin-bottom: 30px;
 }
 #celebration-overlay button {
     font-size: 1.2em;
     padding: 15px 30px;
     background-color: #ffcc00; /* Goldgelb */
     color: #333;
     border-color: #cca300;
     margin: 10px; /* Abstand zwischen Buttons hinzugefügt */
 }
 #celebration-overlay button:hover {
     background-color: #e6b800;
 }
 /* Spezifisches Styling, falls nötig (optional) */
 #close-celebration-button {
     background-color: #77dd77; /* Helleres Grün */
     border-color: #5cb85c;
 }
 #close-celebration-button:hover {
     background-color: #5cb85c;
 }
 #restart-scenario-button {
     background-color: #ff6961; /* Hellrot */
     border-color: #d9534f;
     color: white;
 }
 #restart-scenario-button:hover {
     background-color: #d9534f;
 }


@keyframes fadeInCelebration {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* --- Copyright Footer --- */
.footer-copyright {
	bottom: 20px;
	right: auto; width: auto;
    text-align: center;
	position: absolute;
	bottom: 0px;
}
.footer-copyright p {
	margin-top: 20px;
    font-size: 0.7em; color: #000000;
    line-height: 1.2; /* Adjust line spacing */
    text-shadow: 1px 1px 1px #ffffff;
}