/* CSS Variables for Theme Support */
:root {
  --primary-color: #4ade80;
  --primary-dark: #22c55e;
  --background-color: #ffffff;
  --sidebar-bg: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --message-bg: #f1f5f9;
  --message-own-bg: #4ade80;
  --status-online: #10b981;
  --status-away: #f59e0b;
  --status-offline: #6b7280;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --background-color: #0f172a;
  --sidebar-bg: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --message-bg: #334155;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--background-color);
  color: var(--text-primary);
  direction: rtl;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

/* App Container */
.app-container {
  display: flex; /* Show immediately for testing */
  height: 100vh;
  width: 100vw;
}

.app-container.loaded {
  display: flex;
}

/* Sidebar Styles */
.sidebar {
  width: 280px;
  background-color: var(--sidebar-bg);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* App Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
}

.app-logo i {
  font-size: 24px;
}

/* Search Container */
.search-container {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  right: 12px;
  color: var(--text-secondary);
  font-size: 14px;
}

.search-box input {
  width: 100%;
  padding: 10px 12px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--background-color);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--primary-color);
}

.search-box input::placeholder {
  color: var(--text-secondary);
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.nav-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.nav-tab:hover {
  color: var(--text-primary);
  background-color: rgba(71, 222, 128, 0.1);
}

.nav-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.nav-tab i {
  font-size: 16px;
}

/* Tab Content */
.tab-content {
  flex: 1;
  overflow-y: auto;
  display: none;
}

.tab-content.active {
  display: block;
}

/* Section Styles */
.section {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 12px;
}

.section-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Contact Item Styles */
.contact-item, .chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.contact-item:hover, .chat-item:hover {
  background-color: rgba(71, 222, 128, 0.1);
}

.chat-item.active {
  background-color: var(--primary-color);
  color: white;
}

.chat-item.active .chat-info h4,
.chat-item.active .chat-info p,
.chat-item.active .chat-meta span {
  color: white;
}

/* Avatar Styles */
.avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--sidebar-bg);
}

.status-indicator.online {
  background-color: var(--status-online);
}

.status-indicator.away {
  background-color: var(--status-away);
}

.status-indicator.offline {
  background-color: var(--status-offline);
}

/* Contact Info Styles */
.contact-info, .chat-info {
  flex: 1;
  min-width: 0;
}

.contact-info h4, .chat-info h4 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.chat-info p {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chat Meta */
.chat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.chat-meta .time {
  font-size: 11px;
  color: var(--text-secondary);
}

.pinned-badge {
  font-size: 10px;
  color: var(--text-secondary);
}

/* Channel Item */
.channel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.channel-item:hover {
  background-color: rgba(71, 222, 128, 0.1);
}

.channel-item i {
  color: var(--text-secondary);
  font-size: 14px;
}

.channel-item span {
  font-size: 14px;
  color: var(--text-primary);
}

/* Archived Contacts */
.archived-contacts {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s;
}

.archived-contacts:hover {
  color: var(--text-primary);
}

/* Button Styles */
.btn-icon {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  background-color: rgba(71, 222, 128, 0.1);
  color: var(--primary-color);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-send {
  width: 36px;
  height: 36px;
  border: none;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-send:hover {
  background-color: var(--primary-dark);
  transform: scale(1.05);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
}

/* Main Content Styles */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: var(--background-color);
}

/* Welcome Screen */
.welcome-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}

.welcome-content {
  max-width: 400px;
  padding: 40px;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.welcome-icon i {
  font-size: 32px;
  color: white;
}

.welcome-content h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.welcome-content p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 32px;
}

/* Chat Screen */
.chat-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--background-color);
}

.chat-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-details h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.status-text {
  font-size: 12px;
  color: var(--status-online);
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Pinned Messages */
.pinned-messages {
  background-color: #fef3c7;
  border-bottom: 1px solid var(--border-color);
}

.pinned-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  color: #92400e;
  font-size: 13px;
  font-weight: 500;
}

.pinned-banner i {
  font-size: 14px;
}

/* Messages Container */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  background-color: var(--background-color);
}

