:root {
  --primary-color: #1877F2;
  --secondary-color: #E4E6EB;
  --message-sent: #0084FF;
  --message-received: #E4E6EB;
  --system-message: #F0F2F5;
  --text-color: #050505;
  --secondary-text: #65676B;
  --divider-color: #CED0D4;
  --hover-color: #F2F2F2;
  --online-color: #31A24C;
  --offline-color: #BEC3C9;
  --owner-color: #9b59b6;
  --owner-bg: #f8f4ff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background-color: #F0F2F5;
  color: var(--text-color);
}

.chat-container {
  max-width: 800px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
}

/* Header Styles */
.app-header {
  background-color: white;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  z-index: 10;
  position: sticky;
  top: 0;
  flex-shrink: 0;
  gap: 12px;
}

#userProfilePic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--secondary-color);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  position: relative;
  margin: 0;
  order: -1;
  transition: transform 0.2s ease;
}

.header-text {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow: hidden;
}

.app-header h1 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header h6 {
  font-size: 0.7rem;
  color: var(--secondary-text);
  margin: 2px 0 0 0;
  font-weight: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main Chat Area */
.chat-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background-color: #F0F2F5;
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AkEEjIZJ5UZ1QAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAALUlEQVQ4y2NgGAXDADDCGEuXLv0PxVOmTGH4//8/A1J4wYIFDGiG4Q0fBkMAAKQxKzL3QhQ5AAAAAElFTkSuQmCC');
  background-repeat: repeat;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  position: relative;
  height: 0; /* Let flexbox handle height */
}

/* Message Styles */
.message {
  max-width: 65%;
  margin-bottom: 16px;
  position: relative;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease-out;
  transform: translateZ(0);
}

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

.sent {
  align-self: flex-end;
}

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

.system {
  align-self: center;
  background-color: var(--system-message);
  text-align: center;
  font-size: 0.75rem;
  color: var(--secondary-text);
  padding: 4px 12px;
  border-radius: 12px;
  margin: 8px auto;
}

.sender-info {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.sender-pic {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  margin-right: 8px;
  background-color: #ddd;
}

.sender-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--secondary-text);
}

.message-content {
  padding: 8px 12px;
  border-radius: 18px;
  position: relative;
  transition: transform 0.2s ease;
}

.sent .message-content {
  background-color: var(--message-sent);
  color: white;
  border-bottom-right-radius: 4px;
}

.received .message-content {
  background-color: var(--message-received);
  color: var(--text-color);
  border-bottom-left-radius: 4px;
}

.owner-message .message-content {
  background-color: var(--owner-bg);
  border-left: 3px solid var(--owner-color);
}

.message-text {
  font-size: 0.9375rem;
  line-height: 1.3333;
  margin-bottom: 2px;
}

.message-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 12px;
  margin: 4px 0;
  cursor: pointer;
  transition: transform 0.2s ease;
  backface-visibility: hidden;
}

.message-image:hover {
  transform: scale(1.02);
}

.message-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 2px;
}

.timestamp {
  font-size: 0.6875rem;
  color: var(--secondary-text);
  margin-right: 4px;
}

.sent .timestamp {
  color: rgba(255, 255, 255, 0.7);
}

.status-icon {
  font-size: 0.6875rem;
  color: var(--message-sent);
}

.date-separator {
  text-align: center;
  margin: 16px 0;
  position: relative;
  font-size: 0.75rem;
  color: var(--secondary-text);
}

.date-separator::before,
.date-separator::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background-color: var(--divider-color);
}

.date-separator::before {
  left: 0;
}

.date-separator::after {
  right: 0;
}

/* Input Area */
.input-container {
  display: flex;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background-color: white;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--divider-color);
  position: sticky;
  bottom: 0;
  flex-shrink: 0;
  transition: padding 0.2s ease;
}

#messageInput {
  flex: 1;
  border: none;
  padding: 10px 16px;
  border-radius: 20px;
  outline: none;
  font-size: 0.9375rem;
  background-color: var(--secondary-color);
  transition: all 0.2s ease;
  min-height: 40px;
  max-height: 120px;
  resize: none;
}

#messageInput:focus {
  background-color: white;
  box-shadow: 0 0 0 1px var(--primary-color);
}

.icon-button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.icon-button:hover {
  background-color: #166FE5;
  transform: scale(1.05);
}

.icon-button:disabled {
  background-color: var(--secondary-color);
  color: var(--secondary-text);
  cursor: not-allowed;
  transform: none;
}

