/* Chat Component - 3-Panel Telegram-Style Layout - SOLIUS Design System */

/* ==========================================
   HIDE OLD SLIDING PANEL ARCHITECTURE
   ========================================== */

/* Hide any old right panels that slide over */
.right-panel,
.chat-panel-overlay,
.sliding-panel,
.glossy-panel,
.right-panel-container,
.left-panel-container,
.panel-overlay {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Ensure chat stays within 3-panel container */
.chat-three-panel {
  position: relative !important;
  overflow: hidden !important;
}

.chat-container {
  position: relative !important;
  overflow: hidden !important;
}

/* Prevent any panels from escaping container */
.chat-contacts-panel,
.chat-conversation-panel,
.chat-details-panel {
  position: relative !important;
  overflow: hidden !important;
}

/* Hide old chat sections that might still be rendered */
.chat-user-section,
.chat-contacts-section,
.chat-content-area,
.chat-groups-content,
.chat-unwanted-content,
.chat-contacts-content,
.chat-contacts-list,
.chat-tab,
.chat-settings-icon {
  display: none !important;
}

/* ===== MAIN CONTAINER ===== */

/* Agent #3 - Full height stretch */
.chat-three-panel {
  width: 100%;
  height: 100%; /* Full height */
  min-height: 100%; /* Ensure it always fills */
  display: flex;
  background: transparent; /* Let app-frame background show through */
  overflow: hidden;
  padding: 0;
}

/* Agent #3 - Rounded container with top/left border + full height */
.chat-container {
  width: 100%;
  height: 100%; /* Full height */
  min-height: 100%; /* Ensure it always fills */
  /* 📱 POLISH: Removed background */
  display: flex;
  overflow: hidden;
  
  /* Rounded corners - ALL CORNERS 24px */
  border-radius: 24px;
  
  /* 📱 POLISH: Removed border-top */
  border-left: 1px solid rgba(85, 93, 255, 0.15);
  
  /* No border on right and bottom */
  border-right: none;
  border-bottom: none;
}

/* ===== LEFT PANEL: Contacts (320px) ===== */

/* Agent #3 - Left panel respects rounded corners */
.chat-contacts-panel {
  width: 320px;
  height: 100%;
  background: #00091E;
  border-right: 2px solid #141626;
  display: flex;
  flex-direction: column;
  
  /* Match container's left corners (top-left and bottom-left) */
  border-radius: 24px 0 0 24px;
  overflow: hidden; /* Clip content to rounded corners */
}

/* Search Bar */

/* Agent #3 - Extra top padding for rounded corner */
.contacts-search-bar {
  padding: 16px 20px 0px 20px; /* 📱 POLISH: Updated padding */
  /* 📱 POLISH: Removed border-bottom */
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.search-input-wrapper:focus-within {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(85, 93, 255, 0.3);
}

.search-input-wrapper i {
  color: #536285;
  font-size: 16px;
}

.contacts-search-input {
  flex: 1;
  background: none;
  border: none;
  color: #FFFFFF;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  outline: none;
}

.contacts-search-input::placeholder {
  color: #536285;
}

/* Action Buttons */

.contacts-actions {
  display: flex;
  gap: 8px;
  padding: 0; /* 📱 POLISH: Set to 0 */
  /* 📱 POLISH: Removed border-bottom */
}

.btn-invite-friends,
.btn-new-chat {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: transparent;
  border: none;
  color: #555DFF;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-invite-friends:hover,
.btn-new-chat:hover {
  background: #111a40;
  border-radius: 8px;
  box-shadow: none;
}

.btn-invite-friends:active,
.btn-new-chat:active {
  background: #0d1432;
}

/* Tabs */

.contacts-tabs {
  display: flex;
  padding: 0 20px;
  gap: 16px;
  border-bottom: 1px solid rgba(83, 98, 133, 0.3);
}

.contacts-tabs .tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #536285;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.contacts-tabs .tab:hover {
  color: #7B8CFF;
}

.contacts-tabs .tab.active {
  color: #555DFF;
  border-bottom-color: #555DFF;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #555DFF;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  color: #FFFFFF;
}

.contacts-tabs .tab:not(.active) .tab-badge {
  background: rgba(83, 98, 133, 0.5);
}

/* Contacts List */

.contacts-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 20px;
}

/* Custom scrollbar */
.contacts-list::-webkit-scrollbar {
  width: 6px;
}

.contacts-list::-webkit-scrollbar-track {
  background: rgba(83, 98, 133, 0.05);
}

.contacts-list::-webkit-scrollbar-thumb {
  background: rgba(85, 93, 255, 0.3);
  border-radius: 3px;
}

.contacts-list::-webkit-scrollbar-thumb:hover {
  background: rgba(85, 93, 255, 0.5);
}

/* Contact Item - Figma Perfect Match */

.contact-item {
  /* Figma: Frame 1000006093 */
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0px; /* No padding */
  gap: 12px;
  
  width: 280px;
  height: 48px;
  
  /* Inside auto layout */
  flex: none;
  flex-grow: 0;
  
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0 0 12px 0; /* Only bottom margin - no left/right */
}

.contact-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

/* Active contact items - no special background (clean active state) */

.contact-avatar {
  /* Figma: message/avatar */
  width: 48px;
  height: 48px;
  
  background: linear-gradient(180deg, #ECB3FF 0%, #555DFF 100%);
  border-radius: 100px;
  
  /* Inside auto layout */
  flex: none;
  order: 0;
  flex-grow: 0;
  
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 600;
  position: relative;
}

.contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-info {
  /* Figma: Frame 1000006092 */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0px;
  gap: 5px;
  
  width: 220px;
  height: 48px;
  
  /* Inside auto layout */
  flex: none;
  order: 1;
  align-self: stretch;
  flex-grow: 1;
}

.contact-header {
  /* Figma: Frame 1000006094 */
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 0px;
  
  width: 220px;
  height: 20px;
  
  /* Inside auto layout */
  flex: none;
  order: 0;
  align-self: stretch;
  flex-grow: 0;
}

.contact-name {
  /* Figma: Yoda Bro */
  height: 20px;
  
  font-family: 'Montserrat', sans-serif;
  font-style: normal;
  font-weight: 500;
  font-size: 16px;
  line-height: 20px;
  /* identical to box height, or 125% */
  
  color: #FFFFFF;
  
  /* Inside auto layout */
  flex: none;
  order: 0;
  flex-grow: 0;
  
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-time {
  /* Figma: 14:22 */
  height: 16px;
  
  font-family: 'Montserrat', sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: 12px;
  line-height: 16px;
  /* identical to box height, or 133% */
  
  color: #536285;
  
  /* Inside auto layout */
  flex: none;
  order: 1;
  flex-grow: 0;
  flex-shrink: 0;
}

.contact-footer {
  /* Figma: Frame 1000006096 */
  display: flex;
  flex-direction: row;
  align-items: center; /* 🐛 FIX: center instead of flex-start for better alignment */
  padding: 0px;
  gap: 6px; /* 🐛 FIX: Reduced gap to make more room */
  
  width: 220px;
  height: 20px;
  
  /* Inside auto layout */
  flex: none;
  order: 1;
  align-self: stretch;
  flex-grow: 0;
}

.contact-preview {
  /* Figma: Hey, let's play this new ga... */
  flex: 1; /* 🐛 FIX: Use flex instead of fixed width so it shrinks when status icon appears */
  min-width: 0; /* 🐛 FIX: Allow shrinking below content size */
  height: 20px;
  
  font-family: 'Montserrat', sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  /* identical to box height, or 143% */
  
  /* 🐛 FIX: Add text truncation */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  
  color: #536285;
  
  /* Inside auto layout */
  order: 0;
}

.contact-unread {
  /* Figma: Frame 1000006095 (Badge) */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2px 6px; /* 🐛 FIX: Slightly more horizontal padding */
  gap: 8px;
  
  min-width: 20px; /* 🐛 FIX: Smaller min-width */
  height: 18px; /* 🐛 FIX: Slightly smaller height to fit better */
  
  background: #555DFF;
  border-radius: 100px;
  
  /* Inside auto layout */
  flex: none;
  order: 2; /* 🐛 FIX: order 2 (after status icon which is order 1) */
  flex-grow: 0;
  flex-shrink: 0;
  margin-left: 4px; /* 🐛 FIX: Small gap from status icon */
}

.contact-unread span,
.contact-unread {
  /* Figma: Badge number (2) */
  height: 16px;
  
  font-family: 'Montserrat', sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: 12px;
  line-height: 16px;
  /* identical to box height, or 133% */
  
  color: #FFFFFF;
  
  /* Inside auto layout */
  flex: none;
  order: 0;
  flex-grow: 0;
}

/* Status Indicator (Check marks) */
.contact-status {
  width: 12px; /* 🐛 FIX: Match the SVG size we're rendering */
  height: 12px;
  flex-shrink: 0; /* 🐛 FIX: Never shrink the status icon */
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto; /* 🐛 FIX: Push to the right if preview is short */
  
  /* Inside auto layout */
  flex: none;
  order: 1;
}

.contact-status svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* ===== MIDDLE PANEL: Conversation ===== */

/* Agent #3 - Different background color for conversation area */
.chat-conversation-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(10, 15, 35, 0.6); /* Slightly different shade for messages area */
  border-right: 2px solid #141626;
}

/* ==========================================
   MIDDLE PANEL CONTAINMENT
   ========================================== */

/* Ensure conversation panel contains everything */
.chat-conversation-panel {
  position: relative !important;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
}

/* Messages container scrolls vertically */
.conversation-messages {
  flex: 1;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ✅ FIX: Hide ChatInterfaceComponent's duplicate header */
.conversation-messages .chat-interface-header {
  display: none !important;
}

/* ✅ FIX: Make ChatInterfaceComponent fill the container */
.conversation-messages .chat-interface {
  width: 100%;
  height: 100%;
  display: flex !important;
  flex-direction: column !important;
}

/* ✅ FIX: Make messages container fill space and be visible */
.conversation-messages .chat-messages-container {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important; /* Allow flex shrinking */
}

/* ✅ FIX: Make messages area visible and scrollable */
.conversation-messages .chat-messages-area {
  display: flex !important;
  flex-direction: column !important;
  padding: 16px 24px !important;
  gap: 16px !important; /* Space between messages */
  flex-grow: 1 !important;
}

/* ✅ Ensure chat messages are visible - NO backgrounds on parent! */
.conversation-messages .chat-message {
  display: flex !important;
  flex-direction: column !important;
  opacity: 1 !important;
  visibility: visible !important;
  margin-bottom: 8px !important;
  width: 80%;
}

/* Own messages align right */
.conversation-messages .chat-message.own {
  align-self: flex-end !important;
}

/* Other messages align left */
.conversation-messages .chat-message.other {
  align-self: flex-start !important;
}

/* Agent #3 - Removed .conversation-input (ghost div, now unused) */

/* ✅ FIX: Show ChatInterfaceComponent's input area (it's the actual input!) */
/* Agent #3 - Input area matches Figma design */
.conversation-messages .chat-input-area {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  padding: 6px 24px !important; /* Figma spec */
  gap: 12px !important;
  background: #00091E !important; /* Figma spec: darker background */
  border-top: none !important; /* No border in Figma design */
  height: 56px !important; /* Figma spec */
  flex-shrink: 0;
}

/* Context menus stay within conversation panel */
.context-menu {
  position: absolute !important;
  /* Will be positioned relative to .chat-conversation-panel */
}

/* Reaction picker stays within conversation panel */
.reaction-picker {
  position: absolute !important;
  /* Will be positioned relative to .chat-conversation-panel */
}

/* Image preview stays within conversation panel */
.image-preview-modal {
  position: fixed !important;
  /* Can be full screen but with proper z-index */
  z-index: 9999 !important;
}

/* Empty State */

.conversation-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #536285;
  padding: 20px; /* 📱 Mobile centering */
  text-align: center; /* 📱 Mobile centering */
}

.conversation-empty-state i {
  font-size: 64px;
  opacity: 0.5;
}

.conversation-empty-state p {
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
}

/* 🔥 LOADING STATE - LEGENDARY STYLING */
.conversation-empty-state.loading-state {
  gap: 24px;
  animation: fadeIn 0.4s ease-in-out;
}

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

.loading-spinner-container {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-spinner-container::before {
  content: '';
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(85, 93, 255, 0.2) 0%, transparent 70%);
  animation: pulse 2s ease-in-out infinite;
}

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

.loading-spinner-container i {
  font-size: 48px;
  color: #555DFF;
  opacity: 1;
  z-index: 1;
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 18px;
  line-height: 24px;
  color: #FFFFFF;
  margin: 0;
  background: linear-gradient(135deg, #555DFF 0%, #7B83FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.loading-subtext {
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #536285;
  margin: 0;
  animation: fadeInOut 2s ease-in-out infinite;
}

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

/* Conversation Header */

/* Agent #3 - Cleaner header with better spacing + clickable for details panel */
.conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px 24px; /* Extra top padding */
  border-bottom: 1px solid rgba(83, 98, 133, 0.2); /* Lighter border */
  background: rgba(10, 15, 35, 0.6); /* Match conversation panel background */
  cursor: pointer; /* Indicate it's clickable */
  transition: background 0.2s ease; /* Smooth hover effect */
}

/* Agent #3 - Hover effect for conversation header */
.conversation-header:hover {
  background: rgba(15, 20, 40, 0.8); /* Slightly lighter on hover */
}

.conversation-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.conversation-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 20px;
}

.conversation-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.conversation-details {
  display: flex;
  flex-direction: column;
}

.conversation-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #FFFFFF;
}

