/* ========== CHAT APPLICATION STYLES - VERSÃO COM GRUPOS ========== */

/* Variables */
:root {
  /* Chat specific colors */
  --chat-bg: #f8f9fa;
  --sidebar-bg: #ffffff;
  --message-sent: #FF6B35;
  --message-received: #f1f3f4;
  --message-text-sent: #ffffff;
  --message-text-received: #2d3748;
  --online-status: #10b981;
  --offline-status: #6b7280;
  --typing-indicator: #fbbf24;
  
  /* Group chat colors */
  --group-primary: #4F46E5;
  --group-secondary: #06B6D4;
  --competition-group: #059669;
  --group-bg: #F0F9FF;
  --group-border: #BAE6FD;
  
  /* Spacing */
  --sidebar-width: 320px;
  --chat-header-height: 80px;
  --input-height: 60px;
  
  /* Animation */
  --chat-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --message-animation: slideInUp 0.3s ease-out;
  --bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ========== MAIN LAYOUT ========== */
.chat-app {
  display: flex;
  height: 100vh;
  background: var(--chat-bg);
  font-family: 'Poppins', sans-serif;
}

/* ========== SIDEBAR ========== */
.chat-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--background);
  display: flex;
  flex-direction: column;
  transition: var(--chat-transition);
  position: relative;
  z-index: 10;
}

.chat-sidebar.collapsed {
  width: 80px;
}

.chat-sidebar.collapsed .sidebar-header .user-info,
.chat-sidebar.collapsed .search-container,
.chat-sidebar.collapsed .filter-tabs span:not(.count),
.chat-sidebar.collapsed .chat-item-content {
  display: none;
}

/* Sidebar Header */
.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--background);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar-container {
  position: relative;
}

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-light);
}

.status-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid white;
  background: var(--offline-status);
  transition: var(--chat-transition);
}

.status-indicator.online {
  background: var(--online-status);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
  animation: pulse-online 2s infinite;
}

@keyframes pulse-online {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.user-info {
  flex: 1;
}

.user-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.125rem;
}

.user-status {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.sidebar-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--background);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--chat-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--message-sent), var(--online-status));
  opacity: 0;
  transition: var(--chat-transition);
  z-index: -1;
}

.action-btn:hover::before {
  opacity: 1;
}

.action-btn:hover {
  color: white;
  transform: translateY(-1px);
}

/* Search Container */
.search-container {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--background);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-tertiary);
  font-size: 0.9rem;
  z-index: 2;
}

