/* nostr-chat.css - Styles for the Nostr chat component */

/* Chat container */
#nostr-chat-container {
    font-family: Arial, sans-serif;
    max-width: 100%;
    margin: 0 auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Message tile */
.message-tile {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

/* Chat messages container */
#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
}

/* Loading indicator */
#loading-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
    background-color: #f9f9f9;
}

.loading-circle {
    width: 30px;
    height: 30px;
    border: 3px solid #ddd;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Chat message */
.chat-message {
    padding: 12px;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word;
    margin-bottom: 10px;
    background-color: #f9f9f9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Message container with avatar and content */
.message-container {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    width: 100%;
}

/* Avatar container */
.avatar-container {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}

/* Avatar */
.avatar, .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: white;
    background-color: #3498db;
    overflow: hidden;
}

/* Avatar image */
.avatar-img, .user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Content container */
.content-container {
    flex: 1;
    min-width: 0; /* Verhindert Überlauf bei langen Wörtern */
}

/* Avatar colors */
.avatar-color-0 { background-color: #3498db; }
.avatar-color-1 { background-color: #e74c3c; }
.avatar-color-2 { background-color: #2ecc71; }
.avatar-color-3 { background-color: #f39c12; }
.avatar-color-4 { background-color: #9b59b6; }
.avatar-color-5 { background-color: #1abc9c; }
.avatar-color-6 { background-color: #e67e22; }
.avatar-color-7 { background-color: #34495e; }
.avatar-color-8 { background-color: #16a085; }
.avatar-color-9 { background-color: #d35400; }

/* Content container */
.content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Self message (right-aligned) */
.chat-message.self {
    align-self: flex-end;
    background-color: #2c7873; /* Dunkleres Grün für besseren Kontrast */
    margin-left: auto;
    color: white; /* Weißer Text für besseren Kontrast */
}

.chat-message.self .message-container {
    flex-direction: row-reverse;
}

.chat-message.self .message-header {
    flex-direction: row-reverse;
}

/* Anpassen der Farben für Links in eigenen Nachrichten */
.chat-message.self a {
    color: #a8e6cf; /* Hellere Farbe für Links */
}

/* Anpassen der Farben für Benutzernamen in eigenen Nachrichten */
.chat-message.self .username {
    color: #dce8e0; /* Hellere Farbe für Benutzernamen */
}

/* Anpassen der Farben für Zeitstempel in eigenen Nachrichten */
.chat-message.self .timestamp {
    color: #dce8e0; /* Hellere Farbe für Zeitstempel */
}

/* Others message (left-aligned) */
.chat-message.others {
    align-self: flex-start;
    background-color: white;
    margin-right: auto;
}

/* Chat header with username and timestamp */
.chat-header, .message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    margin-bottom: 8px;
}

/* Username */
.chat-username, .username {
    font-weight: bold;
    color: #3498db;
}

/* Timestamp */
.chat-timestamp, .timestamp {
    color: #999;
    font-size: 0.8em;
}

/* Chat content */
.chat-content, .message-content, .message-text {
    line-height: 1.5;
}

/* Message text */
.message-text {
    margin-top: 5px;
}

/* Message reactions */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

/* Reaction */
.reaction {
    display: inline-flex;
    align-items: center;
    background-color: #f0f0f0;
    border-radius: 12px;
    padding: 3px 8px;
    font-size: 0.9em;
    cursor: pointer;
}

/* Reaction count */
.reaction-count {
    margin-left: 4px;
    font-size: 0.8em;
    color: #666;
}

/* Reaction button */
.reaction-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 2px 5px;
    margin-top: 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

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

/* Emoji picker */
.emoji-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

/* Emoji button */
.emoji-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5em;
    padding: 5px;
    transition: transform 0.1s;
}

.emoji-button:hover {
    transform: scale(1.2);
}

/* Chat image container */
.chat-image-container {
    margin: 10px 0;
    position: relative;
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f0f0f0;
}

/* Chat image */
.chat-image, .message-image {
    max-width: 100%;
    max-height: 300px;
    display: block;
    border-radius: 8px;
    transition: opacity 0.3s ease;
    margin-top: 10px;
}

/* Image loading indicator */
.image-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.7);
}

/* Image URL text */
.chat-image-url {
    display: block;
    font-size: 0.8em;
    color: #666;
    margin-top: 5px;
    word-break: break-all;
    text-decoration: none;
}

.chat-image-url:hover {
    text-decoration: underline;
}

/* Chat input container */
#chat-input-container {
    display: flex;
    padding: 10px;
    background-color: white;
    border-top: 1px solid #ddd;
}

/* Chat input */
#chat-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    margin-right: 10px;
}

/* Send button */
#chat-send-button {
    padding: 10px 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

#chat-send-button:hover {
    background-color: #2980b9;
}

/* Login container */
#nostr-login-container {
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    text-align: center;
}

/* Login buttons */
.login-button {
    padding: 10px 15px;
    margin: 5px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.login-button:hover {
    background-color: #2980b9;
}

/* Reset identity trigger */
#reset-identity-trigger {
    cursor: pointer;
    color: #3498db;
    text-decoration: underline;
}

#reset-identity-trigger:hover {
    color: #2980b9;
}