.conversation-status {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  color: #7BFFBF;
}

.conversation-actions {
  display: flex;
  gap: 12px;
}

.conversation-actions button {
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.conversation-actions button:hover {
  transform: scale(1.1);
}

.conversation-actions .search-icon {
  width: 24px;
  height: 24px;
}

/* Conversation Messages */

.conversation-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Hide embedded component headers (we have our own conversation-header) */
.conversation-messages .chat-interface-header,
.conversation-messages .private-chat-header {
  display: none !important;
}

/* Make embedded chat interface fill the space */
.conversation-messages #chat-interface,
.conversation-messages #private-chat-component {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Make messages area fill available space */
.conversation-messages .chat-messages-container,
.conversation-messages .private-chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: transparent !important;
}

/* Keep input area at bottom */
/* Agent #3 - Input areas match Figma design */
.conversation-messages .chat-input-area,
.conversation-messages .private-chat-input-area {
  padding: 6px 24px !important;
  gap: 12px !important;
  background: #00091E !important; /* Figma spec: darker background */
  border-top: none !important;
  height: 56px !important;
}

/* Agent #3 - Removed duplicate .conversation-input styles (ghost div, now unused) */

/* Agent #3 - Input wrapper (rounded background for text input) */
.chat-input-wrapper {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 2px;
  background: #0D1529; /* Figma spec: darker rounded background */
  border-radius: 16px;
  flex: 1;
  height: 44px;
}

