/* Realtime Features CSS */

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 18px;
  margin: 5px 0;
  font-size: 14px;
  color: #666;
  max-width: fit-content;
}

.typing-dots {
  display: flex;
  gap: 3px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: #999;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.typing-text {
  font-style: italic;
  font-size: 13px;
}

/* Read Receipt */
.read-receipt {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #4CAF50;
  margin-top: 4px;
  opacity: 0.8;
}

.read-receipt i {
  font-size: 10px;
}

/* Presence Indicator */
.presence-indicator {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
}

.presence-indicator i {
  font-size: 8px;
}

.presence-indicator.status-online i {
  color: #4CAF50;
}

.presence-indicator.status-away i {
  color: #FF9800;
}

.presence-indicator.status-busy i {
  color: #f44336;
}

.presence-indicator.status-offline i {
  color: #999;
}

/* Message Status Indicators */
.message-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #999;
  margin-top: 2px;
}

.message-status.sent {
  color: #999;
}

.message-status.delivered {
  color: #4CAF50;
}

.message-status.read {
  color: #2196F3;
}

/* Online Status in Chat List */
.chat-item .presence-indicator {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  border: 2px solid white;
}

/* Group Chat Presence */
.group-presence {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.group-presence .presence-indicator {
  width: 8px;
  height: 8px;
}

.group-presence .presence-indicator i {
  font-size: 6px;
}

/* Message Timestamp */
.message-timestamp {
  font-size: 11px;
  color: #999;
  margin-top: 2px;
  opacity: 0.7;
}

.message-timestamp.read {
  color: #2196F3;
}

/* File Upload Progress */
.file-upload-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  margin: 5px 0;
}

.file-upload-progress .progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.file-upload-progress .progress-fill {
  height: 100%;
  background: #4CAF50;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.file-upload-progress .progress-text {
  font-size: 12px;
  color: #666;
  min-width: 40px;
  text-align: right;
}

/* File Preview */
.file-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  margin: 5px 0;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.file-preview:hover {
  background: rgba(0, 0, 0, 0.1);
}

.file-preview .file-icon {
  font-size: 20px;
  color: #666;
}

.file-preview .file-info {
  flex: 1;
}

.file-preview .file-name {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 2px;
}

.file-preview .file-size {
  font-size: 12px;
  color: #666;
}

.file-preview .file-actions {
  display: flex;
  gap: 4px;
}

.file-preview .file-action {
  padding: 4px;
  border: none;
  background: none;
  color: #666;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.file-preview .file-action:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* Image Preview */
.image-preview {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

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

/* Video Preview */
.video-preview {
  max-width: 300px;
  max-height: 200px;
  border-radius: 8px;
  cursor: pointer;
}

/* Audio Preview */
.audio-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  margin: 5px 0;
}

.audio-preview .play-button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #4CAF50;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.audio-preview .play-button:hover {
  background: #45a049;
}

.audio-preview .audio-info {
  flex: 1;
}

.audio-preview .audio-name {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 2px;
}

.audio-preview .audio-duration {
  font-size: 12px;
  color: #666;
}

/* Message Reactions */
.message-reactions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.reaction {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.reaction:hover {
  background: rgba(0, 0, 0, 0.1);
}

.reaction.user-reacted {
  background: rgba(33, 150, 243, 0.1);
  color: #2196F3;
}

.reaction .emoji {
  font-size: 14px;
}

.reaction .count {
  font-weight: 500;
}

/* Reply Preview */
.reply-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.05);
  border-left: 3px solid #2196F3;
  border-radius: 0 8px 8px 0;
  margin: 5px 0;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.reply-preview:hover {
  background: rgba(0, 0, 0, 0.1);
}

.reply-preview .reply-icon {
  font-size: 16px;
  color: #2196F3;
}

.reply-preview .reply-info {
  flex: 1;
}

.reply-preview .reply-sender {
  font-size: 12px;
  font-weight: 500;
  color: #2196F3;
  margin-bottom: 2px;
}

.reply-preview .reply-content {
  font-size: 13px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .typing-indicator {
    font-size: 13px;
    padding: 6px 10px;
  }
  
  .typing-text {
    font-size: 12px;
  }
  
  .read-receipt {
    font-size: 11px;
  }
  
  .presence-indicator {
    width: 10px;
    height: 10px;
  }
  
  .presence-indicator i {
    font-size: 7px;
  }
  
  .file-preview {
    padding: 6px 10px;
  }
  
  .file-preview .file-icon {
    font-size: 18px;
  }
  
  .file-preview .file-name {
    font-size: 13px;
  }
  
  .file-preview .file-size {
    font-size: 11px;
  }
  
  .image-preview {
    max-width: 150px;
    max-height: 150px;
  }
  
  .video-preview {
    max-width: 250px;
    max-height: 150px;
  }
  
  .audio-preview {
    padding: 6px 10px;
  }
  
  .audio-preview .play-button {
    width: 28px;
    height: 28px;
  }
  
  .audio-preview .audio-name {
    font-size: 13px;
  }
  
  .audio-preview .audio-duration {
    font-size: 11px;
  }
  
  .reaction {
    font-size: 11px;
    padding: 2px 5px;
  }
  
  .reaction .emoji {
    font-size: 13px;
  }
  
  .reply-preview {
    padding: 6px 10px;
  }
  
  .reply-preview .reply-sender {
    font-size: 11px;
  }
  
  .reply-preview .reply-content {
    font-size: 12px;
  }
}
