/* Synora Community Chat Styles */

:root {
    --primary-color: #ffffff;
    --bg-dark: #0a0a0a;
    --bg-card: #141414;
    --bg-hover: #1f1f1f;
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);
    --border-color: rgba(255, 255, 255, 0.1);
    --accent-color: #3b82f6;
    --danger-color: #ef4444;
    --success-color: #22c55e;
    --header-height: 60px;
    --sidebar-width: 350px;
}

.community-container {
    height: calc(100vh - var(--header-height));
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    animation: fadeIn 0.5s ease-out;
}

.community-app {
    width: 100%;
    height: 100%;
    display: flex;
    background: var(--bg-dark);
    position: relative;
}

/* Sidebar / Groups List */
.community-sidebar {
    width: var(--sidebar-width);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.community-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.community-sidebar-header h2 {
    margin: 0;
    font-family: 'Syne', sans-serif;
    font-size: 24px;
    letter-spacing: -1px;
    line-height: 1;
}

.community-sidebar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.community-sidebar-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.community-sidebar-actions button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.community-user-badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 6px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.community-search {
    position: relative;
    padding: 15px 20px;
}

.community-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.community-search input {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 12px 12px 40px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.community-search input:focus {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}

.community-groups-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.community-group-item {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    gap: 16px;
    border-left: 3px solid transparent;
}

.community-group-item:hover {
    background: var(--bg-hover);
}

.community-group-item.active {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--primary-color);
}

.community-group-avatar {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--bg-dark);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.community-group-info {
    flex: 1;
    min-width: 0;
}

.community-group-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.community-group-name {
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.community-group-time {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.community-group-preview {
    font-size: 14px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.community-group-preview.unread-preview {
    color: var(--text-main);
    font-weight: 600;
}

.community-unread-dot {
    width: 10px;
    height: 10px;
    background: var(--accent-color);
    border-radius: 50%;
    position: absolute;
    right: 24px;
    bottom: 20px;
    box-shadow: 0 0 10px var(--accent-color);
}

.community-pin-icon {
    font-size: 10px;
    transform: rotate(45deg);
}

.community-group-menu-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.community-group-item:hover .community-group-menu-btn {
    opacity: 1;
}

/* Chat Area */
.community-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    position: relative;
    min-width: 0; /* Prevents overflow in flex items */
}

.community-chat-header {
    height: 80px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
    z-index: 5;
    gap: 16px;
}

.community-back-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 18px;
    cursor: pointer;
}

.community-chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-dark);
}

.community-chat-header-info {
    flex: 1;
}

.community-chat-header-info h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.community-chat-header-info p {
    margin: 2px 0 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.community-chat-header-actions {
    display: flex;
    gap: 8px;
}

.community-message-search-btn, .community-header-menu-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.community-message-search-btn:hover, .community-header-menu-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.community-message-search-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    z-index: 10;
}

.community-message-search-bar input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 16px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
}

.community-message-search-bar input:focus {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.08);
}

.community-message-search-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
    border-radius: 8px;
}

.community-message-search-close:hover {
    color: var(--text-main);
}

.community-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Message Styles (Refined) */
.community-message-with-avatar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: flex-end;
}

.community-message-with-avatar.outgoing {
    flex-direction: row-reverse;
}

.community-message-avatar-fallback {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    flex-shrink: 0;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.community-message {
    max-width: 75%;
    display: flex;
    flex-direction: column;
}

.community-message.outgoing {
    align-items: flex-end;
}

.community-message.incoming {
    align-items: flex-start;
}

.community-message-body {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.community-message.outgoing .community-message-body {
    background: linear-gradient(135deg, var(--primary-color) 0%, #f0f0f0 100%);
    color: #000;
    border-bottom-right-radius: 4px;
}

.community-message.incoming .community-message-body {
    background: linear-gradient(135deg, var(--bg-card) 0%, #1a1a1a 100%);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.community-message-meta {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.community-message-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.community-message:hover .community-message-actions {
    opacity: 1;
}

.community-message-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.community-message-action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.community-message-reply {
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid var(--accent-color);
    padding: 5px 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.community-message-reply-sender {
    font-weight: 700;
    margin-bottom: 2px;
}

.community-message-media img, 
.community-message-media video {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 5px;
    cursor: pointer;
}

/* Input Area */
.community-input-container {
    padding: 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
}

.community-reply-bar {
    display: none;
    align-items: center;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px 8px 0 0;
    margin-bottom: -1px;
    border: 1px solid var(--border-color);
    border-bottom: none;
}

.community-reply-bar.active {
    display: flex;
}

.community-reply-bar-info {
    flex: 1;
    min-width: 0;
}

.community-reply-bar-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-color);
}

.community-reply-bar-preview {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.community-reply-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
}

.community-input-area {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 10px 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.community-input-area:focus-within {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
}

/* Input Area Buttons */
.community-attach-btn, 
.community-voice-btn, 
.community-emoji-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.community-attach-btn::before, 
.community-voice-btn::before, 
.community-emoji-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: 0.5s;
}

.community-attach-btn:hover::before, 
.community-voice-btn:hover::before, 
.community-emoji-btn:hover::before {
    left: 100%;
}

.community-attach-btn:hover, 
.community-voice-btn:hover, 
.community-emoji-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-main);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.community-attach-btn:active, 
.community-voice-btn:active, 
.community-emoji-btn:active {
    transform: translateY(0);
}

/* Voice recording state */
.community-voice-btn.recording {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.community-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-main);
    outline: none;
    font-size: 15px;
    transition: all 0.3s;
}

.community-input-area input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Unified Modals & Overlays */
.community-profile-overlay,
.community-rename-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

.community-profile-modal,
.community-rename-modal {
    background: rgba(20, 20, 20, 0.85);
    background-image: radial-gradient(at top left, rgba(255, 255, 255, 0.05), transparent);
    width: 90%;
    max-width: 480px;
    padding: 32px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.community-profile-modal-close,
.community-rename-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.community-profile-modal-close:hover,
.community-rename-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    transform: rotate(90deg);
}

.community-profile-form-group,
.community-rename-form-group {
    margin-bottom: 24px;
}

.community-profile-form-group label,
.community-rename-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.community-profile-form-group input,
.community-profile-form-group textarea,
.community-rename-modal input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 14px 18px;
    color: var(--text-main);
    outline: none;
    font-size: 15px;
    transition: all 0.3s;
}

