/* Allgemeine Einstellungen */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background: #f7f9fc;
    color: #333;
}

/* Container für den Chat */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px;
    box-sizing: border-box;
}

/* Chat-Box */
.chat-box {
    width: 100%;
    max-width: 600px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Titel des Chats */
.chat-title {
    font-size: 24px;
    text-align: center;
    color: #007BFF;
    margin-bottom: 20px;
}

/* Nachrichtenbereich */
.messages {
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Nachrichten erscheinen unten */
    height: 600px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    background: #f9f9f9;
    scroll-behavior: smooth; /* Sanftes Scrollen */
    word-wrap: break-word; /* Lange Wörter umbrechen */
    word-break: break-word; /* Alternative Umbrüche */
    overflow-wrap: anywhere; /* Unterstützt ältere Browser */
    box-sizing: border-box;
}

/* Einzelne Nachricht */
.message {
    margin-bottom: 10px;
    padding: 5px;
    border-bottom: 1px solid #eee;
    font-weight: normal; /* Text wird normal angezeigt */
    color: inherit; /* Erbt die Farbe der Nachricht */
}

.message span {
    font-weight: normal; /* Kein fettgedruckter Nickname */
    color: inherit; /* Erbt die Farbe */
}

.message small {
    font-size: 0.8em;
    color: #888;
    margin-left: 10px;
}

/* Nachrichtenstil für /me */
.message.me {
    font-weight: bold; /* Fettschrift für /me */
    color: inherit;
    background-color: #f0f8ff;
    padding: 5px;
    border-radius: 4px;
}

/* Anpassbare Farben für Nicknames */
.message .username {
    font-weight: bold;
}

/* Chat-Formular */
.chat-form {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Eingabefelder */
.input {
    flex: 1;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.input:focus {
    border-color: #007BFF;
}

/* Senden-Button */
.send-button {
    background: #007BFF;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s;
    box-sizing: border-box;
}

.send-button:hover {
    background: #0056b3;
}

/* Scrollbar-Styling */
.messages::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 8px;
}

.messages::-webkit-scrollbar-thumb {
    background: #007BFF;
    border-radius: 8px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

/* Fehler-/Erfolgsmeldungen */
.alert {
    font-size: 14px;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Zeitstempel im Chat */
.message-time {
    font-size: 0.75em;
    color: #888;
    text-align: right;
    margin-top: 5px;
}

/* Farbauswahl-Leiste */
.color-picker {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.color-picker button {
    width: 30px;
    height: 30px;
    margin: 5px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.color-picker button:hover {
    transform: scale(1.2);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

/* Responsives Design */
@media (max-width: 768px) {
    .chat-box {
        max-width: 90%;
        padding: 10px;
    }

    .messages {
        height: 300px; /* Kleinere Höhe für Mobilgeräte */
    }

    .chat-form .input {
        font-size: 14px;
    }

    .send-button {
        font-size: 14px;
        padding: 8px 15px;
    }

    .color-picker button {
        width: 25px;
        height: 25px;
    }
}
