/* ================= CHAT COMMUNITY STYLES ================= */

/* Group Chat Window */
.group-chat-window {
    position: fixed;
    bottom: 0;
    right: 400px;
    width: 400px;
    height: 600px;
    background: var(--color-surface);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
}

.group-chat-header {
    padding: 1rem;
    background: var(--color-primary);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.125rem;
}

.group-chat-close {
    background: none;
    border: none;
    color: var(--color-text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.group-chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.group-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.group-message-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.group-message-item.sent {
    align-items: flex-end;
}

.group-message-item.received {
    align-items: flex-start;
}

.message-sender-name {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.message-content-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: 80%;
}

.group-message-item.sent .message-content-wrapper {
    flex-direction: row-reverse;
}

.message-content {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.group-message-item.sent .message-content {
    background: var(--color-accent);
    color: white;
}

.group-message-item.received .message-content {
    background: rgba(30, 41, 59, 0.5);
    color: var(--color-text-primary);
}

.message-time {
    font-size: 0.7rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

.group-chat-input {
    padding: 1rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.group-chat-input textarea {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    outline: none;
}

.group-chat-input textarea:focus {
    border-color: var(--color-accent);
}

.group-chat-input button {
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.group-chat-input button:hover {
    background: #3b82f6;
}

.empty-conversation {
    text-align: center;
    color: var(--color-text-secondary);
    padding: 2rem;
    font-size: 0.9rem;
}

.group-member {
    opacity: 1;
}

.btn-create-group {
    background: var(--color-accent) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 0.5rem !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    transition: background 0.2s !important;
}

.btn-create-group:hover {
    background: #3b82f6 !important;
}

/* Loading Spinner */
.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Groups Selection Modal */
.chat-groups-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.chat-groups-modal-content {
    background: var(--color-surface);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.chat-groups-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-groups-modal-header h3 {
    margin: 0;
    color: var(--color-text-primary);
}

.chat-groups-modal-header button {
    background: none;
    border: none;
    color: var(--color-text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.chat-groups-modal-header button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-groups-modal-body {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

.group-selection-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 0.5rem;
}

.group-selection-item:hover {
    background: rgba(59, 130, 246, 0.1);
}

.group-selection-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.group-selection-item > div:not(.group-selection-avatar) {
    flex: 1;
}

.group-selection-item h4 {
    margin: 0 0 0.25rem 0;
    color: var(--color-text-primary);
    font-size: 1rem;
}

.group-selection-item p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.badge-joined {
    background: var(--color-accent);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-join {
    background: #10b981;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.chat-groups-modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--color-border);
}

.chat-groups-modal-footer button {
    width: 100%;
    padding: 0.75rem;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.chat-groups-modal-footer button:hover {
    background: #3b82f6;
}

/* Responsive */
@media (max-width: 768px) {
    .group-chat-window {
        width: 100%;
        height: 100vh;
        right: 0;
        border-radius: 0;
    }
    
    .chat-groups-modal-content {
        width: 95%;
        max-height: 90vh;
    }
}

