* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-container {
    width: 100%;
    max-width: 420px;
}
.auth-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 40px;
    animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.logo {
    text-align: center;
    margin-bottom: 30px;
}
.logo-icon {
    font-size: 48px;
    margin-bottom: 10px;
}
.logo h1 {
    font-size: 28px;
    color: #1a1a2e;
    font-weight: 700;
}
.logo p {
    color: #6b7280;
    font-size: 14px;
    margin-top: 5px;
}
.tabs {
    display: flex;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 30px;
}
.tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
}
.tab.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}
.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.2s;
}
.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}
.btn-primary:active {
    transform: translateY(0);
}
.message {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    animation: fadeIn 0.3s;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.hidden { display: none !important; }

/* Chat Interface */
.chat-container {
    display: flex;
    width: 100%;
    height: 92vh;
    max-width: 1530px;
    margin: 20px auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    position: relative;
}
.sidebar {
    width: 380px;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e5e7eb;
    overflow: hidden;
}
.sidebar-header {
    padding: 20px;
    background: #667eea;
    color: white;
    flex-shrink: 0;
}
.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}
.user-profile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 12px;
    width: fit-content;
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.5);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.user-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.user-name {
    font-size: 15px;
    font-weight: 500;
    color: white;
    white-space: nowrap;
}
.dropdown-arrow {
    font-size: 10px;
    color: rgba(255,255,255,0.7);
    margin-left: 2px;
    flex-shrink: 0;
}
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: -60px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    min-width: 160px;
    overflow: hidden;
    z-index: 2000;
}
.dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.2s;
}
.dropdown-item:hover {
    background: #f8f9fa;
}
.search-container {
    padding: 12px 20px;
    flex-shrink: 0;
}
.search-box {
    position: relative;
}
.search-box input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid #d1d5db;
    border-radius: 25px;
    font-size: 14px;
    background: white;
    color: #333;
}
.search-box input::placeholder {
    color: #9ca3af;
}
.search-box input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}
.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}
.sidebar-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.sidebar-tab {
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s;
    white-space: nowrap;
}
.sidebar-tab.active {
    background: #667eea;
    color: white;
}
.list-container {
    flex: 1;
    overflow-y: auto;
}
.list-item {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}
.list-item:hover {
    background: #f9fafb;
}
.list-item.active {
    background: #dbeafe;
}
.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.3);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.item-info {
    flex: 1;
    min-width: 0;
}
.item-name {
    font-weight: 600;
    color: #1a1a2e;
    font-size: 15px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item-subtitle {
    color: #6b7280;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item-meta {
    text-align: right;
    font-size: 11px;
    color: #9ca3af;
    flex-shrink: 0;
    margin-left: 8px;
}
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #efe7dd;
    position: relative;
}
.chat-header {
    padding: 16px 24px;
    background: #f0f2f5;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 16px;
}
.chat-header .avatar {
    width: 40px;
    height: 40px;
    font-size: 15px;
}
.chat-header-info {
    flex: 1;
}
.chat-header-name {
    font-weight: 600;
    color: #1a1a2e;
    font-size: 16px;
}
.chat-header-status {
    color: #6b7280;
    font-size: 13px;
}
.chat-view-profile {
    font-size: 12px;
    color: #667eea;
    cursor: pointer;
    margin-top: 2px;
    transition: color 0.2s;
}
.chat-view-profile:hover {
    color: #5568d3;
    text-decoration: underline;
}
.chat-header-menu {
    display: flex;
    align-items: center;
    margin-left: auto;
}
.chat-menu-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #667eea;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-menu-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.1);
}
.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    text-align: center;
    padding: 20px;
}
.chat-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d1d5db' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.message-bubble {
    max-width: 65%;
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
    animation: messageSlide 0.3s ease-out;
}
@keyframes messageSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.message-bubble.sent {
    align-self: flex-end;
    background: #d9fdd3;
    border-top-right-radius: 4px;
    margin-left: auto;
    box-shadow: rgba(0, 0, 0, 0.25) 0px 0.0625em 0.0625em, rgba(0, 0, 0, 0.25) 0px 0.125em 0.5em, rgba(255, 255, 255, 0.1) 0px 0px 0px 1px inset;
}
.message-bubble.received {
    align-self: flex-start;
    background: white;
    border-top-left-radius: 4px;
    box-shadow: rgba(0, 0, 0, 0.25) 0px 0.0625em 0.0625em, rgba(0, 0, 0, 0.25) 0px 0.125em 0.5em, rgba(255, 255, 255, 0.1) 0px 0px 0px 1px inset;
}
.message-bubble.forwarded {
    background-color: #E8E8FF !important;
    border: 1px solid #8888AA !important;
}
.forwarded-label {
    font-size: 11px;
    color: #666666;
    margin-bottom: 4px;
    font-weight: 500;
    pointer-events: none;
}
.forwarded-separator {
    height: 1px;
    background-color: #CCCCCC;
    margin-bottom: 8px;
    pointer-events: none;
}
.voice-message-container {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
    width: 100%;
    pointer-events: none;
}
.voice-message-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    pointer-events: none;
}
.voice-message-profile-pic {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    pointer-events: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.3);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.voice-message-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #667;
    font-weight: 500;
}
.voice-message-info .time {
    color: #999;
    font-size: 12px;
}
.voice-play-button {
    width: 0;
    height: 0;
    border: none;
    cursor: pointer;
    background: transparent;
    border-style: solid;
    border-width: 12px 0 12px 20px;
    border-color: transparent transparent transparent #667eea;
    flex-shrink: 0;
    transition: all 0.2s;
    position: relative;
    pointer-events: auto;
}
.voice-play-button:hover {
    border-color: transparent transparent transparent #5568d3;
    transform: scale(1.1);
}
.voice-play-button.playing {
    width: 20px;
    height: 24px;
    border: none;
    background: transparent;
    position: relative;
}
.voice-play-button.playing::before,
.voice-play-button.playing::after {
    content: '';
    position: absolute;
    top: 0;
    width: 6px;
    height: 24px;
    background: #667eea;
    transition: all 0.2s;
}
.voice-play-button.playing::before {
    left: 0;
}
.voice-play-button.playing::after {
    right: 0;
}
.voice-play-button.playing:hover::before,
.voice-play-button.playing:hover::after {
    background: #5568d3;
}
.voice-waveform {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 100px;
    pointer-events: none;
}
.voice-progress-bar {
    width: 100%;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
    pointer-events: none;
}
.voice-progress-fill {
    height: 100%;
    background: #667eea;
    width: 0%;
    transition: width 0.1s linear;
    pointer-events: none;
}
.message-bubble .text {
    color: #1a1a2e;
    font-size: 16px;
    line-height: 1.4;
    word-wrap: break-word;
    pointer-events: none;
}
.message-bubble .time {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    text-align: right;
    pointer-events: none;
}
.message-input-container {
    padding: 16px 24px;
    background: #f0f2f5;
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
    overflow: visible;
}