.search-input {
  width: 100%;
  padding: 0.75rem 0.75rem 0.75rem 2.5rem;
  border: 1px solid var(--background);
  border-radius: 20px;
  background: var(--background);
  font-size: 0.9rem;
  transition: var(--chat-transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.clear-search {
  position: absolute;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--text-tertiary);
  color: white;
  cursor: pointer;
  opacity: 0;
  transition: var(--chat-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

.search-input:not(:placeholder-shown) + .clear-search {
  opacity: 1;
}

.clear-search:hover {
  background: var(--error);
}

/* Filter Tabs */
.filter-tabs {
  display: flex;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--background);
}

.filter-tab {
  flex: 1;
  padding: 1rem 0.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-secondary);
  transition: var(--chat-transition);
  position: relative;
}

.filter-tab.active {
  color: var(--primary);
}

.filter-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.filter-tab i {
  font-size: 1.1rem;
}

.filter-tab span:not(.count) {
  font-size: 0.7rem;
  font-weight: 500;
}

.filter-tab .count {
  font-size: 0.6rem;
  background: var(--text-tertiary);
  color: white;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

.filter-tab .count.unread {
  background: var(--primary);
  animation: pulse 2s infinite;
}

/* Chat List */
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.chat-item {
  padding: 1rem 1.5rem;
  cursor: pointer;
  transition: var(--chat-transition);
  border-bottom: 1px solid var(--background);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.chat-item:hover {
  background: var(--background);
  transform: translateX(4px);
}

.chat-item.active {
  background: rgba(255, 107, 53, 0.1);
  border-right: 3px solid var(--primary);
}

/* Group Chat Styles */
.chat-item.competition-group {
  border-left: 3px solid var(--competition-group);
  background: linear-gradient(90deg, rgba(5, 150, 105, 0.05) 0%, transparent 100%);
}

.chat-item.competition-group:hover {
  background: linear-gradient(90deg, rgba(5, 150, 105, 0.1) 0%, var(--background) 100%);
}

.chat-item.competition-group.active {
  background: linear-gradient(90deg, rgba(5, 150, 105, 0.15) 0%, rgba(255, 107, 53, 0.1) 100%);
  border-right: 3px solid var(--competition-group);
}

.chat-item-avatar {
  position: relative;
  flex-shrink: 0;
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  transition: var(--chat-transition);
}

.chat-item:hover .chat-avatar {
  transform: scale(1.05);
}

/* Group Avatar Indicator */
.group-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  background: var(--group-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: white;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.competition-group .group-indicator {
  background: var(--competition-group);
}

.chat-item-content {
  flex: 1;
  min-width: 0;
}

.chat-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.chat-friend-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-friend-name .group-indicator {
  position: static;
  width: 16px;
  height: 16px;
  font-size: 0.6rem;
  border: none;
  box-shadow: none;
}

.chat-time {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.chat-last-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.chat-item.unread .chat-last-message {
  font-weight: 600;
  color: var(--text-primary);
}

/* Group Member Count */
.group-member-count {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
}

.group-member-count i {
  font-size: 0.7rem;
}

.unread-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s infinite;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Loading States */
.loading-conversations {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--background);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 3rem;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.empty-state p {
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* ========== MAIN CHAT AREA ========== */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Welcome Screen */
.welcome-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.welcome-content {
  text-align: center;
  max-width: 400px;
}

.welcome-icon {
  font-size: 4rem;
  color: var(--primary);
  margin-bottom: 1.5rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.welcome-content h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.welcome-content p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.feature i {
  color: var(--primary);
  font-size: 1.1rem;
}

/* Chat Interface */
.chat-interface {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Chat Header */
.chat-header {
  height: var(--chat-header-height);
  background: white;
  border-bottom: 1px solid var(--background);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-recipient-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mobile-back-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--background);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--chat-transition);
  align-items: center;
  justify-content: center;
}

.mobile-back-btn:hover {
  background: var(--primary-light);
  color: white;
}

.recipient-avatar-container {
  position: relative;
}

.recipient-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-light);
}

.recipient-details {
  flex: 1;
}

.recipient-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 0.125rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.recipient-status-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Group Info in Header */
.group-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.group-member-count i {
  font-size: 0.7rem;
}

.chat-actions {
  display: flex;
  gap: 0.5rem;
}

/* Messages Container */
.messages-container {
  flex: 1;
  overflow-y: auto;
  background: var(--chat-bg);
  position: relative;
}

.messages-list {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 100%;
}

/* Message Bubbles */
.message {
  display: flex;
  margin-bottom: 0.5rem;
  animation: var(--message-animation);
}

.message.sent {
  justify-content: flex-end;
}

.message.received {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 70%;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

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

/* Group Message Styles */
.group-message .message-sender {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
}

.group-message .sender-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.group-message .sender-name {
  font-weight: 600;
  color: var(--text-secondary);
}

.group-message.sent .message-sender {
  display: none; /* Don't show sender info for own messages */
}

.message-time {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 0.25rem;
  text-align: right;
}

.message.received .message-time {
  text-align: left;
}

.message-status {
  font-size: 0.7rem;
  margin-top: 0.25rem;
  opacity: 0.7;
  text-align: right;
}

.message-status i {
  margin-left: 0.25rem;
}

.message-status.read {
  color: var(--primary);
  opacity: 1;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.typing-dots {
  display: flex;
  gap: 0.2rem;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--typing-indicator);
  animation: typingPulse 1.4s ease-in-out infinite both;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Message Input */
.message-input-container {
  background: white;
  border-top: 1px solid var(--background);
  padding: 1rem 1.5rem;
  position: sticky;
  bottom: 0;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
}

.message-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  background: var(--background);
  border-radius: 24px;
  padding: 0.5rem 0.75rem;
  transition: var(--chat-transition);
}

.message-input-wrapper:focus-within {
  background: white;
  box-shadow: 0 0 0 2px var(--primary-light);
}

.input-field-container {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.message-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 24px;
  max-height: 120px;
  line-height: 1.4;
  padding: 0.5rem 0;
}

.message-input::placeholder {
  color: var(--text-tertiary);
}

.input-actions {
  display: flex;
  gap: 0.25rem;
}

.input-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--chat-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-action-btn:hover {
  background: var(--background);
  color: var(--primary);
  transform: scale(1.1);
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  cursor: pointer;
  transition: var(--chat-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.send-btn:disabled {
  background: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.5;
}

.send-btn:not(:disabled):hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.character-count {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-align: right;
  margin-top: 0.5rem;
  opacity: 0;
  transition: var(--chat-transition);
}

.character-count.visible {
  opacity: 1;
}

.character-count.warning {
  color: var(--warning);
}

.character-count.error {
  color: var(--error);
}

/* ========== CHAT INFO PANEL ========== */
.chat-info-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 300px;
  height: 100%;
  background: white;
  border-left: 1px solid var(--background);
  transform: translateX(100%);
  transition: var(--chat-transition);
  z-index: 20;
  overflow-y: auto;
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
}

.chat-info-panel.open {
  transform: translateX(0);
}

.info-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--background);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.info-header h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--background);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--chat-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: var(--error);
  color: white;
}

.info-content {
  padding: 1.5rem;
}

.friend-profile {
  text-align: center;
  margin-bottom: 2rem;
}

.friend-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  border: 3px solid var(--primary-light);
}

.friend-profile h4 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.friend-profile p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.info-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  background: var(--background);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--chat-transition);
  font-size: 0.95rem;
}

