/* Community Space Chat Styling (2025 Redesign) */

.chat-container {
    width: 100%;
    margin: 0;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
    height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: none;
}

.chat-header {
    background: linear-gradient(135deg, #101820, #163029);
    color: #fff;
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-close-btn {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.25rem;
    transition: all 0.2s ease;
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    text-decoration: none;
}

.chat-close-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.15);
}

.chat-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.chat-online-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.22);
    color: #bbf7d0;
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.chat-online-pill::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
}

.chat-messages {
    flex: 1;
    padding: 2rem max(1.5rem, calc((100% - 900px) / 2));
    overflow-y: auto;
    background: #f8f7ff;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-row {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
}

.message-row.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-row.received { align-self: flex-start; }

.message-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #f7f3ea; color: #2a9d8f;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem;
    flex-shrink: 0; margin-top: 1.5rem;
    border: 1.5px solid #e8f3f0;
    position: relative;
}

.message-avatar.is-online::after {
    content: '';
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    background: #22c55e;
    border: 2px solid #f8f7ff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.35);
}

.message-row.sent .message-avatar.is-online::after {
    border-color: #101820;
}

.message-row.sent .message-avatar {
    background: linear-gradient(135deg, #1d6f65, #2a9d8f);
    color: #fff; border-color: transparent;
}

.message-content { display: flex; flex-direction: column; }
.message-row.sent .message-content { align-items: flex-end; }

.message-info { font-size: 0.75rem; color: #6b7280; margin-bottom: 0.25rem; font-weight: 600; }
.message-row.sent .message-info { text-align: right; }

.message-bubble {
    padding: 0.75rem 1.25rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 2px 8px rgba(29, 111, 101, 0.07);
}

.message-row.received .message-bubble {
    background: #fff;
    color: #101820;
    border: 1.5px solid #e8f3f0;
    border-top-left-radius: 4px;
}

.message-row.sent .message-bubble {
    background: linear-gradient(135deg, #101820, #1d6f65);
    color: #fff;
    border-top-right-radius: 4px;
}

.message-time { font-size: 0.65rem; opacity: 0.6; margin-top: 0.25rem; display: block; }

.chat-input-area {
    padding: 1.5rem max(1.5rem, calc((100% - 900px) / 2));
    background: #fff;
    border-top: 1.5px solid #e8f3f0;
    display: flex; gap: 1rem;
}

.chat-input-area input {
    flex: 1; min-width: 0; border: 1.5px solid #e8f3f0;
    border-radius: 999px;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem; outline: none;
    transition: all 0.2s ease; background: #f8f7ff; color: #101820;
}

.chat-input-area input:focus {
    border-color: #2a9d8f;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.12);
}

.chat-send-btn {
    background: linear-gradient(135deg, #1d6f65, #2a9d8f);
    color: #fff; border: none;
    padding: 0.75rem 1.75rem;
    border-radius: 999px; font-weight: 700;
    cursor: pointer; transition: all 0.2s ease;
    display: flex; align-items: center; gap: 0.5rem;
    flex-shrink: 0; white-space: nowrap;
    box-shadow: 0 4px 12px rgba(29, 111, 101, 0.25);
}

.chat-send-btn:hover {
    background: linear-gradient(135deg, #163029, #1d6f65);
    transform: scale(1.03);
}

.chat-send-btn i { font-size: 1.1rem; }

.admin-badge {
    background: #e11d48; color: #fff;
    padding: 1px 6px; border-radius: 4px;
    font-size: 0.65rem; text-transform: uppercase;
    margin-left: 0.4rem; vertical-align: middle;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #b8d4ce; border-radius: 10px; }

@media (max-width: 768px) {
    .message-row { max-width: 90%; }
    .chat-input-area { padding: 1rem; gap: 0.5rem; }
    .chat-input-area input { padding: 0.65rem 1.1rem; }
    .chat-send-btn { padding: 0.65rem 1rem; }
}

@media (max-width: 420px) {
    .chat-send-btn span { display: none; }
    .chat-send-btn { padding: 0.65rem 0.9rem; }
}