.community-profile-form-group input:focus,
.community-profile-form-group textarea:focus,
.community-rename-modal input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.community-rename-save,
.community-profile-save {
    width: 100%;
    background: var(--primary-color);
    color: #000;
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.community-rename-save:hover,
.community-profile-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.1);
    filter: brightness(1.1);
}

.community-rename-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

.community-rename-cancel {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.community-rename-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.community-rename-save {
    flex: 2;
}

/* Specific Modal Enhancements */

/* 1. Profile Modal (User Focus) */
.community-profile-modal {
    max-width: 440px;
    border-top: 4px solid var(--accent-color);
    background-image: 
        radial-gradient(at top right, rgba(59, 130, 246, 0.1), transparent 70%),
        radial-gradient(at top left, rgba(255, 255, 255, 0.05), transparent);
}

.community-profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 30px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    color: #000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border: 3px solid rgba(255,255,255,0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.community-profile-avatar-large:hover {
    transform: rotate(5deg) scale(1.05);
    border-color: var(--accent-color);
}

.community-profile-name {
    text-align: center;
    font-family: 'Syne', sans-serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 5px;
}

.community-profile-title {
    text-align: center;
    color: var(--accent-color);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 20px;
}

/* 2. Rename/Edit Group Modal (Action Focus) */
.community-rename-modal {
    max-width: 400px;
    border-left: 4px solid var(--primary-color);
}

.community-rename-modal h3 {
    font-size: 22px;
    letter-spacing: -0.5px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.community-rename-modal h3::before {
    content: '\f303';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 16px;
    color: var(--text-muted);
}

/* 3. Color Picker (Specialized UI) */
.community-profile-color-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.community-profile-color-option {
    height: 35px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.community-profile-color-option:hover {
    transform: scale(1.1);
}

.community-profile-color-option.selected {
    border-color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.community-profile-color-option.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #000;
    font-size: 12px;
}

/* Unified Button Enhancements */
.community-rename-save,
.community-profile-save,
.community-rename-cancel {
    position: relative;
    overflow: hidden;
}

.community-rename-save::after,
.community-profile-save::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.community-rename-save:hover::after,
.community-profile-save:hover::after {
    left: 100%;
}

/* Glassmorphism for inputs */
.community-profile-form-group input,
.community-profile-form-group textarea,
.community-rename-modal input,
.community-input-area input {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.community-login-error {
    color: var(--danger-color);
    font-size: 12px;
    margin-bottom: 15px;
}

/* Enhanced Send Button */
.community-send-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-color), #2563eb) !important;
    border: none !important;
    color: white !important;
    border-radius: 14px !important;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4) !important;
    position: relative;
    overflow: hidden;
}

.community-send-btn i {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.community-send-btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5) !important;
    filter: brightness(1.1);
}

.community-send-btn:hover i {
    transform: rotate(-10deg) scale(1.1);
}

.community-send-btn:active {
    transform: scale(0.95) translateY(0);
}

.community-send-btn:disabled {
    background: rgba(255, 255, 255, 0.05) !important;
    color: rgba(255, 255, 255, 0.2) !important;
    box-shadow: none !important;
    cursor: not-allowed;
    transform: none !important;
}

/* Enhanced Voice Preview Bar */
.community-voice-preview {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(239, 68, 68, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    margin-bottom: -1px;
    animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 5;
}

.community-voice-preview.active {
    display: flex;
}

.community-voice-preview-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    font-weight: 500;
    font-size: 14px;
}

.community-voice-preview-indicator {
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    animation: voice-pulse 1.2s infinite;
}