.typing-indicator {
  padding: 4px 16px;
  font-size: 0.75rem;
  color: var(--secondary-text);
  text-align: left;
  display: none;
  position: sticky;
  bottom: 64px;
  background-color: rgba(240, 242, 245, 0.9);
  z-index: 1;
  transition: opacity 0.3s ease;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background-color: white;
  padding: 24px;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal.active .modal-content {
  transform: translateY(0);
}

.profile-pic-container {
  margin: 20px auto;
  width: fit-content;
  position: relative;
}

#userProfilePicModal {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background-color: var(--secondary-color);
  background-size: cover;
  background-position: center;
  margin: 0 auto;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease;
}

#userProfilePicModal:hover {
  transform: scale(1.05);
}

.profile-pic-label {
  display: block;
  text-align: center;
  cursor: pointer;
}

.profile-pic-label i {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background-color: var(--primary-color);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: transform 0.2s ease;
}

/* Online Indicator */
.online-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  background-color: var(--online-color);
  z-index: 2;
  transition: background-color 0.3s ease;
}

/* Owner Badge */
.owner-badge {
  display: inline-block;
  background-color: var(--owner-color);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: bold;
  margin-left: 8px;
  transition: transform 0.2s ease;
}

/* Message Actions */
.message-actions {
  position: absolute;
  right: 0;
  top: 0;
  opacity: 0;
  transition: opacity 0.2s ease;
}

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

.delete-btn {
  background: none;
  border: none;
  color: var(--secondary-text);
  cursor: pointer;
  padding: 4px;
  font-size: 0.8rem;
  transition: color 0.2s ease;
}

.delete-btn:hover {
  color: #e74c3c;
  transform: scale(1.1);
}

/* Responsive Adjustments */
@media (max-width: 600px) {
  .chat-container {
    max-width: 100%;
  }
  
  .message {
    max-width: 80%;
  }
  
  .modal-content {
    padding: 20px 16px;
  }
  
  #userProfilePicModal {
    width: 80px;
    height: 80px;
  }
}

/* iOS Input Fix */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .input-container {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* Message Expired State */
.message-expired {
  opacity: 0.7;
}

.message-expired .message-content {
  background-color: #f5f5f5 !important;
}

.message-expired .message-text {
  color: #999 !important;
}

/* Primary Button */
.primary-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 16px;
  width: 100%;
}

.primary-btn:hover {
  background-color: #166FE5;
  transform: translateY(-1px);
}

/* Form Input */
#userNameInput {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--divider-color);
  border-radius: 6px;
  font-size: 0.9375rem;
  margin-top: 16px;
  transition: border-color 0.2s ease;
}

#userNameInput:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}
/* Settings Button */
.settings-button {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s;
    margin-left: 8px;
}

.settings-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Online Users Toggle Button */
.online-users-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s;
    margin-left: 8px;
}

.online-users-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

/* Settings Form */
.settings-form input,
.settings-form textarea {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.settings-form textarea {
    height: 80px;
    resize: vertical;
    font-family: inherit;
}

/* Profile Picture Large */
.profile-pic-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: #f0f0f0;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #007bff;
}

/* Secondary Button */
.btn-secondary {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin: 5px;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
    gap: 10px;
}

/* Online Users Sidebar */
.online-users-sidebar {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 999;
    padding: 1rem;
}

.online-users-sidebar.active {
    right: 0;
}

.online-users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.online-users-header h3 {
    margin: 0;
    color: #333;
}

/* Online User Item */
.online-user-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin: 5px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.online-user-item:hover {
    background-color: #f5f5f5;
}

.online-user-item.current-user {
    background-color: #e8f4fd;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    margin-right: 10px;
    background-color: #f0f0f0;
}

.user-name {
    flex: 1;
    color: #333;
    font-weight: 500;
}

.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #31A24C;
    margin-left: auto;
}

/* Invite Link Styles */
.invite-link-container {
    display: flex;
    margin: 1rem 0;
}

.invite-link-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px 0 0 6px;
    font-size: 14px;
    border-right: none;
}

.copy-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.copy-btn:hover {
    background: #0056b3;
}

.referral-count {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 1rem;
    font-size: 14px;
}

/* User Bio in Profile Modal */
.user-bio {
    color: #666;
    line-height: 1.5;
    margin: 1rem 0;
    padding: 1rem;
    background-color: #f9f9f9;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

/* Close button for sidebar */
#closeOnlineUsers {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s;
}

#closeOnlineUsers:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Primary Button (if not already defined) */
.primary-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.primary-btn:hover {
    background-color: #0056b3;
}