/* Agent #3 - Text input inside wrapper */
.chat-input-wrapper input,
.chat-input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #EBEBEB;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}

.chat-input-wrapper input::placeholder,
.chat-input-wrapper textarea::placeholder {
  color: #536285;
}

/* Agent #3 - Input area icons (paperclip, smile) */
.chat-input-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.chat-input-icon:hover {
  opacity: 0.7;
}

/* Agent #3 - Send button */
.chat-send-button {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.chat-send-button:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.chat-send-button:active {
  transform: scale(0.95);
}

.chat-send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== RIGHT PANEL: Details ===== */

/* Agent #3 - Right panel respects rounded corners + hidden by default */
.chat-details-panel {
  width: 260px;
  background: #00091E;
  display: none; /* Hidden by default - opens when clicking profile header */
  flex-direction: column;
  overflow-y: auto;
  
  /* Match container's right corners (top-right and bottom-right) */
  border-radius: 0 24px 24px 0;
  overflow: hidden; /* Clip content to rounded corners */
}

/* Agent #3 - Show details panel when open */
.chat-details-panel.open {
  display: flex; /* Show panel when .open class is added */
}

/* Details Empty State */

.details-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #536285;
}

.details-empty-state i {
  font-size: 64px;
  opacity: 0.5;
}