.info-btn:hover {
  background: var(--primary-light);
  color: white;
}

.info-btn.danger {
  background: rgba(245, 101, 101, 0.1);
  color: var(--error);
}

.info-btn.danger:hover {
  background: var(--error);
  color: white;
}

/* ========== EMOJI PICKER ========== */
.emoji-picker {
  position: absolute;
  bottom: 80px;
  left: 1.5rem;
  width: 300px;
  height: 350px;
  background: white;
  border: 1px solid var(--background);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 30;
  display: flex;
  flex-direction: column;
}

.emoji-categories {
  display: flex;
  border-bottom: 1px solid var(--background);
  padding: 0.5rem;
  gap: 0.25rem;
}

.emoji-category {
  flex: 1;
  padding: 0.5rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--chat-transition);
  font-size: 1.2rem;
}

.emoji-category:hover,
.emoji-category.active {
  background: var(--primary-light);
}

.emoji-grid {
  flex: 1;
  padding: 0.5rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.25rem;
}

.emoji-item {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--chat-transition);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-item:hover {
  background: var(--background);
  transform: scale(1.2);
}

/* ========== MODALS ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
 visibility: hidden;
 transition: var(--chat-transition);
 backdrop-filter: blur(4px);
}

.modal.show {
 opacity: 1;
 visibility: visible;
}

.modal-content {
 background: white;
 border-radius: var(--radius-lg);
 box-shadow: var(--shadow-lg);
 width: 90%;
 max-width: 500px;
 max-height: 80vh;
 overflow: hidden;
 transform: scale(0.9);
 transition: var(--chat-transition);
}

.modal.show .modal-content {
 transform: scale(1);
}

.modal-header {
 padding: 1.5rem;
 border-bottom: 1px solid var(--background);
 display: flex;
 align-items: center;
 justify-content: space-between;
}

.modal-header h3 {
 font-size: 1.3rem;
 font-weight: 600;
 color: var(--text-primary);
}

.modal-body {
 padding: 1.5rem;
 max-height: 400px;
 overflow-y: auto;
}

.friends-search {
 position: relative;
 margin-bottom: 1.5rem;
}

.friends-search i {
 position: absolute;
 left: 12px;
 top: 50%;
 transform: translateY(-50%);
 color: var(--text-tertiary);
}

.friends-search input {
 width: 100%;
 padding: 0.75rem 0.75rem 0.75rem 2.5rem;
 border: 1px solid var(--background);
 border-radius: var(--radius-md);
 background: var(--background);
 font-size: 0.95rem;
 transition: var(--chat-transition);
}

.friends-search input:focus {
 outline: none;
 border-color: var(--primary);
 background: white;
 box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.friends-list {
 display: flex;
 flex-direction: column;
 gap: 0.5rem;
}

.friend-item {
 display: flex;
 align-items: center;
 gap: 0.75rem;
 padding: 0.75rem;
 border-radius: var(--radius-md);
 cursor: pointer;
 transition: var(--chat-transition);
 border: 1px solid transparent;
}

.friend-item:hover {
 background: var(--background);
 border-color: var(--primary-light);
 transform: translateX(4px);
}

.friend-item-avatar {
 width: 44px;
 height: 44px;
 border-radius: 50%;
 object-fit: cover;
 position: relative;
}

.friend-item-info {
 flex: 1;
}

.friend-item-name {
 font-weight: 600;
 font-size: 0.95rem;
 color: var(--text-primary);
 margin-bottom: 0.125rem;
}

.friend-item-status {
 font-size: 0.8rem;
 color: var(--text-secondary);
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
 position: fixed;
 top: 20px;
 right: 20px;
 z-index: 2000;
 display: flex;
 flex-direction: column;
 gap: 0.5rem;
}

.toast {
 background: white;
 border-radius: var(--radius-md);
 padding: 1rem 1.5rem;
 box-shadow: var(--shadow-lg);
 border-left: 4px solid var(--primary);
 transform: translateX(100%);
 transition: var(--chat-transition);
 max-width: 300px;
 display: flex;
 align-items: center;
 gap: 0.75rem;
 backdrop-filter: blur(10px);
}

.toast.show {
 transform: translateX(0);
}

.toast.success {
 border-left-color: var(--success);
}

.toast.error {
 border-left-color: var(--error);
}

.toast.warning {
 border-left-color: var(--warning);
}

.toast.info {
 border-left-color: var(--info);
}

.toast-icon {
 font-size: 1.2rem;
}

.toast.success .toast-icon {
 color: var(--success);
}

.toast.error .toast-icon {
 color: var(--error);
}

.toast.warning .toast-icon {
 color: var(--warning);
}

.toast.info .toast-icon {
 color: var(--info);
}

.toast-content {
 flex: 1;
}

.toast-title {
 font-weight: 600;
 font-size: 0.9rem;
 margin-bottom: 0.25rem;
 color: var(--text-primary);
}

.toast-message {
 font-size: 0.85rem;
 color: var(--text-secondary);
 line-height: 1.4;
}

/* ========== GROUP CHAT SPECIFIC STYLES ========== */