/* Desktop Input Buttons - Visible on Desktop */
.desktop-input-buttons {
    display: flex;
    gap: 8px;
}

/* Mobile Input Buttons - Hidden on Desktop */
.mobile-input-buttons {
    display: none;
}

/* Desktop-specific overrides */
@media (min-width: 769px) {
    .desktop-input-buttons {
        display: flex !important;
    }

    .mobile-input-buttons {
        display: none !important;
    }
}

/* Mobile Action Button */
.mobile-action-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #667eea;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
    line-height: 1;
}

.mobile-action-btn:hover {
    background: #e0e7ff;
}

/* Mobile Action Menu */
.mobile-action-menu {
    position: absolute;
    bottom: 60px;
    left: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 8px;
    min-width: 160px;
    z-index: 1005;
}

.mobile-action-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.mobile-action-option:hover {
    background: #f0f2f5;
}

.mobile-action-icon {
    font-size: 20px;
}

.mobile-action-text {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}
.message-input-container input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    background: white;
}
.message-input-container input:focus {
    outline: none;
    box-shadow: 0 0 0 2px #667eea;
}
.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.send-btn:hover {
    transform: scale(1.1);
}
.message-action-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3500;
}

/* For desktop - position popup better */
@media (min-width: 769px) {
    .message-action-popup {
        align-items: flex-start;
        padding-top: 100px;
        justify-content: flex-end;
        padding-right: 50px;
    }
    
    .popup-content {
        position: relative;
        transform: none;
        margin: 0;
    }
}
#group-members-popup,
#image-caption-popup {
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}
.popup-content {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    min-width: 300px;
    max-width: 95% !important;
    max-height: 95vh !important;
    overflow-y: auto;
    position: relative;
}

