.chat {
  max-width: 1400px;
  margin: 0 auto;
  height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
}

.chat-container {
  display: flex;
  gap: 1.5rem;
  height: 100%;
  background: var(--bg-secondary);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.conversations-list {
  width: 320px;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--bg-secondary);
}

.conversations-list h2 {
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.conversation-item {
  padding: 1.2rem;
  margin-bottom: 0.8rem;
  border-radius: 12px;
  cursor: pointer;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.conversation-item:hover {
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--accent-primary);
  transform: translateX(4px);
}

.conversation-item.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: var(--bg-primary);
  border-color: transparent;
}

.conversation-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
}

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

.unread-badge {
  background: #ff4757;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.conversation-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--accent-primary);
}

.conversation-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-primary);
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.conversation-item h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.conversation-item.active h4 {
  color: var(--bg-primary);
}

.conversation-item .latest-msg {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.messages-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  background: var(--bg-secondary);
}

.messages-header {
  padding: 0 0 1.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.messages-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.3rem;
  font-weight: 700;
}

.messages-list {
  flex: 1;
  overflow-y: auto;
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  max-width: 70%;
  padding: 1rem 1.2rem;
  border-radius: 12px;
  word-wrap: break-word;
  font-weight: 500;
}

.message.sent {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: var(--bg-primary);
  border-bottom-right-radius: 2px;
}

.message.received {
  align-self: flex-start;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 2px;
}

.message p {
  margin: 0;
  line-height: 1.5;
}

.message .timestamp {
  display: block;
  font-size: 0.75rem;
  margin-top: 0.5rem;
  opacity: 0.7;
}

.message-form {
  display: flex;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.message-form input {
  flex: 1;
  padding: 1rem;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

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

.message-form input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: rgba(0, 212, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.message-form button {
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: var(--bg-primary);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.message-form button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.no-conversation {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.chat .empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

@media (max-width: 768px) {
  .chat-container {
    flex-direction: column;
  }

  .conversations-list {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #eee;
    max-height: 150px;
  }

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