/* Group chat header styles */
.chat-header .recipient-details .group-info {
 display: flex;
 align-items: center;
 gap: 0.5rem;
 font-size: 0.8rem;
 color: var(--text-secondary);
}

.group-member-count {
 display: flex;
 align-items: center;
 gap: 0.25rem;
}

.group-member-count i {
 font-size: 0.7rem;
}

/* Competition group indicator in header */
.recipient-name .competition-badge {
 background: linear-gradient(135deg, var(--competition-group), #34d399);
 color: white;
 font-size: 0.7rem;
 padding: 0.2rem 0.4rem;
 border-radius: 8px;
 margin-left: 0.5rem;
 font-weight: 500;
 box-shadow: 0 2px 4px rgba(5, 150, 105, 0.3);
}

/* Group avatar styles */
.group-avatar {
 background: linear-gradient(135deg, var(--group-primary), var(--group-secondary));
 display: flex;
 align-items: center;
 justify-content: center;
 color: white;
 font-weight: 600;
 font-size: 1.2rem;
}

.competition-group .group-avatar {
 background: linear-gradient(135deg, var(--competition-group), #34d399);
}

/* Member list in group info */
.group-members-list {
 display: flex;
 flex-direction: column;
 gap: 0.5rem;
 margin-top: 1rem;
}

.member-item {
 display: flex;
 align-items: center;
 gap: 0.75rem;
 padding: 0.5rem;
 border-radius: var(--radius-sm);
 background: var(--background);
}

.member-avatar {
 width: 32px;
 height: 32px;
 border-radius: 50%;
 object-fit: cover;
}

.member-info {
 flex: 1;
}

.member-name {
 font-weight: 500;
 font-size: 0.9rem;
 color: var(--text-primary);
}

.member-role {
 font-size: 0.75rem;
 color: var(--text-secondary);
 text-transform: capitalize;
}

.member-status {
 width: 8px;
 height: 8px;
 border-radius: 50%;
 background: var(--offline-status);
}

.member-status.online {
 background: var(--online-status);
}

/* Group message sender styles */
.group-message .message-sender {
 display: flex;
 align-items: center;
 gap: 0.5rem;
 margin-bottom: 0.5rem;
 padding-left: 0.5rem;
}

.group-message .sender-avatar {
 width: 24px;
 height: 24px;
 border-radius: 50%;
 object-fit: cover;
 border: 1px solid rgba(255, 255, 255, 0.3);
}

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

.group-message.sent .message-sender {
 display: none;
}

/* Competition theme for group messages */
.competition-group-message .message-bubble {
 border-left: 3px solid var(--competition-group);
}

.competition-group-message.received .message-bubble {
 background: linear-gradient(135deg, rgba(5, 150, 105, 0.1), var(--message-received));
}

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

@keyframes pulse {
 0%, 100% { transform: scale(1); opacity: 1; }
 50% { transform: scale(1.05); opacity: 0.8; }
}

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

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

@keyframes fadeIn {
 from { opacity: 0; }
 to { opacity: 1; }
}

@keyframes bounce {
 0%, 20%, 53%, 80%, 100% {
   animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
   transform: translate3d(0, 0, 0);
 }
 40%, 43% {
   animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
   transform: translate3d(0, -8px, 0);
 }
 70% {
   animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
   transform: translate3d(0, -4px, 0);
 }
 90% {
   transform: translate3d(0, -2px, 0);
 }
}

@keyframes shake {
 0%, 100% { transform: translateX(0); }
 25% { transform: translateX(-5px); }
 75% { transform: translateX(5px); }
}

/* Group-specific animations */
@keyframes groupPulse {
 0%, 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4); }
 50% { box-shadow: 0 0 0 8px rgba(79, 70, 229, 0); }
}