.actions-header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.actions-header-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.actions-icon {
    font-size: 14px;
}

.message-actions-content {
    display: none;
    animation: slideDown 0.3s ease-out;
}

.message-actions-content.show {
    display: block;
}

.popup-content h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 18px;
}
.popup-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 10px;
    border: none;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    transition: all 0.2s;
}
.popup-btn:hover {
    background: #e9ecef;
}
.popup-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.popup-btn.cancel-btn {
    background: #dc3545;
    color: white;
    text-align: center;
}
.popup-btn.cancel-btn:hover {
    background: #c82333;
}
.forward-conversation-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8f9fa;
}
.forward-conversation-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s;
}
.forward-conversation-item:hover {
    background: #e9ecef;
}
.forward-conversation-item:last-child {
    border-bottom: none;
}
.forward-conversation-name {
    font-weight: 500;
    color: #333;
}
.forward-conversation-preview {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}
.message-bubble {
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.message-bubble:hover {
    transform: scale(1.01);
}
.message-bubble.selected {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

.message-hover-actions {
    display: none !important;
}

/* Reply context styling */
.reply-context {
    display: flex;
    padding: 6px 8px;
    margin-bottom: 4px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
}

.reply-context:hover {
    background-color: rgba(0, 0, 0, 0.09);
}

.reply-border {
    width: 3px;
    background-color: #6B5CAE;
    margin-right: 8px;
    border-radius: 2px;
    flex-shrink: 0;
    pointer-events: none;
}

.reply-content {
    flex: 1;
    overflow: hidden;
    pointer-events: none;
}

.reply-username {
    font-size: 12px;
    font-weight: bold;
    color: #6B5CAE;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.reply-text {
    font-size: 11px;
    color: #4f46e5;
    text-decoration: underline;
    max-height: 2.4em;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.2;
}

/* Flash highlight when jumping to a replied-to message */
.message-bubble.msg-highlight {
    background-color: rgba(255, 224, 130, 0.75) !important;
    transition: background-color 0.25s ease;
}

.reply-image-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    margin-left: 8px;
    flex-shrink: 0;
    pointer-events: none;
}

/* Notification message styles */
.notification-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.notification-icon {
    font-size: 24px;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.notification-content {
    flex: 1;
    color: white;
}

.notification-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: white;
}

.notification-text {
    font-size: 13px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.95);
}

/* Center notifications in message area */
.message-bubble.notification {
    align-self: center !important;
    max-width: 100%;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    cursor: default !important;
}
.message-bubble.notification:hover {
    transform: none !important;
}

.reaction-picker {
    position: fixed;
    background: white;
    padding: 8px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 1001;
    white-space: nowrap;
}

.reaction-emoji-row {
    display: flex;
    gap: 4px;
}

.reaction-actions-row {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: space-between;
    padding-top: 2px;
    border-top: 1px solid #e5e7eb;
}

.reaction-actions-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.reaction-actions-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.4);
}

.reaction-emoji {
    font-size: 28px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s;
    user-select: none;
    line-height: 1;
}
.reaction-emoji:hover {
    background: #f0f2f5;
    transform: scale(1.1);
}
.reaction-badge {
    position: absolute;
    bottom: -8px;
    right: -6px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 0;
    min-height: 20px;
    z-index: 10;
    pointer-events: none;
}
.reaction-badge .emoji {
    display: inline-block;
    line-height: 1;
    font-size: 20px;
}
.reaction-badge .count {
    font-size: 9px;
    font-weight: 600;
    color: #666;
    margin-left: 0;
    min-width: 10px;
    text-align: center;
    line-height: 1;
}
.emoji-btn {
    background: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}
.emoji-btn:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}
.mobile-emoji-btn {
    display: none;
}

@media (max-width: 768px) {
    .mobile-emoji-btn {
        display: block;
    }
}
.attach-btn {
    background: white;
    border: none;
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}
.attach-btn:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}
.attach-menu {
    position: absolute;
    bottom: 50px;
    left: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 8px;
    min-width: 150px;
    z-index: 1000;
}
.attach-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.attach-option:hover {
    background: #f0f2f5;
}
.attach-icon {
    font-size: 20px;
}
.attach-text {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}
.voice-btn {
    background: white;
    border: none;
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
}
.voice-btn:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}
.voice-btn.recording {
    background: #ff4444;
    animation: pulse 1s infinite;
}