.message {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.message.own {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-content {
  flex: 1;
  max-width: 70%;
}

.message.own .message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.message.own .message-header {
  flex-direction: row-reverse;
}

.message-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.message-time {
  font-size: 11px;
  color: var(--text-secondary);
}

.message-bubble {
  background-color: var(--message-bg);
  padding: 8px 12px;
  border-radius: 12px;
  border-top-right-radius: 4px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-primary);
}

.message.own .message-bubble {
  background-color: var(--message-own-bg);
  color: white;
  border-top-right-radius: 12px;
  border-top-left-radius: 4px;
}

.message-attachment {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 13px;
}

.message-attachment i {
  color: var(--primary-color);
}

/* Message Input */
.message-input-container {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background-color: var(--background-color);
}

.message-input {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  background-color: var(--background-color);
}

.input-wrapper {
  flex: 1;
}

.input-wrapper input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  padding: 4px 0;
}

.input-wrapper input::placeholder {
  color: var(--text-secondary);
}

/* Profile Screen */
.profile-screen {
  height: 100%;
  overflow-y: auto;
}

.profile-header {
  height: 200px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
}

.profile-content {
  padding: 24px;
  background-color: var(--background-color);
  margin-top: -50px;
  border-radius: 16px 16px 0 0;
  position: relative;
  z-index: 1;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid white;
  margin: -50px auto 20px;
  overflow: hidden;
  position: relative;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info {
  text-align: center;
  margin-bottom: 24px;
}

.profile-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.profile-title {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.profile-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 400px;
  margin: 0 auto;
}

/* Profile Details */
.profile-details {
  margin-bottom: 24px;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-icon {
  width: 20px;
  color: var(--text-secondary);
}

.detail-text {
  font-size: 14px;
  color: var(--text-primary);
}

/* Media Grid */
.media-section {
  margin-bottom: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.show-all-btn {
  color: var(--primary-color);
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.media-item {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}

.media-item:hover {
  transform: scale(1.05);
}

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Additional Settings Styles */
.settings-header {
  position: relative;
}

.settings-profile {
  text-align: center;
  padding: 20px;
  background-color: var(--background-color);
  margin-top: -30px;
  border-radius: 16px 16px 0 0;
  position: relative;
  z-index: 1;
}

.settings-profile .profile-avatar {
  position: relative;
  margin-bottom: 16px;
}

.avatar-edit {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  font-size: 12px;
}

.status-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.status-select {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}

.settings-content {
  padding: 20px;
}

.settings-section {
  margin-bottom: 32px;
}

.settings-section .section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.settings-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.setting-item label {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.setting-input {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--background-color);
  color: var(--text-primary);
  font-size: 14px;
  width: 200px;
}

.setting-select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--background-color);
  color: var(--text-primary);
  font-size: 14px;
  width: 150px;
  cursor: pointer;
}

.color-picker {
  display: flex;
  gap: 8px;
}

.color-option {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s;
}

.color-option.active {
  border-color: var(--text-primary);
  transform: scale(1.2);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 24px;
  transition: 0.3s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  right: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .toggle-slider {
  background-color: var(--primary-color);
}

input:checked + .toggle-slider:before {
  transform: translateX(-20px);
}

.btn-secondary {
  background-color: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background-color: var(--primary-color);
  color: white;
}

.btn-danger {
  background-color: #ef4444;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.settings-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.app-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.app-info h4 {
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.app-info h4:hover {
  color: var(--primary-color);
}

.app-version {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  padding: 8px;
  background-color: var(--sidebar-bg);
  border-radius: 6px;
}

/* Contact Group Styles */
.contact-group {
  margin-bottom: 16px;
}

.contact-group-header {
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background-color: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-color);
}

.contact-more {
  opacity: 0;
  transition: opacity 0.2s;
}

.contact-item:hover .contact-more {
  opacity: 1;
}

/* Profile Action Buttons */
.profile-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
}

.profile-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  min-width: 60px;
}

.profile-action span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* File Item Styles */
.attached-files {
  margin-top: 24px;
}

.attached-files h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 8px;
}

.file-item i {
  font-size: 24px;
  color: #ef4444;
}

.file-info {
  flex: 1;
}

.file-name {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 2px;
}