.competition-group .group-indicator {
 animation: groupPulse 2s infinite;
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 1024px) {
 .chat-app {
   position: relative;
 }

 .chat-sidebar {
   position: absolute;
   top: 0;
   left: 0;
   height: 100%;
   z-index: 100;
   transform: translateX(-100%);
   box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
 }

 .chat-sidebar.open {
   transform: translateX(0);
 }

 .chat-main {
   width: 100%;
 }

 .mobile-back-btn {
   display: flex;
 }

 .chat-info-panel {
   width: 100%;
 }

 .emoji-picker {
   left: 50%;
   transform: translateX(-50%);
   width: 280px;
 }

 /* Group header adjustments for mobile */
 .chat-header .group-info {
   flex-direction: column;
   align-items: flex-start;
   gap: 0.25rem;
 }
}

@media (max-width: 768px) {
 .chat-sidebar {
   width: 100%;
 }

 .sidebar-header {
   padding: 1rem;
 }

 .search-container,
 .message-input-container {
   padding: 1rem;
 }

 .chat-header {
   padding: 1rem;
   height: 70px;
 }

 .messages-list {
   padding: 0.5rem;
 }

 .message-bubble {
   max-width: 85%;
   padding: 0.6rem 0.8rem;
   font-size: 0.9rem;
 }

 .filter-tabs {
   padding: 0 1rem;
 }

 .filter-tab {
   padding: 0.75rem 0.25rem;
 }

 .filter-tab span:not(.count) {
   display: none;
 }

 .welcome-content {
   padding: 1rem;
 }

 .welcome-content h2 {
   font-size: 1.5rem;
 }

 .welcome-features {
   align-items: center;
 }

 /* Group message adjustments */
 .group-message .message-sender {
   margin-bottom: 0.25rem;
 }

 .group-message .sender-avatar {
   width: 20px;
   height: 20px;
 }

 .group-member-count {
   font-size: 0.7rem;
 }

 .recipient-name .competition-badge {
   font-size: 0.6rem;
   padding: 0.1rem 0.3rem;
 }
}

@media (max-width: 480px) {
 .message-input-wrapper {
   padding: 0.4rem 0.6rem;
 }

 .send-btn {
   width: 36px;
   height: 36px;
   font-size: 0.9rem;
 }

 .input-action-btn {
   width: 28px;
   height: 28px;
 }

 .chat-item {
   padding: 0.75rem 1rem;
 }

 .chat-avatar,
 .user-avatar,
 .recipient-avatar {
   width: 40px;
   height: 40px;
 }

 .emoji-picker {
   width: 260px;
   height: 300px;
 }

 .modal-content {
   width: 95%;
   margin: 1rem;
 }

 /* Ultra-compact group info */
 .group-member-count span {
   display: none;
 }

 .chat-friend-name .group-indicator {
   width: 14px;
   height: 14px;
   font-size: 0.5rem;
 }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
 * {
   animation-duration: 0.01ms !important;
   animation-iteration-count: 1 !important;
   transition-duration: 0.01ms !important;
 }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
 :root {
   --chat-bg: #1a1a1a;
   --sidebar-bg: #2d2d2d;
   --message-received: #3a3a3a;
   --message-text-received: #ffffff;
   --text-primary: #ffffff;
   --text-secondary: #a1a1aa;
   --text-tertiary: #71717a;
   --background: #374151;
 }

 .group-indicator {
   border-color: #2d2d2d;
 }

 .competition-group {
   background: linear-gradient(90deg, rgba(5, 150, 105, 0.1) 0%, transparent 100%);
 }

 .toast {
   background: #374151;
   color: #ffffff;
 }
}