/* Voice recording container and indicator */
.voice-recording-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.recording-indicator {
    display: none;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.3);
    animation: slideDown 0.3s ease-out;
    position: absolute;
    bottom: auto;
    top: -35px;
    left: 0;
    white-space: nowrap;
    z-index: 1005;
    width: auto;
    height: auto;
    max-width: 150px;
    flex-shrink: 0;
    flex-grow: 0;
    flex-direction: row;
}

.recording-indicator.show {
    display: inline-flex;
}

.recording-dot {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

.recording-text {
    font-size: 11px;
    font-weight: 600;
}

@keyframes slideDown {
    from { 
        opacity: 0; 
        transform: translateY(-8px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.emoji-picker {
    position: absolute;
    bottom: 50px;
    left: 0;
    background: white;
    padding: 12px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    z-index: 1005;
    max-width: 280px;
}
.picker-emoji {
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s;
    user-select: none;
}
.picker-emoji:hover {
    background: #f0f2f5;
    transform: scale(1.2);
}
.message-bubble {
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    margin-bottom: 12px;
}
.profile-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    overflow-y: auto;
}

@media (min-width: 769px) {
    .profile-viewer {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 100%;
        z-index: 50;
        background: #f8f9fa;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    }
}
.profile-viewer-header {
    background: white;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.back-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: #667eea;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}
.back-btn:hover {
    background: #f0f2f5;
}

@media (max-width: 768px) {
    .dropdown-menu {
        right: -50px;
    }
    
    .back-btn {
        font-size: 18px;
        padding: 10px 14px;
    }
    
    .profile-viewer-header {
        padding: 12px 16px;
    }
    
    .profile-viewer-content {
        padding: 16px;
    }
}
.profile-viewer-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a2e;
    flex: 1;
}
.edit-profile-btn {
    background: #667eea;
    color: white;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background 0.2s;
}
.edit-profile-btn:hover {
    background: #5568d3;
}
.edit-profile-btn.hidden {
    display: none;
}
.profile-viewer-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.profile-picture-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    background-position: center;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 48px;
}
.profile-name-large {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 8px;
}
.profile-username {
    font-size: 16px;
    color: #6b7280;
}

/* Mobile Responsive Design */
.mobile-back-btn {
    display: none;
    background: none;
    border: none;
    color: #667eea;
    font-size: 24px;
    cursor: pointer;
    padding: 8px 1px;
    margin-right: 8px;
}

@media (min-width: 769px) {
    .mobile-back-btn {
        display: none !important;
    }
    
    .popup-content {
        max-width: 95% !important;
        max-height: 95vh !important;
        min-width: 400px !important;
        padding: 32px !important;
    }
}

/* Desktop: Full width/height with no padding */
@media (min-width: 769px) {
    body {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .chat-container {
        margin: 0 !important;
        height: 100vh !important;
        max-width: 100% !important;
        border-radius: 0 !important;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0 !important;
        margin: 0 !important;
        overflow-x: hidden;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 100vh;
        min-height: 100dvh;
    }
    
    .auth-container {
        max-width: 100%;
        width: 100%;
        padding: 20px;
        box-sizing: border-box;
    }
    
    .chat-container {
        height: 100vh !important;
        height: 100dvh !important;
        width: 100vw !important;
        max-width: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        box-shadow: none !important;
    }
    
    .sidebar {
        position: relative;
        width: 100%;
        height: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .main-chat {
        display: none;
    }
    
    .main-chat.active {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        background: #efe7dd;
        overflow: hidden;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        box-sizing: border-box;
    }
    
    .main-chat.active .messages {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }
    
    .main-chat.active .message-input-container {
        flex-shrink: 0;
        position: sticky;
        bottom: 0;
    }
    
    .message-action-popup {
        align-items: center;
        justify-content: center;
        padding: 0;
    }
    
    .popup-content {
        padding: 16px;
        min-width: 280px;
        max-width: 90% !important;
    }
    
    .actions-header-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .popup-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .voice-btn {
        font-size: 16px;
    }
    
    .recording-indicator {
        font-size: 10px !important;
        padding: 3px 6px !important;
        z-index: 1007 !important;
        position: fixed !important;
        bottom: 80px !important;
        left: 50% !important;
        right: auto !important;
        top: auto !important;
        transform: translateX(-50%) !important;
        width: auto !important;
        height: auto !important;
        max-width: 120px !important;
        max-height: 25px !important;
        min-width: 0 !important;
        min-height: 0 !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        flex-basis: auto !important;
        flex-direction: row !important;
        align-self: flex-start !important;
        animation: none !important;
        line-height: 1.2 !important;
    }
    
    .recording-indicator.show {
        display: inline-flex !important;
    }
    
    .recording-dot {
        width: 6px !important;
        height: 6px !important;
        min-width: 6px !important;
        min-height: 6px !important;
        max-width: 6px !important;
        max-height: 6px !important;
    }
    
    .recording-text {
        line-height: 1.2 !important;
        white-space: nowrap !important;
    }
    
    .sidebar {
        position: relative;
        width: 100%;
        height: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .main-chat {
        display: none;
    }
    
    .main-chat.active {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        background: #efe7dd;
        overflow: hidden;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        box-sizing: border-box;
    }
    
    .main-chat.active .messages {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }
    
    .main-chat.active .message-input-container {
        flex-shrink: 0;
        position: sticky;
        bottom: 0;
    }
    
    .chat-header {
        padding: 12px 16px 12px 12px;
        min-height: 60px;
    }
    
    .chat-header .avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .chat-header-name {
        font-size: 15px;
    }
    
    .chat-view-profile {
        font-size: 11px;
    }
    
    .messages {
        padding: 12px;
        overflow-x: hidden;
        box-sizing: border-box;
        width: 100%;
    }
    
    .message-bubble {
        max-width: 85%;
        box-sizing: border-box;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .message-input-container {
        padding: 10px 12px;
        gap: 8px;
    }

    /* Hide desktop buttons on mobile */
    .desktop-input-buttons {
        display: none;
    }

    /* Show mobile action button on mobile */
    .mobile-input-buttons {
        display: flex;
    }

    .mobile-action-menu {
        bottom: 70px;
        left: 0;
        min-width: 150px;
    }

    .mobile-action-option {
        padding: 10px 14px;
    }

    .mobile-action-icon {
        font-size: 18px;
    }

    .mobile-action-text {
        font-size: 13px;
    }

    .emoji-picker {
        left: 0;
        bottom: 70px;
        z-index: 1006;
    }

    .attach-menu {
        left: 0;
        bottom: 70px;
        z-index: 1006;
    }

    .message-input {
        font-size: 16px;
        padding: 10px 14px;
    }
    
    .send-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .profile-picture-large {
        width: 100px;
        height: 100px;
    }
    
    .profile-name-large {
        font-size: 20px;
    }
    
    .reaction-emoji {
        font-size: 22px;
    }
    
    .send-btn {
        width: 40px;
        height: 40px;
        padding: 0;
    }
    
    .picker-emoji {
        font-size: 23px;
        padding: 0;
    }
    
    .profile-viewer {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 3000;
        background: white;
        display: none !important;
        flex-direction: column;
    }
    
    .profile-viewer.mobile-show {
        display: flex !important;
    }
    
    .profile-viewer-header {
        padding: 12px 16px;
        border-bottom: 1px solid #e5e7eb;
        display: flex;
        align-items: center;
        gap: 12px;
    }
    
    .profile-viewer-content {
        flex: 1;
        padding: 20px;
        overflow-y: auto;
    }
    
    .profile-viewer-back {
        background: none;
        border: none;
        color: #667eea;
        font-size: 24px;
        cursor: pointer;
        padding: 8px 1px;
        margin-right: 8px;
    }
}

/* Chat Notification Toast */
.chat-notification {
    position: fixed;
    top: 20px;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: fit-content;
    max-width: 80%;
    background: #10b981;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    animation: slideDown 0.3s ease-out;
}

.chat-notification.error {
    background: #ef4444;
}

.chat-notification.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    pointer-events: none;
}

.image-caption {
    font-size: 13px;
    color: #1a1a2e;
    padding: 4px 0;
    word-break: break-word;
    line-height: 1.4;
    pointer-events: none;
}

@media (min-width: 769px) {
    .chat-image {
        max-width: 400px;
        max-height: 400px;
    }
}
