/* ==========================================
   SERVME - PAGES AUTHENTICATED DESKTOP MESSAGING
   Messaging page desktop - DESKTOP uniquement
   Extrait de messaging.css (hors @media mobile)
   ========================================== */

/* ============================================
   SERVME - MESSAGING STYLES
   Chat temps réel et conversations
   =========================================== */

/* === CONTAINER === */
.messages-container {
  display: flex;
  min-height: calc(100vh - 60px - 32px); /* min-height au lieu de height */
  margin-top: 32px; /* Espace sous header */
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--white);
}

/* === SIDEBAR === */
.messages-sidebar {
  width: 350px;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  background: var(--gray-50);
}

.messages-sidebar-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
}

/* Bouton nouveau message - Rond élégant avec plus */
.messages-sidebar-header .btn-new-message {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF385C 0%, #BC1A6E 100%);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 300;
  box-shadow: 0 2px 8px rgba(255, 56, 92, 0.25);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  line-height: 1;
}

.messages-sidebar-header .btn-new-message:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(255, 56, 92, 0.4);
  background: linear-gradient(135deg, #E61E4D 0%, #A0155A 100%);
}

.messages-sidebar-header .btn-new-message:active {
  transform: scale(0.95);
}

.messages-sidebar-header .btn-new-message i {
  font-size: 18px;
  line-height: 1;
}

.messages-sidebar-header h2 {
  font-size: var(--font-2xl);
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

.conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2);
}

.empty-conversations {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  text-align: center;
  color: var(--gray-500);
}

.empty-conversations i {
  font-size: var(--font-4xl);
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-conversations p {
  font-size: var(--font-lg);
  font-weight: 600;
  margin: 0 0 var(--space-2) 0;
}

.empty-conversations small {
  font-size: var(--font-sm);
  color: var(--gray-400);
}

/* === CONVERSATION ITEM === */
.conversation-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease-out;
  margin-bottom: var(--space-2);
  background: var(--white);
  border: 1px solid transparent;
}

.conversation-item:hover {
  background: var(--gray-100);
  transform: translateX(4px);
}

.conversation-item.active {
  background: var(--primary-light);
  border-color: var(--primary);
}

.conversation-avatar {
  position: relative;
  flex-shrink: 0;
}

.conversation-avatar img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gray-200);
}

.conversation-unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--error);
  color: var(--white);
  font-size: var(--font-xs);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  border: 2px solid var(--white);
}

.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-1);
}

.conversation-name {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--gray-900);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-time {
  font-size: var(--font-xs);
  color: var(--gray-500);
  white-space: nowrap;
  margin-left: var(--space-2);
}

.conversation-preview {
  font-size: var(--font-sm);
  color: var(--gray-600);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item.active .conversation-preview {
  color: var(--gray-700);
  font-weight: 500;
}

/* === CHAT AREA === */
.messages-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--white);
}

.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: var(--space-12);
  text-align: center;
  color: var(--gray-500);
}

.chat-empty-state i {
  font-size: var(--font-5xl);
  margin-bottom: var(--space-6);
  opacity: 0.3;
}

.chat-empty-state h3 {
  font-size: var(--font-2xl);
  font-weight: 700;
  color: var(--gray-700);
  margin: 0 0 var(--space-2) 0;
}

.chat-empty-state p {
  font-size: var(--font-base);
  color: var(--gray-500);
  margin: 0;
}

/* === CHAT HEADER === */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-6);
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
}

.chat-header .btn-sm {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 16px !important;
  border-radius: 50% !important;
}

.chat-header .btn-sm i {
  font-size: 16px !important;
  line-height: 1 !important;
}

.chat-header-user {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.chat-header-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gray-200);
}

.chat-header h3 {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 var(--space-1) 0;
}

.chat-header-status {
  font-size: var(--font-sm);
  color: var(--gray-600);
  margin: 0;
}

/* === CHAT MESSAGES === */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--gray-50);
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--gray-500);
}

.chat-empty p {
  font-size: var(--font-lg);
  font-weight: 600;
  margin: 0 0 var(--space-2) 0;
}

.chat-empty small {
  font-size: var(--font-sm);
  color: var(--gray-400);
}

.chat-message {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  max-width: 70%;
  animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--gray-200);
}

.chat-message-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.chat-message.own .chat-message-content {
  align-items: flex-end;
}

.chat-message-text {
  background: var(--white);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--font-base);
  color: var(--gray-900);
  margin: 0;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
  word-wrap: break-word;
}

.chat-message.own .chat-message-text {
  background: var(--primary);
  color: var(--white);
}

.chat-message-file {
  background: var(--white);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.chat-message.own .chat-message-file {
  background: var(--primary-light);
}

.chat-file-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--primary);
  text-decoration: none;
  font-size: var(--font-sm);
  font-weight: 600;
}

.chat-file-link:hover {
  text-decoration: underline;
}

.chat-file-link i {
  font-size: var(--font-lg);
}

.chat-message-time {
  font-size: var(--font-xs);
  color: var(--gray-500);
  padding: 0 var(--space-2);
}

.chat-message.own .chat-message-time {
  text-align: right;
}

/* === CHAT INPUT === */
.chat-input-area {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 15px !important;
  background: var(--white) !important;
  border-top: 1px solid var(--gray-200) !important;
}

.chat-attach-btn {
  background: none;
  border: none;
  color: var(--gray-600);
  font-size: var(--font-xl);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius);
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-attach-btn:hover {
  background: var(--gray-100);
  color: var(--primary);
}

.chat-message-input {
  flex: 1 !important;
  display: block !important;
  min-height: 44px !important;
  padding: 12px 15px !important;
  border: 1px solid var(--gray-300) !important;
  border-radius: 22px !important;
  background: var(--white) !important;
  color: var(--gray-900) !important;
  font-size: 14px !important;
  font-family: inherit !important;
  resize: none !important;
  outline: none !important;
  box-sizing: border-box !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  cursor: text !important;
  max-height: 120px !important;
  transition: all 0.2s !important;
}

.chat-message-input::placeholder {
  color: var(--gray-500) !important;
  opacity: 1;
}

.chat-message-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.chat-send-btn {
  flex-shrink: 0 !important;
  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 44px !important;
  max-width: 44px !important;
}

/* Scrollbar styling */
.conversations-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.conversations-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.conversations-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.conversations-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

