/* Grundlegendes Layout */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    line-height: 1.6;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

#chat-container {
    max-width: 100vw;
    width: 100%;
    height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    box-shadow: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Nachrichten-Container */
#messages {
    flex: 1;
    height: auto;
    overflow-y: auto;
    border: none;
    margin-bottom: 0;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

/* Nachrichtentypen */
.message {
    position: relative;
    margin: 8px 0;
    padding: 12px;
    border-radius: 15px;
    max-width: 97%;
    transition: all 0.2s ease;
    background-color: #e9ecef;
}

/* Eigene Nachrichten */
.message.own-message {
    background-color: #007bff;
    color: white;
}

.message.own-message .message-text,
.message.own-message .timestamp,
.message.own-message .username {
    color: white;
}

/* Anpassungen für Benutzer-Nachrichten */


/* Responsive Design für mobile Geräte */
@media (max-width: 768px) {
    #chat-container {
        padding: 0;
    }
    
    .message {
        max-width: 85%;
        margin: 6px 0;
    }
    
    #input-container {
        padding: 10px;
    }
    
    textarea {
        width: calc(100% - 20px);
    }
}

/* Eigene Nachrichten für alle Benutzertypen */

/* Moderator-Nachrichten */
.message.moderator {
    background-color: #d4edda;  /* Hellgrün für Moderator */
}

/* Admin-Nachrichten */
.message.admin {
    background-color: #28a745;  /* Dunkelgrün für Admin */
    color: white;
}

/* Admin eigene Nachrichten */
.message.admin.own-message {
    background-color: #218838;  /* Noch dunkleres Grün für eigene Admin-Nachrichten */
    color: white;
}

/* Textfarben für Admin-Nachrichten */
.message.admin .message-text,
.message.admin .timestamp,
.message.admin .username {
    color: white;
}

/* Links in Nachrichten */
.message-text a {
    color: #0056b3;
    text-decoration: none;
    word-break: break-all;
}

.message-text a:hover {
    text-decoration: underline;
}

/* Links in Admin-Nachrichten */
.message.admin .message-text a {
    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.5);
}

.message.admin .message-text a:hover {
    border-bottom-color: white;
}
.message.system {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 5px;
    background-color: transparent;
}

.message.system.divider {
    border-bottom: 1px solid #ddd;
    margin: 15px 0;
}

/* Nachrichtenkomponenten */
.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.timestamp {
    color: #666;
    font-size: 0.8em;
    margin-right: 10px;
}

.username {
    font-weight: bold;
    color: #333;
}

.message-text {
    word-wrap: break-word;
    white-space: pre-wrap;
    color: #333;
    line-height: 1.4;
}

/* Antwort-Funktionalität */
.reply-button {
    opacity: 0;
    transition: opacity 0.2s;
    padding: 5px 10px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    background-color: #007bff;
    color: white;
}

.message:hover .reply-button {
    opacity: 1;
}

.reply-reference {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
    padding-left: 10px;
    border-left: 3px solid #ccc;
    background-color: rgba(0,0,0,0.03);
    border-radius: 0 4px 4px 0;
}

/* Emoji Picker */
.emoji-picker-button {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s;
}

.emoji-picker-button:hover {
    transform: scale(1.1);
}

.emoji-picker-container {
    position: absolute;
    bottom: 100%;
    right: 0;
    z-index: 1000;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.emoji {
    height: 1.2em;
    width: 1.2em;
    margin: 0 .05em 0 .1em;
    vertical-align: -0.1em;
}

/* Eingabebereich */
#input-container {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: white;
    padding: 15px;
    border-top: 1px solid #eee;
    margin-top: 0;
    box-sizing: border-box;
}

.textarea-wrapper {
    width: 100%;
    box-sizing: border-box;
}

.textarea-toolbar {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    gap: 10px;
}

textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.input-hint {
    display: block;
    color: #666;
    font-size: 0.8em;
    margin-top: 4px;
}

/* Buttons */
button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

button:hover {
    opacity: 0.9;
}

#send-button {
    background-color: #007bff;
    color: white;
    margin-top: 10px;
}

/* Admin/Moderator Kontrollen */
.controls {
    background-color: #f8f9fa;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.controls h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    font-size: 1.1em;
}

#admin-controls button {
    background-color: #28a745;
    color: white;
    margin-right: 10px;
}

#admin-controls button:hover {
    background-color: #218838;
}

#mod-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #495057;
}

#mod-controls input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 10000;
}

.modal-content {
    position: relative;
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

/* Fehlermeldungen */
.rate-limit-message {
    color: #dc3545;
    font-size: 0.9em;
    margin-top: 5px;
    text-align: center;
    padding: 8px;
    background-color: #fff3f4;
    border-radius: 4px;
    border: 1px solid #ffdce0;
}

.system-message {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 5px;
    margin: 5px 0;
    background-color: rgba(0,0,0,0.05);
    border-radius: 4px;
}

.private-message {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
}

.private-message .message-text {
    font-style: italic;
}

.reply-info {
    font-size: 0.8em;
    color: #666;
    margin-top: 4px;
}

.mod-message {
    background-color: #d4edda;
    border-left: 4px solid #28a745;
}

/* Gelesen/Ungelesen Button Styles */
.read-status-button {
    position: absolute;
    bottom: 5px;
    right: 5px;
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.read-status-button.unread {
    background-color: #dc3545;
    color: white;
}

.read-status-button.read {
    background-color: #28a745;
    color: black;
}

.message.read {
    background-image: repeating-linear-gradient(
        45deg,
        rgba(0, 0, 0, 0.05),
        rgba(0, 0, 0, 0.05) 10px,
        rgba(0, 0, 0, 0.1) 10px,
        rgba(0, 0, 0, 0.1) 20px
    );
}