/* Focus styles for keyboard navigation */
.action-btn:focus,
.filter-tab:focus,
.chat-item:focus,
.message-input:focus,
.send-btn:focus,
.emoji-item:focus,
.friend-item:focus {
 outline: 2px solid var(--primary);
 outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
 .message-bubble {
   border: 1px solid currentColor;
 }
 
 .status-indicator {
   border-width: 3px;
 }

 .group-indicator {
   border-width: 3px;
 }

 .competition-group {
   border-left-width: 4px;
 }
}

/* Print styles */
@media print {
 .chat-sidebar,
 .message-input-container,
 .chat-actions,
 .emoji-picker,
 .toast-container {
   display: none !important;
 }

 .chat-main {
   width: 100% !important;
 }

 .message-bubble {
   box-shadow: none !important;
   border: 1px solid #ccc;
 }
}

/* ========== UTILITY CLASSES ========== */
.sr-only {
 position: absolute;
 width: 1px;
 height: 1px;
 padding: 0;
 margin: -1px;
 overflow: hidden;
 clip: rect(0, 0, 0, 0);
 white-space: nowrap;
 border: 0;
}

.fade-in {
 animation: fadeIn 0.5s ease-in-out;
}

.bounce-in {
 animation: bounce 1s ease-in-out;
}

.shake {
 animation: shake 0.5s ease-in-out;
}

/* Scrollbar customization */
.chat-list::-webkit-scrollbar,
.messages-container::-webkit-scrollbar,
.emoji-grid::-webkit-scrollbar {
 width: 6px;
}

.chat-list::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track,
.emoji-grid::-webkit-scrollbar-track {
 background: var(--background);
}

.chat-list::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb,
.emoji-grid::-webkit-scrollbar-thumb {
 background: var(--text-tertiary);
 border-radius: 3px;
}

.chat-list::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover,
.emoji-grid::-webkit-scrollbar-thumb:hover {
 background: var(--text-secondary);
}

/* ========== FINAL GROUP CHAT ENHANCEMENTS ========== */

/* Enhanced group chat item styles */
.chat-item.competition-group .chat-friend-name::before {
 content: "🏆";
 margin-right: 0.5rem;
 font-size: 0.9rem;
}

.chat-item.regular-group .chat-friend-name::before {
 content: "👥";
 margin-right: 0.5rem;
 font-size: 0.8rem;
}

/* Group chat message threading */
.group-message + .group-message.same-sender {
 margin-top: -0.25rem;
}

.group-message + .group-message.same-sender .message-sender {
 display: none;
}

/* Competition group special effects */
.competition-group:hover {
 background: linear-gradient(90deg, rgba(5, 150, 105, 0.15) 0%, var(--background) 50%, transparent 100%);
}

/* Group notification badges */
.group-notification-badge {
 background: linear-gradient(135deg, var(--group-primary), var(--group-secondary));
 animation: pulse 2s infinite;
}

.competition-notification-badge {
 background: linear-gradient(135deg, var(--competition-group), #34d399);
 animation: groupPulse 2s infinite;
}
}
/* Badge de competição */
.competition-badge {
  background: linear-gradient(135deg, var(--competition-group), #34d399);
  color: white;
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
  border-radius: 8px;
  margin-left: 0.5rem;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.3);
}

/* Indicador de admin (crown emoji) */
.chat-friend-name .admin-indicator {
  margin-left: 0.25rem;
  font-size: 0.9em;
}
}
/* Badge de competição */
.competition-badge {
  background: linear-gradient(135deg, #059669, #34d399);
  color: white;
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
  border-radius: 8px;
  margin-left: 0.5rem;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.3);
}

/* Grupos regulares vs competição */
.regular-group {
  border-left: 3px solid #4F46E5;
}

.regular-group:hover {
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.1) 0%, var(--background) 100%);
}