.file-size {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Message Images */
.message-images {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.message-image {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.message-image:hover {
  transform: scale(1.05);
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .chat-user-info {
    margin-left: 12px;
  }
  
  .welcome-content {
    padding: 20px;
  }
  
  .welcome-content h2 {
    font-size: 20px;
  }
  
  .settings-content {
    padding: 16px;
  }
  
  .setting-input,
  .setting-select {
    width: 120px;
  }
  
  .profile-actions {
    gap: 8px;
  }
  
  .profile-action {
    min-width: 50px;
    padding: 8px;
  }
}

/* Additional animations */
.contact-item,
.chat-item,
.channel-item {
  animation: slideIn 0.3s ease-in-out;
}

.message {
  animation: fadeIn 0.4s ease-in-out;
}

/* Hover effects */
.setting-input:focus,
.setting-select:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(71, 222, 128, 0.1);
}

/* Additional responsive improvements */
@media (max-width: 480px) {
  .sidebar {
    width: 100%;
  }
  
  .profile-actions {
    flex-wrap: wrap;
  }
  
  .color-picker {
    flex-wrap: wrap;
  }
  
  .settings-section .section-title {
    font-size: 14px;
  }
  
  .setting-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .setting-input,
  .setting-select {
    width: 100%;
  }
}

/* Loading Screen Styles */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  display: none; /* Hide for testing */
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-content {
  text-align: center;
  color: white;
}

.loading-content .app-logo {
  font-size: 32px;
  margin-bottom: 24px;
  animation: pulse 2s infinite;
}

.loading-content .app-logo i {
  font-size: 48px;
  margin-bottom: 8px;
  display: block;
}

.loading-spinner {
  margin: 24px 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

.loading-content p {
  font-size: 16px;
  opacity: 0.9;
}

/* Notification Styles */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: var(--primary-color);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: slideInRight 0.3s ease-out;
  display: none; /* Hidden by default */
}

.notification.show {
  display: block;
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-content i {
  font-size: 16px;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Unread Count Badge */
.unread-count {
  background-color: var(--primary-color);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

/* Enhanced Hover Effects */
.contact-item:hover,
.chat-item:hover,
.channel-item:hover {
  transform: translateX(-2px);
}

.btn-icon:hover {
  transform: scale(1.1);
}

.btn-primary:hover,
.btn-send:hover {
  box-shadow: var(--shadow-lg);
}

/* Improved Focus States */
.nav-tab:focus,
.btn-icon:focus,
.btn-primary:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.search-box input:focus {
  box-shadow: 0 0 0 3px rgba(71, 222, 128, 0.1);
}

/* Enhanced Animations */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.app-logo {
  transition: all 0.3s ease;
}

.app-logo:hover {
  transform: scale(1.05);
}

/* Message Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  color: var(--text-secondary);
  font-size: 13px;
  font-style: italic;
}

.typing-dots {
  display: flex;
  gap: 2px;
}

.typing-dot {
  width: 4px;
  height: 4px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Enhanced Search */
.search-box {
  position: relative;
}

.search-clear {
  position: absolute;
  left: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.search-box:hover .search-clear {
  opacity: 1;
}

/* Context Menu */
.context-menu {
  position: fixed;
  background-color: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 8px 0;
  z-index: 1000;
  min-width: 160px;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 14px;
  color: var(--text-primary);
}

.context-menu-item:hover {
  background-color: rgba(71, 222, 128, 0.1);
}

.context-menu-item i {
  width: 16px;
  color: var(--text-secondary);
}

.context-menu-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 4px 0;
}

/* Drag and Drop */
.drag-over {
  border: 2px dashed var(--primary-color);
  background-color: rgba(71, 222, 128, 0.05);
}

.drag-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(71, 222, 128, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--primary-color);
  font-weight: 600;
  z-index: 100;
}

/* Improved Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --text-secondary: #000000;
  }
  
  [data-theme="dark"] {
    --border-color: #ffffff;
    --text-secondary: #ffffff;
  }
}

/* Screen Display States */
.chat-screen,
.profile-screen {
  display: none;
}

.chat-screen.active,
.profile-screen.active {
  display: flex;
}

.welcome-screen.hidden {
  display: none;
}