@keyframes voice-pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 15px rgba(239, 68, 68, 0.8); }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.community-voice-timer {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    color: #ef4444;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: 4px;
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Refined Media Preview Cancel Button (Universal) */
.community-media-preview-cancel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.community-media-preview-cancel:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    transform: rotate(90deg);
}

/* Typing Indicator */
.community-emoji-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.community-emoji-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.community-emoji-picker {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: slideUp 0.2s ease-out;
}

.community-emoji-option {
    font-size: 22px;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.community-emoji-option:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.community-typing-indicator {
    padding: 5px 20px;
    font-size: 12px;
    color: var(--text-muted);
    height: 20px;
    transition: opacity 0.3s;
    opacity: 0;
}

.community-typing-indicator.active {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .community-sidebar {
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
    }

    .community-app.show-chat .community-sidebar {
        transform: translateX(-100%);
    }

    .community-chat {
        width: 100%;
    }

    .community-back-btn {
        display: block;
    }
}

/* Date Divider */
.community-date-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    gap: 15px;
}

.community-date-divider::before,
.community-date-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.community-date-text {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Empty State */
.community-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
}

.community-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.15;
}

.community-empty-state h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: var(--text-main);
    font-family: 'Syne', sans-serif;
    letter-spacing: -0.5px;
}

.community-empty-state p {
    font-size: 14px;
    max-width: 280px;
}

/* Profile System Styles */
.community-profile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.community-profile-modal {
    background: var(--bg-card);
    width: 90%;
    max-width: 450px;
    padding: 40px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    text-align: center;
}

.community-profile-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.community-profile-modal-close:hover {
    color: var(--text-main);
}

.community-profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 800;
    color: #000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.community-profile-name {
    font-size: 28px;
    font-family: 'Syne', sans-serif;
    margin-bottom: 8px;
}

.community-profile-title {
    font-size: 16px;
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 16px;
}

.community-profile-bio {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
}

.community-profile-form {
    text-align: left;
}

.community-profile-form-group {
    margin-bottom: 20px;
}

.community-profile-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.community-profile-form-group input,
.community-profile-form-group textarea {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-main);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.community-profile-form-group textarea {
    height: 100px;
    resize: none;
}

.community-profile-form-group input:focus,
.community-profile-form-group textarea:focus {
    border-color: var(--accent-color);
}

.community-profile-color-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.community-profile-color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}

.community-profile-color-option:hover {
    transform: scale(1.1);
}

.community-profile-color-option.selected {
    border-color: var(--text-main);
    transform: scale(1.1);
}

/* Context Menu */
.community-context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    min-width: 180px;
    display: flex;
    flex-direction: column;
}

.community-context-menu button {
    background: none;
    border: none;
    color: var(--text-main);
    padding: 10px 14px;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.community-context-menu button:hover {
    background: var(--bg-hover);
}

.community-context-menu button i {
    font-size: 14px;
    width: 16px;
    color: var(--text-muted);
}

.community-context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-main);
    transition: background 0.2s;
}

.community-context-menu-item:hover {
    background: var(--bg-hover);
}

.community-context-menu-item.danger {
    color: var(--danger-color);
}

/* Blocked Screen */
.community-blocked-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    background: var(--bg-dark);
    color: var(--text-main);
}

.community-blocked-screen i {
    font-size: 80px;
    color: var(--danger-color);
    margin-bottom: 24px;
}

.community-blocked-screen h3 {
    font-size: 28px;
    margin-bottom: 16px;
    font-family: 'Syne', sans-serif;
}

.community-blocked-screen p {
    color: var(--text-muted);
    max-width: 400px;
    margin-bottom: 12px;
}

.community-blocked-note {
    font-size: 13px;
    font-style: italic;
    margin-top: 10px;
}

.community-blocked-contact {
    margin-top: 30px;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

/* Voice & Media */
.community-voice-btn.recording {
    color: var(--danger-color);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.community-voice-preview,
.community-media-preview {
    display: none;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
}

.community-voice-preview.active,
.community-media-preview.active {
    display: flex;
    align-items: center;
    gap: 10px;
}

.community-message-audio audio {
    max-width: 100%;
    height: 35px;
    margin-top: 5px;
}

/* Skeleton Loaders */
.community-skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.community-group-skeleton {
    padding: 15px 20px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.community-group-skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}

.community-group-skeleton-info {
    flex: 1;
}

.community-group-skeleton-name {
    width: 60%;
    height: 16px;
    margin-bottom: 8px;
}

.community-group-skeleton-preview {
    width: 80%;
    height: 12px;
}

.community-message-skeleton {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.community-message-skeleton.outgoing {
    flex-direction: row-reverse;
}

.community-message-skeleton-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.community-message-skeleton-content {
    width: 200px;
    height: 60px;
    border-radius: 12px;
}

.community-message-skeleton.outgoing .community-message-skeleton-content {
    border-bottom-right-radius: 2px;
}

.community-message-skeleton.incoming .community-message-skeleton-content {
    border-bottom-left-radius: 2px;
}

