/* PAGE MESSAGES CUISINIER */

.chef-messages-main {
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 80px 20px 20px;
}

.messages-container {
  max-width: 1400px;
  margin: 0 auto;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: grid;
  grid-template-columns: 350px 1fr;
  height: calc(100vh - 120px);
}

/* Sidebar Conversations */
.conversations-sidebar {
  border-right: 1px solid #e9ecef;
  display: flex;
  flex-direction: column;
  background: #f8f9fa;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid #e9ecef;
  background: white;
}

.sidebar-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: #1a1a1a;
  margin: 0 0 16px;
}

.search-conversations input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 50px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.search-conversations input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 138, 0, 0.1);
}

.conversations-list {
  flex: 1;
  overflow-y: auto;
}

.conversation-item {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-bottom: 1px solid #e9ecef;
  background: white;
  position: relative;
}

.conversation-item:hover {
  background: #fff8f0;
}

.conversation-item.active {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: white;
}

.conversation-item.unread {
  background: #fff8f0;
  font-weight: 700;
}

.conversation-item.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 40px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}

.conversation-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #e9ecef;
}

.conversation-item.active .conversation-avatar {
  border-color: white;
}

.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-name {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item.active .conversation-name {
  color: white;
}

.conversation-last-message {
  font-size: 13px;
  color: #666;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item.active .conversation-last-message {
  color: rgba(255, 255, 255, 0.9);
}

.conversation-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.conversation-time {
  font-size: 12px;
  color: #999;
}

.conversation-item.active .conversation-time {
  color: rgba(255, 255, 255, 0.9);
}

.conversation-unread-badge {
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 50px;
  min-width: 20px;
  text-align: center;
}

.conversation-item.active .conversation-unread-badge {
  background: white;
  color: var(--primary);
}

.conversations-empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.empty-icon {
  font-size: 60px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Zone de Chat */
.chat-area {
  display: flex;
  flex-direction: column;
  background: white;
}

.chat-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.welcome-icon {
  font-size: 80px;
  margin-bottom: 20px;
  opacity: 0.3;
}

.chat-welcome h3 {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 12px;
}

.chat-welcome p {
  font-size: 16px;
  color: #666;
  margin: 0;
}

.chat-active {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
}

.chat-contact-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.chat-contact-name {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 4px;
}

.chat-contact-status {
  font-size: 13px;
  color: #00b894;
  margin: 0;
}

.chat-close {
  width: 40px;
  height: 40px;
  border: none;
  background: #f8f9fa;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.chat-close:hover {
  background: #e9ecef;
}

.chat-messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8f9fa;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 70%;
  animation: messageSlideIn 0.3s ease;
}

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

.message.sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.received {
  align-self: flex-start;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.message.sent .message-bubble {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
  background: white;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.message-time {
  font-size: 11px;
  color: #999;
  padding: 0 8px;
}

.message.sent .message-time {
  text-align: right;
}

.message-date-separator {
  text-align: center;
  padding: 16px 0;
  color: #999;
  font-size: 13px;
  font-weight: 600;
}

.chat-input-area {
  padding: 20px 24px;
  border-top: 1px solid #e9ecef;
  background: white;
}

.chat-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-form textarea {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  transition: all 0.3s ease;
}

.chat-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 138, 0, 0.1);
}

.btn-send-message {
  width: 48px;
  height: 48px;
  border: none;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: white;
  border-radius: 12px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.btn-send-message:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 138, 0, 0.4);
}

.btn-send-message:active {
  transform: translateY(0);
}

.btn-send-message:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Messages de chargement */
.chat-loading {
  text-align: center;
  padding: 20px;
  color: #999;
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: loadingDot 1.4s infinite ease-in-out both;
}

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

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

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

/* Scrollbar custom */
.conversations-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.conversations-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.conversations-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.conversations-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Responsive */
@media (max-width: 992px) {
  .messages-container {
    grid-template-columns: 1fr;
    position: relative;
  }

  .conversations-sidebar {
    display: flex;
  }

  .chat-area {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
  }

  .chat-area.active {
    display: flex;
  }

  .conversations-sidebar.hidden {
    display: none;
  }

  .chat-close {
    display: flex;
  }

  .message {
    max-width: 85%;
  }
}

@media (max-width: 768px) {
  .chef-messages-main {
    padding: 70px 0 0;
  }

  .messages-container {
    border-radius: 0;
    height: calc(100vh - 70px);
  }

  .sidebar-header {
    padding: 16px;
  }

  .sidebar-header h2 {
    font-size: 20px;
  }

  .conversation-item {
    padding: 12px 16px;
  }

  .chat-header {
    padding: 16px;
  }

  .chat-messages {
    padding: 16px;
  }

  .chat-input-area {
    padding: 12px 16px;
  }
}