.details-empty-state p {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
}

/* Details User Info */

/* Agent #3 - Extra top padding for rounded corner */
.details-user-info {
  padding: 36px 24px 32px 24px; /* Extra top padding for rounded corner */
  text-align: center;
  border-bottom: 1px solid rgba(83, 98, 133, 0.2); /* Lighter border */
}

.details-avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  margin: 0 auto 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 48px;
  box-shadow: 0 4px 16px rgba(85, 93, 255, 0.3);
}

.details-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.details-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: #FFFFFF;
  margin-bottom: 8px;
}

.details-status {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  color: #7BFFBF;
  margin-bottom: 20px;
}

.btn-add-contact {
  width: 100%;
  padding: 12px;
  background: #555DFF;
  border: none;
  border-radius: 12px;
  color: #FFFFFF;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-add-contact:hover {
  background: #6B73FF;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(85, 93, 255, 0.3);
}

/* Details Sections */

.details-sections {
  padding: 24px;
}

.details-section {
  margin-bottom: 24px;
}

/* Media/Files Tabs */

.details-media-tabs {
  display: flex;
  gap: 24px;
  padding: 0 0 16px 0;
  border-bottom: 1px solid rgba(83, 98, 133, 0.3);
  margin-bottom: 16px;
}

.media-tab {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #536285;
  cursor: pointer;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.media-tab:hover {
  color: #7B8CFF;
}

.media-tab.active {
  color: #555DFF;
  border-bottom-color: #555DFF;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: #FFFFFF;
}

.section-count {
  font-size: 14px;
  color: #536285;
  cursor: pointer;
  transition: color 0.2s ease;
}

.section-count:hover {
  color: #7B8CFF;
}

/* Media Grid */

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.media-item {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
  background: rgba(255, 255, 255, 0.03);
}

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

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Block User Button */

.btn-block-user {
  width: 100%;
  padding: 12px;
  background: none;
  border: none;
  color: #FF5558;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-block-user:hover {
  background: rgba(255, 85, 88, 0.1);
}

/* ===== INVITE FRIENDS MODAL ===== */

.invite-friends-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.invite-friends-modal .modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.invite-friends-modal .modal-content {
  position: relative;
  width: 480px;
  background: linear-gradient(180deg, #1C2338 0%, #141626 100%);
  border: 1px solid rgba(85, 93, 255, 0.2);
  border-radius: 16px;
  padding: 32px;
  z-index: 1;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.invite-friends-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.invite-friends-modal h3 {
  font-family: 'Montserrat', sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: #FFFFFF;
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 50%;
  color: #FFFFFF;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.invite-friends-modal .modal-body p {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  color: #A4A9B6;
  margin-bottom: 16px;
}

.share-link-container {
  display: flex;
  gap: 12px;
  margin: 24px 0;
}

.share-link-container input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(85, 93, 255, 0.2);
  border-radius: 12px;
  color: #FFFFFF;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  outline: none;
}

.btn-copy-link {
  padding: 12px 24px;
  background: #555DFF;
  border: none;
  border-radius: 12px;
  color: #FFFFFF;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-copy-link:hover {
  background: #6B73FF;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(85, 93, 255, 0.3);
}

.social-share {
  margin-top: 24px;
}

.social-share p {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  color: #A4A9B6;
  margin-bottom: 12px;
}

.social-buttons {
  display: flex;
  gap: 12px;
}

.btn-social {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 12px;
  color: #FFFFFF;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-social:hover {
  background: rgba(85, 93, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(85, 93, 255, 0.3);
}

/* ===== AVATAR FALLBACK ===== */

.avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #FFFFFF;
}

.avatar-fallback-purple {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ===== ANIMATIONS ===== */

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

/* 🐛 FIX: Only animate on INITIAL load, not on updates */
.contacts-list.initial-load .contact-item {
  animation: fadeIn 0.3s ease forwards;
}

/* No animation on updates (prevents flicker when sending messages) */
.contact-item {
  opacity: 1;
  transform: translateY(0);
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 1400px) {
  .chat-container {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }

  .chat-three-panel {
    padding: 0;
  }
}

@media (max-width: 1024px) {
  .chat-details-panel {
    width: 280px;
  }
}

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

  .chat-conversation-panel,
  .chat-details-panel {
    display: none;
  }
}