.primary-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}
/* Header buttons container */
.app-header {
    display: flex;
    align-items: center;
    gap: 10px; /* Add gap between buttons */
}

/* Settings Button */
#settingsButton {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#settingsButton:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Online Users Toggle Button */
#toggleOnlineUsers {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#toggleOnlineUsers:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Invite Button */
#inviteButton {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#inviteButton:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Online Indicator */
#onlineIndicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #31A24C;
    margin-right: 10px;
    border: 2px solid white;
}

/* Make sure header has proper background */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
    color: white;
}

/* Online Users Sidebar */
#onlineUsersSidebar {
    position: fixed;
    top: 0;
    right: -350px;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.3);
    transition: right 0.3s ease;
    z-index: 1000;
    padding: 1rem;
}

#onlineUsersSidebar.active {
    right: 0;
}

.online-users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #eee;
}

.online-users-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.3rem;
}

#closeOnlineUsers {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#closeOnlineUsers:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Online Users List */
#onlineUsersList {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.online-user-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin: 8px 0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.online-user-item:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
    transform: translateX(5px);
}

.online-user-item.current-user {
    background-color: #e8f4fd;
    border-color: #007bff;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: #f0f0f0;
    margin-right: 12px;
    border: 2px solid #ddd;
}

.online-user-item.current-user .user-avatar {
    border-color: #007bff;
}

.user-name {
    flex: 1;
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.online-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #31A24C;
    margin-left: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Make sure the header layout is correct */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-text {
    flex: 1;
    text-align: center;
}

.header-text h1 {
    margin: 0;
    font-size: 1.5rem;
}

.header-text h6 {
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Header buttons container */
.header-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}
/* Add these styles to your CSS */
.install-prompt-header {
    text-align: center;
    margin-bottom: 2rem;
}

.app-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2.5rem;
    color: white;
}

.install-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.feature {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    gap: 10px;
}

.feature i {
    color: #667eea;
    font-size: 1.2rem;
}

.feature span {
    font-size: 0.9rem;
    color: #333;
}

.install-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 2rem;
}

.install-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #31A24C 0%, #1e7e34 100%);
}

.install-btn:hover {
    background: linear-gradient(135deg, #269f42 0%, #1c7430 100%);
}

.install-tip {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    color: #666;
}

.install-tip i {
    color: #667eea;
    margin-right: 5px;
}

/* Floating install button styles */
#installButton {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
}

#installButton.show {
    opacity: 1;
    transform: translateY(0);
}

#installButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

#installButton i {
    font-size: 18px;
}

/* Badge for new installs */
.install-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
/* Add these styles at the end of your existing CSS */

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Optimize messages container */
#messagesContainer {
    will-change: transform;
    contain: content;
}

/* Improve scroll performance */
.message {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Optimize images */
.message-image {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
}

/* Lazy loading for images */
.message-image[data-src] {
    opacity: 0;
    transition: opacity 0.3s;
}

.message-image.loaded {
    opacity: 1;
}
.logout-button {
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s;
    margin-left: 5px;
}

.logout-button:hover {
    background-color: rgba(255, 107, 107, 0.1);
}
/* Private Chat Styles */
.private-chat-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
    font-weight: 500;
}

.private-chat-btn:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.private-chat-btn:active {
    transform: translateY(0);
}

/* Private message bubbles */
.private-message {
    margin-bottom: 10px;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 75%;
    word-wrap: break-word;
    animation: fadeInUp 0.3s ease;
    position: relative;
}

.private-message.sent {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

.private-message.received {
    background: #f1f5f9;
    color: #1e293b;
    margin-right: auto;
    border-bottom-left-radius: 5px;
    border: 1px solid #e2e8f0;
}

.message-time {
    font-size: 11px;
    opacity: 0.8;
    margin-top: 5px;
    display: block;
    text-align: right;
}

.unread-indicator {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
}

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

/* Online indicator in private chat */
.user-status {
    font-size: 13px;
    font-weight: 500;
}

.status-online {
    color: #10b981;
}

.status-offline {
    color: #94a3b8;
}

/* Private chat modal */
.private-chat-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 15px 15px 0 0;
}

.private-chat-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.private-chat-user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 3px solid #3b82f6;
}

.private-messages-container {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
}

.private-chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 15px 15px;
}

.private-chat-input-container form {
    display: flex;
    gap: 10px;
}

#privateMessageInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

#privateMessageInput:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#privateSendButton {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

#privateSendButton:hover:not(:disabled) {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-2px);
}

#privateSendButton:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}